geney 1.3.10__py2.py3-none-any.whl → 1.3.11__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of geney might be problematic. Click here for more details.
geney/splicing_utils.py
CHANGED
|
@@ -591,69 +591,72 @@ cursor = conn.cursor()
|
|
|
591
591
|
# Create table once at startup, not in the function
|
|
592
592
|
cursor.execute('''
|
|
593
593
|
CREATE TABLE IF NOT EXISTS mutations (
|
|
594
|
-
|
|
594
|
+
engine TEXT,
|
|
595
595
|
gene TEXT,
|
|
596
|
-
|
|
596
|
+
mut_id TEXT,
|
|
597
597
|
transcript_id TEXT,
|
|
598
598
|
data TEXT,
|
|
599
|
-
PRIMARY KEY (
|
|
599
|
+
PRIMARY KEY (engine, gene, mut_id, transcript_id)
|
|
600
600
|
)''')
|
|
601
601
|
|
|
602
602
|
|
|
603
|
-
def get_splicing(
|
|
603
|
+
def get_splicing(engine, gene, mut_id, transcript_id, force_recompute=False):
|
|
604
604
|
"""
|
|
605
605
|
Retrieve computed splicing data for a given mutation from a database,
|
|
606
606
|
Args:
|
|
607
|
-
|
|
607
|
+
engine (str): Name of the tool used for computation.
|
|
608
608
|
gene (str): Gene name or identifier.
|
|
609
|
-
|
|
609
|
+
mut_id (str): A unique identifier for the mutation.
|
|
610
610
|
transcript_id (str): ID for the transcript.
|
|
611
611
|
force_recompute (bool): If True, ignore cached value and recompute.
|
|
612
612
|
Returns:
|
|
613
613
|
dict: The splicing data.
|
|
614
614
|
"""
|
|
615
615
|
# Lookup in the database
|
|
616
|
-
cursor.execute('SELECT data FROM mutations WHERE
|
|
617
|
-
(
|
|
616
|
+
cursor.execute('SELECT data FROM mutations WHERE engine=? AND gene=? AND mut_id=? AND transcript_id=?',
|
|
617
|
+
(engine, gene, mut_id, transcript_id))
|
|
618
618
|
row = cursor.fetchone()
|
|
619
619
|
# If found and no force recompute, return cached data
|
|
620
620
|
if row:
|
|
621
621
|
return json.loads(row[0])
|
|
622
622
|
return None
|
|
623
623
|
|
|
624
|
-
def save_splicing(
|
|
624
|
+
def save_splicing(engine, gene, mut_id, transcript_id, splicing):
|
|
625
625
|
data_json = json.dumps(convert_numpy_to_native(splicing))
|
|
626
|
-
cursor.execute('REPLACE INTO mutations (
|
|
627
|
-
(
|
|
626
|
+
cursor.execute('REPLACE INTO mutations (engine, gene, mut_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
|
|
627
|
+
(engine, gene, mut_id, transcript_id, data_json))
|
|
628
628
|
return None
|
|
629
629
|
|
|
630
|
-
def get_or_compute_splicing(
|
|
630
|
+
def get_or_compute_splicing(mut_id, transcript_id=None, engine='spliceai', force_recompute=False):
|
|
631
631
|
"""
|
|
632
632
|
Retrieve computed splicing data for a given mutation from a database,
|
|
633
633
|
or compute and store it if not found or if force_recompute is True.
|
|
634
634
|
Args:
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
mutation_id (str): A unique identifier for the mutation.
|
|
635
|
+
engine (str): Name of the tool used for computation.
|
|
636
|
+
mut_id (str): A unique identifier for the mutation.
|
|
638
637
|
transcript_id (str): ID for the transcript.
|
|
639
638
|
force_recompute (bool): If True, ignore cached value and recompute.
|
|
640
639
|
Returns:
|
|
641
640
|
dict: The computed splicing data.
|
|
642
641
|
"""
|
|
642
|
+
gene = mut_id.split(':')[0]
|
|
643
|
+
if transcript_id is None:
|
|
644
|
+
transcript_id = Gene.from_file(gene).transcript().transcript_id
|
|
645
|
+
|
|
643
646
|
# Lookup in the database
|
|
644
|
-
cursor.execute('SELECT data FROM mutations WHERE
|
|
645
|
-
(
|
|
647
|
+
cursor.execute('SELECT data FROM mutations WHERE engine=? AND gene=? AND mut_id=? AND transcript_id=?',
|
|
648
|
+
(engine, gene, mut_id, transcript_id))
|
|
646
649
|
row = cursor.fetchone()
|
|
647
650
|
# If found and no force recompute, return cached data
|
|
648
651
|
if row and not force_recompute:
|
|
649
652
|
return json.loads(row[0])
|
|
650
653
|
# Otherwise, compute the data
|
|
651
|
-
computed_data = convert_numpy_to_native(find_transcript_missplicing(
|
|
654
|
+
computed_data = convert_numpy_to_native(find_transcript_missplicing(mut_id, transcript=transcript_id, engine=engine).missplicing) # Replace with your actual function
|
|
652
655
|
# Store computed data in DB
|
|
653
656
|
data_json = json.dumps(computed_data)
|
|
654
|
-
cursor.execute('REPLACE INTO mutations (
|
|
655
|
-
(
|
|
656
|
-
return
|
|
657
|
+
cursor.execute('REPLACE INTO mutations (engine, gene, mut_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
|
|
658
|
+
(engine, gene, mut_id, transcript_id, data_json))
|
|
659
|
+
return computed_data
|
|
657
660
|
|
|
658
661
|
|
|
659
662
|
def convert_numpy_to_native(obj):
|
|
@@ -16,7 +16,7 @@ geney/pangolin_utils.py,sha256=i5j5vEMCWOTIa1mRP2377BAhlUFZjHBzTQBips4lA_4,2934
|
|
|
16
16
|
geney/power_utils.py,sha256=MehZFUdkJ2EFUot709yPEDxSkXmH5XevMebX2HD768A,7330
|
|
17
17
|
geney/seqmat_utils.py,sha256=wzb3PX5it5bpIFQvcxyzlxfhoJTbHHbsjg0rzh05iVs,19753
|
|
18
18
|
geney/spliceai_utils.py,sha256=PFIhTK8Ihrj-cv5tgRN0UFPYEmC4uxtqXSP9bBLnZRM,3077
|
|
19
|
-
geney/splicing_utils.py,sha256=
|
|
19
|
+
geney/splicing_utils.py,sha256=Bj5YV-LHs684afjriep7N2QaRAAKdidFS-adihfDzfI,31887
|
|
20
20
|
geney/survival_utils.py,sha256=KnAzEviMuXh6SnVXId9PgsFLSbgkduTvYoIthxN7FPA,6886
|
|
21
21
|
geney/tcga_utils.py,sha256=D_BNHm-D_K408dlcJm3hzH2c6QNFjQsKvUcOPiQRk7g,17612
|
|
22
22
|
geney/tis_utils.py,sha256=2makfGfVlDFVIbxzXE85AY9jmAjcNmxyIAxjvkRA5LY,7396
|
|
@@ -25,7 +25,7 @@ geney/translation_initiation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
25
25
|
geney/translation_initiation/tis_utils.py,sha256=AF3siFjuQH-Rs44EV-80zHdbxRMvN4woLFSHroWIETc,4448
|
|
26
26
|
geney/translation_initiation/resources/kozak_pssm.json,sha256=pcd0Olziutq-6H3mFWDCD9cujQ_AlZO-iiOvBl82hqE,1165
|
|
27
27
|
geney/translation_initiation/resources/tis_regressor_model.joblib,sha256=IXb4DUDhJ5rBDKcqMk9zE3ECTZZcdj7Jixz3KpoZ7OA,2592025
|
|
28
|
-
geney-1.3.
|
|
29
|
-
geney-1.3.
|
|
30
|
-
geney-1.3.
|
|
31
|
-
geney-1.3.
|
|
28
|
+
geney-1.3.11.dist-info/METADATA,sha256=Por9VSaGxOGXy61knApS-3BefXSrh8hhQQQ0ULGQn2I,971
|
|
29
|
+
geney-1.3.11.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
|
|
30
|
+
geney-1.3.11.dist-info/top_level.txt,sha256=O-FuNUMb5fn9dhZ-dYCgF0aZtfi1EslMstnzhc5IIVo,6
|
|
31
|
+
geney-1.3.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|