geney 1.3.10__py2.py3-none-any.whl → 1.3.12__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
@@ -356,9 +356,13 @@ def process_pairwise_epistasis(mids, engine='pangolin', fprint=False):
356
356
  results = []
357
357
  for mid in mids:
358
358
  m1, m2 = mid.split('|')
359
- missplicing1 = find_transcript_missplicing(m1, threshold=0.25, engine=engine)
360
- missplicing2 = find_transcript_missplicing(m2, threshold=0.25, engine=engine)
361
- missplicing_both = find_transcript_missplicing(mid, threshold=0.25, engine=engine)
359
+ # missplicing1 = find_transcript_missplicing(m1, threshold=0.25, engine=engine)
360
+ # missplicing2 = find_transcript_missplicing(m2, threshold=0.25, engine=engine)
361
+ # missplicing_both = find_transcript_missplicing(mid, threshold=0.25, engine=engine)
362
+
363
+ missplicing1 = Missplicing(get_or_compute_splicing(m1, engine=engine), threshold=0.25)
364
+ missplicing2 = Missplicing(get_or_compute_splicing(m2, engine=engine), threshold=0.25)
365
+ missplicing_both = Missplicing(get_or_compute_splicing(mid, engine=engine), threshold=0.25)
362
366
 
363
367
  if fprint:
364
368
  print(missplicing1)
@@ -457,8 +461,9 @@ class Missplicing:
457
461
  self.threshold = threshold
458
462
 
459
463
  def __str__(self):
464
+ import pprint
460
465
  """String representation displays the filtered splicing events passing the threshold."""
461
- return str(self.significant_events)
466
+ return pprint.pprint(self.aberrant_splicing)
462
467
 
463
468
  def __bool__(self):
464
469
  """
@@ -528,6 +533,7 @@ class Missplicing:
528
533
  return splicing_dict
529
534
  return None
530
535
 
536
+ @property
531
537
  def max_delta(self):
532
538
  """
533
539
  Returns the maximum absolute delta found in all events.
@@ -591,69 +597,72 @@ cursor = conn.cursor()
591
597
  # Create table once at startup, not in the function
592
598
  cursor.execute('''
593
599
  CREATE TABLE IF NOT EXISTS mutations (
594
- tool TEXT,
600
+ engine TEXT,
595
601
  gene TEXT,
596
- mutation_id TEXT,
602
+ mut_id TEXT,
597
603
  transcript_id TEXT,
598
604
  data TEXT,
599
- PRIMARY KEY (tool, gene, mutation_id, transcript_id)
605
+ PRIMARY KEY (engine, gene, mut_id, transcript_id)
600
606
  )''')
601
607
 
602
608
 
603
- def get_splicing(tool, gene, mutation_id, transcript_id, force_recompute=False):
609
+ def get_splicing(engine, gene, mut_id, transcript_id, force_recompute=False):
604
610
  """
605
611
  Retrieve computed splicing data for a given mutation from a database,
606
612
  Args:
607
- tool (str): Name of the tool used for computation.
613
+ engine (str): Name of the tool used for computation.
608
614
  gene (str): Gene name or identifier.
609
- mutation_id (str): A unique identifier for the mutation.
615
+ mut_id (str): A unique identifier for the mutation.
610
616
  transcript_id (str): ID for the transcript.
611
617
  force_recompute (bool): If True, ignore cached value and recompute.
612
618
  Returns:
613
619
  dict: The splicing data.
614
620
  """
615
621
  # Lookup in the database
616
- cursor.execute('SELECT data FROM mutations WHERE tool=? AND gene=? AND mutation_id=? AND transcript_id=?',
617
- (tool, gene, mutation_id, transcript_id))
622
+ cursor.execute('SELECT data FROM mutations WHERE engine=? AND gene=? AND mut_id=? AND transcript_id=?',
623
+ (engine, gene, mut_id, transcript_id))
618
624
  row = cursor.fetchone()
619
625
  # If found and no force recompute, return cached data
620
626
  if row:
621
627
  return json.loads(row[0])
622
628
  return None
623
629
 
624
- def save_splicing(tool, gene, mutation_id, transcript_id, splicing):
630
+ def save_splicing(engine, gene, mut_id, transcript_id, splicing):
625
631
  data_json = json.dumps(convert_numpy_to_native(splicing))
