66
77from biocommons .seqrepo import SeqRepo
88from gene .query import QueryHandler as GeneQueryHandler
9+ from gene .database import create_db
910
1011from cool_seq_tool .data_sources .alignment_mapper import AlignmentMapper
1112from cool_seq_tool .data_sources .uta_database import UTA_DB_URL
1415from cool_seq_tool .schemas import Assembly , GenomicData , TranscriptExonData , \
1516 ResidueMode , GenomicDataResponse , ServiceMeta , TranscriptExonDataResponse
1617from cool_seq_tool .data_sources import MANETranscript , MANETranscriptMappings , \
17- SeqRepoAccess , TranscriptMappings , UTADatabase , GeneNormalizer
18+ SeqRepoAccess , TranscriptMappings , UTADatabase
1819from cool_seq_tool .version import __version__
1920
2021
@@ -34,25 +35,19 @@ def __init__(
3435 lrg_refseqgene_path : Path = LRG_REFSEQGENE_PATH ,
3536 mane_data_path : Path = MANE_SUMMARY_PATH ,
3637 db_url : str = UTA_DB_URL , gene_query_handler : Optional [GeneQueryHandler ] = None ,
37- gene_db_url : str = "" , gene_db_region : str = "us-east-2" ,
3838 sr : Optional [SeqRepo ] = None
3939 ) -> None :
4040 """Initialize CoolSeqTool class
4141
42- :param Path transcript_file_path: The path to transcript_mapping.tsv
43- :param Path lrg_refseqgene_path: The path to LRG_RefSeqGene
44- :param Path mane_data_path: Path to RefSeq MANE summary data
45- :param str db_url: PostgreSQL connection URL
42+ :param transcript_file_path: The path to transcript_mapping.tsv
43+ :param lrg_refseqgene_path: The path to LRG_RefSeqGene
44+ :param mane_data_path: Path to RefSeq MANE summary data
45+ :param db_url: PostgreSQL connection URL
4646 Format: `driver://user:password@host/database/schema`
47- :param Optional[GeneQueryHandler] gene_query_handler: Gene normalizer query
48- handler instance. If this is provided, will use a current instance. If this
49- is not provided, will create a new instance.
50- :param str gene_db_url: URL to gene normalizer dynamodb. Only used when
51- `gene_query_handler` is `None`.
52- :param str gene_db_region: AWS region for gene normalizer db. Only used when
53- `gene_query_handler` is `None`.
54- :param Optional[SeqRepo] sr: SeqRepo instance. If this is not provided, will
55- create a new instance.
47+ :param gene_query_handler: Gene normalizer query handler instance. If this is
48+ provided, will use a current instance. If this is not provided, will create
49+ a new instance.
50+ :param sr: SeqRepo instance. If this is not provided, will create a new instance
5651 """
5752 if not sr :
5853 sr = SeqRepo (root_dir = SEQREPO_ROOT_DIR )
@@ -63,14 +58,14 @@ def __init__(
6358 self .mane_transcript_mappings = MANETranscriptMappings (
6459 mane_data_path = mane_data_path )
6560 self .uta_db = UTADatabase (db_url = db_url )
66- gene_normalizer = GeneNormalizer ( gene_query_handler , gene_db_url ,
67- gene_db_region )
68- self .gene_query_handler = gene_normalizer . query_handler
61+ if not gene_query_handler :
62+ gene_query_handler = GeneQueryHandler ( create_db () )
63+ self .gene_query_handler = gene_query_handler
6964 self .alignment_mapper = AlignmentMapper (
7065 self .seqrepo_access , self .transcript_mappings , self .uta_db )
7166 self .mane_transcript = MANETranscript (
7267 self .seqrepo_access , self .transcript_mappings ,
73- self .mane_transcript_mappings , self .uta_db , gene_normalizer )
68+ self .mane_transcript_mappings , self .uta_db )
7469
7570 @staticmethod
7671 def service_meta () -> ServiceMeta :
@@ -242,7 +237,7 @@ async def genomic_to_transcript_exon_coordinates(
242237 residue_mode = ResidueMode .INTER_RESIDUE
243238 )
244239 if start_data .transcript_exon_data :
245- start_data = start_data .transcript_exon_data .dict ()
240+ start_data = start_data .transcript_exon_data .model_dump ()
246241 else :
247242 return self ._return_warnings (resp , start_data .warnings [0 ])
248243 else :
@@ -257,7 +252,7 @@ async def genomic_to_transcript_exon_coordinates(
257252 residue_mode = ResidueMode .INTER_RESIDUE
258253 )
259254 if end_data .transcript_exon_data :
260- end_data = end_data .transcript_exon_data .dict ()
255+ end_data = end_data .transcript_exon_data .model_dump ()
261256 else :
262257 return self ._return_warnings (resp , end_data .warnings [0 ])
263258 else :
0 commit comments