626
- cursor.execute('REPLACE INTO mutations (tool, gene, mutation_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
627
- (tool, gene, mutation_id, transcript_id, data_json))
632
+ cursor.execute('REPLACE INTO mutations (engine, gene, mut_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
633
+ (engine, gene, mut_id, transcript_id, data_json))
628
634
  return None
629
635
 
630
- def get_or_compute_splicing(tool, gene, mutation_id, transcript_id, force_recompute=False):
636
+ def get_or_compute_splicing(mut_id, transcript_id=None, engine='spliceai', force_recompute=False):
631
637
  """
632
638
  Retrieve computed splicing data for a given mutation from a database,
633
639
  or compute and store it if not found or if force_recompute is True.
634
640
  Args:
635
- tool (str): Name of the tool used for computation.
636
- gene (str): Gene name or identifier.
637
- mutation_id (str): A unique identifier for the mutation.
641
+ engine (str): Name of the tool used for computation.
642
+ mut_id (str): A unique identifier for the mutation.
638
643
  transcript_id (str): ID for the transcript.
639
644
  force_recompute (bool): If True, ignore cached value and recompute.
640
645
  Returns:
641
646
  dict: The computed splicing data.
642
647
  """
648
+ gene = mut_id.split(':')[0]
649
+ if transcript_id is None:
650
+ transcript_id = Gene.from_file(gene).transcript().transcript_id
651
+
643
652
  # Lookup in the database
644
- cursor.execute('SELECT data FROM mutations WHERE tool=? AND gene=? AND mutation_id=? AND transcript_id=?',
645
- (tool, gene, mutation_id, transcript_id))
653
+ cursor.execute('SELECT data FROM mutations WHERE engine=? AND gene=? AND mut_id=? AND transcript_id=?',
654
+ (engine, gene, mut_id, transcript_id))
646
655
  row = cursor.fetchone()
647
656
  # If found and no force recompute, return cached data
648
657
  if row and not force_recompute:
649
658
  return json.loads(row[0])
650
659
  # Otherwise, compute the data
651
- computed_data = convert_numpy_to_native(find_transcript_missplicing(mutation_id, transcript=transcript_id, engine=tool).missplicing) # Replace with your actual function
660
+ computed_data = convert_numpy_to_native(find_transcript_missplicing(mut_id, transcript=transcript_id, engine=engine).missplicing) # Replace with your actual function
652
661
  # Store computed data in DB
653
662
  data_json = json.dumps(computed_data)
654
- cursor.execute('REPLACE INTO mutations (tool, gene, mutation_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
655
- (tool, gene, mutation_id, transcript_id, data_json))
656
- return Missplicing(computed_data)
663
+ cursor.execute('REPLACE INTO mutations (engine, gene, mut_id, transcript_id, data) VALUES (?, ?, ?, ?, ?)',
664
+ (engine, gene, mut_id, transcript_id, data_json))
665
+ return computed_data
657
666
 
658
667
 
659
668
  def convert_numpy_to_native(obj):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geney
3
- Version: 1.3.10
3
+ Version: 1.3.12
4
4
  Summary: A Python package for gene expression modeling.
5
5
  Home-page: https://github.com/nicolaslynn/geney
6
6
  Author: Nicolas Lynn
@@ -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=DXX-q9G0IcmPx-gI6h3b6P8x4CTPVIGVM0HXyPz4r8g,31848
19
+ geney/splicing_utils.py,sha256=ZLuUUeIX_Qg8hD6fGRqAbIphzfsWnxXu6wds3ZIwQdY,32229
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.10.dist-info/METADATA,sha256=mNFs019vfrWS0iciRjkA2CcLgycPDaEuH2utIrerZdA,971
29
- geney-1.3.10.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
30
- geney-1.3.10.dist-info/top_level.txt,sha256=O-FuNUMb5fn9dhZ-dYCgF0aZtfi1EslMstnzhc5IIVo,6
31
- geney-1.3.10.dist-info/RECORD,,
28
+ geney-1.3.12.dist-info/METADATA,sha256=QZlovXzCoFEcElIZNHvXX2MBnbjzdUGtKcpcftakqqk,971
29
+ geney-1.3.12.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
30
+ geney-1.3.12.dist-info/top_level.txt,sha256=O-FuNUMb5fn9dhZ-dYCgF0aZtfi1EslMstnzhc5IIVo,6
31
+ geney-1.3.12.dist-info/RECORD,,
File without changes