OpenSpliceai 0.0.3__tar.gz → 0.0.5__tar.gz

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.
Files changed (51) hide show
  1. {openspliceai-0.0.3 → openspliceai-0.0.5}/PKG-INFO +7 -7
  2. {openspliceai-0.0.3 → openspliceai-0.0.5}/README.md +3 -4
  3. openspliceai-0.0.5/openspliceai/__init__.py +1 -0
  4. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/create_datafile.py +12 -2
  5. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/create_dataset.py +1 -0
  6. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/paralogs.py +15 -15
  7. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/utils.py +35 -1
  8. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/header.py +2 -2
  9. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/openspliceai.py +1 -0
  10. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/predict/predict.py +79 -28
  11. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/train/train.py +6 -4
  12. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/train_base/utils.py +14 -8
  13. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/transfer/transfer.py +4 -3
  14. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/variant/utils.py +39 -15
  15. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/variant/variant.py +3 -3
  16. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/PKG-INFO +7 -7
  17. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/SOURCES.txt +6 -6
  18. {openspliceai-0.0.3 → openspliceai-0.0.5}/setup.py +2 -2
  19. openspliceai-0.0.3/openspliceai/__init__.py +0 -1
  20. {openspliceai-0.0.3 → openspliceai-0.0.5}/LICENSE +0 -0
  21. {openspliceai-0.0.3 → openspliceai-0.0.5}/MANIFEST.in +0 -0
  22. {openspliceai-0.0.3 → openspliceai-0.0.5}/logo/jhu-logo-dark.png +0 -0
  23. {openspliceai-0.0.3 → openspliceai-0.0.5}/logo/logo_black.png +0 -0
  24. {openspliceai-0.0.3 → openspliceai-0.0.5}/logo/logo_white.png +0 -0
  25. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/__init__.py +0 -0
  26. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/calibrate.py +0 -0
  27. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/calibrate_utils.py +0 -0
  28. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/model_utils.py +0 -0
  29. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/temperature_scaling.py +0 -0
  30. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/temperature_scaling_site_only.py +0 -0
  31. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/calibrate/visualization.py +0 -0
  32. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/constants.py +0 -0
  33. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/__init__.py +0 -0
  34. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/create_data/verify_h5_file.py +0 -0
  35. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/merge_data/__init__.py +0 -0
  36. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/merge_data/merge_dataset.py +0 -0
  37. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/predict/__init__.py +0 -0
  38. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/predict/utils.py +0 -0
  39. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/test/__init__.py +0 -0
  40. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/test/test.py +0 -0
  41. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/train/__init__.py +0 -0
  42. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/train_base/__init__.py +0 -0
  43. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/train_base/openspliceai.py +0 -0
  44. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/transfer/__init__.py +0 -0
  45. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/variant/__init__.py +0 -0
  46. {openspliceai-0.0.3 → openspliceai-0.0.5}/openspliceai/variant/get_anno.py +0 -0
  47. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/dependency_links.txt +0 -0
  48. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/entry_points.txt +0 -0
  49. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/requires.txt +0 -0
  50. {openspliceai-0.0.3/OpenSpliceai.egg-info → openspliceai-0.0.5/openspliceai.egg-info}/top_level.txt +0 -0
  51. {openspliceai-0.0.3 → openspliceai-0.0.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
2
- Name: OpenSpliceai
3
- Version: 0.0.3
1
+ Metadata-Version: 2.4
2
+ Name: openspliceai
3
+ Version: 0.0.5
4
4
  Summary: Deep learning framework that decodes splicing across species
5
5
  Home-page: https://github.com/Kuanhao-Chao/OpenSpliceAI
6
6
  Author: Kuan-Hao Chao
@@ -29,6 +29,7 @@ Dynamic: author-email
29
29
  Dynamic: description
30
30
  Dynamic: description-content-type
31
31
  Dynamic: home-page
32
+ Dynamic: license-file
32
33
  Dynamic: requires-dist
33
34
  Dynamic: requires-python
34
35
  Dynamic: summary
@@ -37,7 +38,7 @@ Dynamic: summary
37
38
 
38
39
 
39
40
  <a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
40
- <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.3-blue"><img alt="https://img.shields.io/badge/version-v.0.0.3-blue" src="https://img.shields.io/badge/version-v.0.0.3-blue"></a>
41
+ <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.4-blue"><img alt="https://img.shields.io/badge/version-v.0.0.4-blue" src="https://img.shields.io/badge/version-v.0.0.4-blue"></a>
41
42
  <a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads"></a>
42
43
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download"></a>
43
44
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
@@ -97,11 +98,10 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
97
98
  <section id="cite-us">
98
99
  <h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
99
100
  <p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
100
- <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI: An efficient, modular implementation of SpliceAI enabling easy retraining on non-human species"</i> <b>bioRxiv coming soon!</b>.
101
- <a href="https://khchao.com/" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p>
101
+ <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI provides an efficient modular implementation of SpliceAI enabling easy retraining across nonhuman species"</i> <a href="https://doi.org/10.7554/eLife.107454.3" target="_blank"><b><i>eLife</i> 14:RP107454</b></a>.
102
102
 
103
103
  <p>Kishore Jaganathan, Sofia Kyriazopoulou Panagiotopoulou, Jeremy F. McRae, Siavash Fazel Darbandi, David Knowles, Yang I. Li, Jack A. Kosmicki, Juan Arbelaez, Wenwu Cui, Grace B. Schwartz, Eric D. Chow, Efstathios Kanterakis, Hong Gao, Amirali Kia, Serafim Batzoglou, Stephan J. Sanders, and Kyle Kai-How Farh. <i>"Predicting splicing from primary sequence with deep learning"</i> <b>Cell</b>.
104
- <a href="https://doi.org/10.1016/j.cell.2018.12.015" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p><div class="line-block">
104
+
105
105
  <div class="line"><br></div>
106
106
  </div>
107
107
  </section>
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  <a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
5
- <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.3-blue"><img alt="https://img.shields.io/badge/version-v.0.0.3-blue" src="https://img.shields.io/badge/version-v.0.0.3-blue"></a>
5
+ <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.4-blue"><img alt="https://img.shields.io/badge/version-v.0.0.4-blue" src="https://img.shields.io/badge/version-v.0.0.4-blue"></a>
6
6
  <a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads"></a>
7
7
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download"></a>
8
8
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
@@ -62,11 +62,10 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
62
62
  <section id="cite-us">
63
63
  <h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
64
64
  <p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
65
- <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI: An efficient, modular implementation of SpliceAI enabling easy retraining on non-human species"</i> <b>bioRxiv coming soon!</b>.
66
- <a href="https://khchao.com/" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p>
65
+ <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI provides an efficient modular implementation of SpliceAI enabling easy retraining across nonhuman species"</i> <a href="https://doi.org/10.7554/eLife.107454.3" target="_blank"><b><i>eLife</i> 14:RP107454</b></a>.
67
66
 
68
67
  <p>Kishore Jaganathan, Sofia Kyriazopoulou Panagiotopoulou, Jeremy F. McRae, Siavash Fazel Darbandi, David Knowles, Yang I. Li, Jack A. Kosmicki, Juan Arbelaez, Wenwu Cui, Grace B. Schwartz, Eric D. Chow, Efstathios Kanterakis, Hong Gao, Amirali Kia, Serafim Batzoglou, Stephan J. Sanders, and Kyle Kai-How Farh. <i>"Predicting splicing from primary sequence with deep learning"</i> <b>Cell</b>.
69
- <a href="https://doi.org/10.1016/j.cell.2018.12.015" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p><div class="line-block">
68
+
70
69
  <div class="line"><br></div>
71
70
  </div>
72
71
  </section>
@@ -0,0 +1 @@
1
+ __version__ = 'v0.0.5'
@@ -157,10 +157,20 @@ def create_datafile(args):
157
157
  test_data = get_sequences_and_labels(db, args.output_dir, seq_dict, TEST_CHROM_GROUP, 'test', parse_type=args.parse_type, biotype=args.biotype, canonical_only=args.canonical_only, write_fasta=args.write_fasta)
158
158
  if args.remove_paralogs:
159
159
  # Remove homologous sequences
160
- print("> Removing homologous sequences...")
161
- train_data, test_data = paralogs.remove_paralogous_sequences(train_data, test_data, args.min_identity, args.min_coverage, args.output_dir)
160
+ print("> Removing homologous sequences in test...")
161
+ train_data, test_data = paralogs.remove_paralogous_sequences(train_data, test_data, args.min_identity, args.min_coverage, args.output_dir, "test")
162
+
163
+ # Split the training data into training and validation sets (90:10 split)
164
+ print("> Splitting training data into training and validation sets...")
165
+ train_data, val_data = utils.split_train_val(train_data, args.val_split_ratio)
166
+ if args.remove_paralogs:
167
+ # Remove homologous sequences
168
+ print("> Removing homologous sequences in validation...")
169
+ train_data, val_data = paralogs.remove_paralogous_sequences(train_data, val_data, args.min_identity, args.min_coverage, args.output_dir, "validation")
170
+
162
171
  # Write the filtered data to h5 files
163
172
  paralogs.write_h5_file(args.output_dir, "train", train_data)
173
+ paralogs.write_h5_file(args.output_dir, "validation", val_data)
164
174
  paralogs.write_h5_file(args.output_dir, "test", test_data)
165
175
  utils.print_motif_counts(donor_motif_counts, acceptor_motif_counts)
166
176
  print("--- %s seconds ---" % (time.process_time() - start_time))
@@ -24,6 +24,7 @@ def create_dataset(args):
24
24
  elif args.chr_split == 'train-test':
25
25
  dataset_ls.append('test')
26
26
  dataset_ls.append('train')
27
+ dataset_ls.append('validation')
27
28
  for dataset_type in dataset_ls:
28
29
  print(("\tProcessing %s ..." % dataset_type))
29
30
  if args.biotype =="non-coding":
@@ -12,7 +12,7 @@ import h5py
12
12
  import tempfile
13
13
  import os
14
14
 
15
- def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverage, output_dir):
15
+ def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverage, output_dir, exp):
16
16
  """
17
17
  Remove paralogous sequences between train and test datasets using mappy.
18
18
 
@@ -22,9 +22,9 @@ def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverag
22
22
  :param min_coverage: Minimum coverage for sequences to be considered paralogous
23
23
  :return: Tuple of (filtered_train_data, filtered_test_data)
24
24
  """
25
- print(f"Starting paralogy removal process...")
26
- print(f"Initial train set size: {len(train_data[0])}")
27
- print(f"Initial test set size: {len(test_data[0])}")
25
+ print(f"\tStarting paralogy removal process...")
26
+ print(f"\tInitial train set size: {len(train_data[0])}")
27
+ print(f"\tInitial test set size: {len(test_data[0])}")
28
28
  train_seqs = train_data[5] # SEQ is at index 5
29
29
  # Create a temporary file with training sequences
30
30
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
@@ -32,20 +32,20 @@ def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverag
32
32
  temp_file.write(f">seq{i}\n{seq}\n")
33
33
  temp_filename = temp_file.name
34
34
  # Create a mappy index from the training sequences
35
- print("Creating mappy index from training sequences...")
35
+ print("\tCreating mappy index from training sequences...")
36
36
  try:
37
37
  aligner = mp.Aligner(temp_filename, preset="map-ont")
38
38
  if not aligner:
39
- raise Exception("Failed to load/build index")
39
+ raise Exception("\tFailed to load/build index")
40
40
  except Exception as e:
41
- logging.error(f"Error creating mappy aligner: {str(e)}")
41
+ logging.error(f"\tError creating mappy aligner: {str(e)}")
42
42
  os.unlink(temp_filename)
43
43
  return train_data, test_data
44
44
  filtered_test_data = [[] for _ in range(len(test_data))]
45
45
  paralogous_count = 0
46
46
  total_count = len(test_data[5])
47
- fw = open(f"{output_dir}removed_paralogs.txt", "w")
48
- print("Starting to process test sequences...")
47
+ fw = open(f"{output_dir}removed_paralogs_{exp}.txt", "w")
48
+ print("\tStarting to process test sequences...")
49
49
  for i in range(total_count): # Iterate over test sequences
50
50
  test_seq = test_data[5][i]
51
51
  is_paralogous = False
@@ -55,7 +55,7 @@ def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverag
55
55
  fw.write(f"{test_data[0][i]}\t{identity}\t{coverage}\n")
56
56
  if identity >= min_identity and coverage >= min_coverage:
57
57
  # fw.write(f"{test_data[0][i]}\t{identity}\t{coverage}\n")
58
- print(f"\tParalogs detected: Identity: {identity}, Coverage: {coverage}")
58
+ print(f"\t\tParalogs detected: Identity: {identity}, Coverage: {coverage}")
59
59
  is_paralogous = True
60
60
  paralogous_count += 1
61
61
  break
@@ -64,11 +64,11 @@ def remove_paralogous_sequences(train_data, test_data, min_identity, min_coverag
64
64
  filtered_test_data[j].append(test_data[j][i])
65
65
  # Log progress every 1000 sequences
66
66
  if (i + 1) % 1000 == 0:
67
- print(f"Processed {i + 1}/{total_count} sequences...")
68
- print(f"Paralogy removal process completed.")
69
- print(f"Number of paralogous sequences removed: {paralogous_count}")
70
- print(f"Final test set size: {len(filtered_test_data[0])}")
71
- print(f"Percentage of test set removed: {(paralogous_count / total_count) * 100:.2f}%")
67
+ print(f"\tProcessed {i + 1}/{total_count} sequences...")
68
+ print(f"\tParalogy removal process completed.")
69
+ print(f"\tNumber of paralogous sequences removed: {paralogous_count}")
70
+ print(f"\tFinal {exp} set size: {len(filtered_test_data[0])}")
71
+ print(f"\tPercentage of {exp} set removed: {(paralogous_count / total_count) * 100:.2f}%")
72
72
  fw.close()
73
73
  return train_data, filtered_test_data
74
74
 
@@ -203,4 +203,38 @@ def create_datapoints(seq, label):
203
203
  Xd, Yd = reformat_data(X0, Y0)
204
204
  X, Y = one_hot_encode(Xd, Yd)
205
205
 
206
- return X, Y
206
+ return X, Y
207
+
208
+
209
+ def split_train_val(data, val_split_ratio):
210
+ """
211
+ Split training data into training and validation sets.
212
+
213
+ Args:
214
+ data (list of lists): [NAME, CHROM, STRAND, TX_START, TX_END, SEQ, LABEL]
215
+ val_split_ratio (float): proportion of data to use for validation (e.g., 0.1 for 10%)
216
+
217
+ Returns:
218
+ tuple: (train_data, val_data), each a list of lists with the same structure as input
219
+ """
220
+ # Transpose data to a list of records
221
+ records = list(zip(*data))
222
+ # Shuffle records in place for random split
223
+ random.shuffle(records)
224
+ total = len(records)
225
+ val_size = int(total * val_split_ratio)
226
+
227
+ # Split into validation and training records
228
+ val_records = records[:val_size]
229
+ train_records = records[val_size:]
230
+ # Handle case where no records
231
+ if not train_records:
232
+ train_data = [[] for _ in data]
233
+ else:
234
+ train_data = [list(field) for field in zip(*train_records)]
235
+ if not val_records:
236
+ val_data = [[] for _ in data]
237
+ else:
238
+ val_data = [list(field) for field in zip(*val_records)]
239
+ print(f"Split data into {len(train_data[0])} training records and {len(val_data[0])} validation records.")
240
+ return train_data, val_data
@@ -2,10 +2,10 @@ __author__ = "Kuan-Hao Chao"
2
2
  __contact__ = "kuanhao.chao@gmail.com"
3
3
  __copyright__ = "Copyright 2025, Kuan-Hao Chao, Alan Mao"
4
4
  __credits__ = ["Kuan-Hao Chao", "Alan Mao"]
5
- __date__ = "2025/02/24"
5
+ __date__ = "2025/03/21"
6
6
  __deprecated__ = False
7
7
  __email__ = "kuanhao.chao@gmail.com"
8
8
  __license__ = "GPL-3.0"
9
9
  __maintainer__ = "developer"
10
10
  __status__ = "Kuan-Hao Chao"
11
- __version__ = "0.0.3"
11
+ __version__ = "0.0.5"
@@ -27,6 +27,7 @@ def parse_args_create_data(subparsers):
27
27
  parser_create_data.add_argument('--biotype', type=str, default='protein-coding', choices=['protein-coding', 'non-coding', 'all'], help='Biotype of transcript processing')
28
28
  parser_create_data.add_argument('--chr-split', type=str, choices=['train-test','test'], default='train-test', help='Whether to obtain testing or both training and testing groups')
29
29
  parser_create_data.add_argument('--split-method', type=str, choices=['random', 'human'], default='random', help='Chromosome split method for training and testing dataset')
30
+ parser_create_data.add_argument('--val_split_ratio', type=float, default=0.1, help='Ratio of training and validation dataset')
30
31
  parser_create_data.add_argument('--split-ratio', type=float, default=0.8, help='Ratio of training and testing dataset')
31
32
  parser_create_data.add_argument('--canonical-only', action='store_true', default=False, help='Flag to obtain only canonical splice site pairs')
32
33
  parser_create_data.add_argument('--flanking-size', type=int, default=80, help='Sum of flanking sequence lengths on each side of input (i.e. 40+40)')
@@ -552,15 +552,29 @@ def load_pytorch_models(model_path, device, SL, CL):
552
552
  # NOTE: supplied model paths should be state dicts, not model files
553
553
  loaded_models = []
554
554
 
555
+ mismatch_hint = (
556
+ "\t[HINT] Ensure the provided checkpoint was trained with the same --flanking-size "
557
+ f"({CL}) you passed to predict. For the bundled releases, pick a model from the "
558
+ f"`.../{CL}nt/` directory."
559
+ )
560
+
555
561
  for state_dict in models:
556
- try:
557
- model, params = load_model(device, CL) # loads new SpliceAI model with correct hyperparams
558
- model.load_state_dict(state_dict) # loads state dict
559
- model = model.to(device) # puts model on device
560
- model.eval() # puts model in evaluation mode
561
- loaded_models.append(model) # appends model to list of loaded models
562
- except Exception as e:
563
- print(f"\t[ERR] Error processing model for device: {e}. Skipping...")
562
+ model, params = load_model(device, CL) # loads new SpliceAI model with correct hyperparams
563
+ try:
564
+ model.load_state_dict(state_dict) # loads state dict
565
+ except RuntimeError as e:
566
+ err_msg = str(e)
567
+ if "size mismatch" in err_msg or "shape" in err_msg:
568
+ print("\t[WARN] Skipping model due to incompatible tensor shapes.")
569
+ print("\t[WARN] This typically happens when the checkpoint was trained with a different flanking size.")
570
+ print(mismatch_hint)
571
+ continue
572
+ print(f"\t[ERR] Error processing model for device: {err_msg}. Skipping...")
573
+ continue
574
+
575
+ model = model.to(device) # puts model on device
576
+ model.eval() # puts model in evaluation mode
577
+ loaded_models.append(model) # appends model to list of loaded models
564
578
 
565
579
  if not loaded_models:
566
580
  print("\t[ERR] No models were successfully loaded to the device.")
@@ -744,6 +758,30 @@ def get_prediction(models, dataset_path, device, batch_size, output_dir, flush_p
744
758
  ################
745
759
 
746
760
  def write_batch_to_bed(seq_name, gene_predictions, acceptor_bed, donor_bed, threshold=1e-6, debug=False):
761
+ ACCEPTOR_WINDOW = (-1, 0) # capture 1bp specific acceptor site (last intronic base)
762
+ DONOR_WINDOW = (0, 1) # capture 1bp specific donor site (first intronic base)
763
+
764
+ def get_window(pos, window, seq_len):
765
+ start = pos + window[0]
766
+ end = pos + window[1]
767
+ if start < 0 or end > seq_len or end <= start:
768
+ return None
769
+ return start, end
770
+
771
+ def write_interval(bed_handle, chrom, seq_interval, name, label, score, strand, start_1b=None, end_1b=None):
772
+ if seq_interval is None:
773
+ return
774
+ seq_start, seq_end = seq_interval
775
+ if chrom is not None:
776
+ if strand == '+':
777
+ chrom_start = (start_1b - 1) + seq_start
778
+ chrom_end = (start_1b - 1) + seq_end
779
+ else:
780
+ chrom_start = end_1b - seq_end
781
+ chrom_end = end_1b - seq_start
782
+ bed_handle.write(f"{chrom}\t{chrom_start}\t{chrom_end}\t{name}_{label}\t{score:.6f}\t{strand}\n")
783
+ else:
784
+ bed_handle.write(f"{seq_name}\t{seq_start}\t{seq_end}\t{seq_name}_{label}\t{score:.6f}\t{strand}\tabsolute_coordinates\n")
747
785
 
748
786
  # flatten the predictions to a 2D array [total positions, channels]
749
787
  if debug:
@@ -768,6 +806,8 @@ def write_batch_to_bed(seq_name, gene_predictions, acceptor_bed, donor_bed, thre
768
806
  pattern = re.compile(r'.*(chr[a-zA-Z0-9_]*):(\d+)-(\d+)\(([-+.])\)([-+])?.*')
769
807
  match = pattern.match(seq_name)
770
808
 
809
+ seq_len = len(acceptor_scores)
810
+
771
811
  if match:
772
812
  chrom = match.group(1)
773
813
  start = int(match.group(2))
@@ -780,37 +820,48 @@ def write_batch_to_bed(seq_name, gene_predictions, acceptor_bed, donor_bed, thre
780
820
  name = seq_name
781
821
 
782
822
  # handle file writing based on strand
783
- if strand == '+':
784
- for pos in range(len(acceptor_scores)): # NOTE: donor and acceptor should have same num of scores
785
- acceptor_score = acceptor_scores[pos]
786
- donor_score = donor_scores[pos]
787
- if acceptor_score > threshold:
788
- acceptor_bed.write(f"{chrom}\t{start+pos-3}\t{start+pos-1}\t{name}_Acceptor\t{acceptor_score:.6f}\t{strand}\n")
789
- if donor_score > threshold:
790
- donor_bed.write(f"{chrom}\t{start+pos}\t{start+pos+2}\t{name}_Donor\t{donor_score:.6f}\t{strand}\n")
791
- elif strand == '-':
792
- for pos in range(len(acceptor_scores)):
793
- acceptor_score = acceptor_scores[pos]
794
- donor_score = donor_scores[pos]
795
- if acceptor_score > threshold:
796
- acceptor_bed.write(f"{chrom}\t{end-pos}\t{end-pos+2}\t{name}_Acceptor\t{acceptor_score:.6f}\t{strand}\n")
797
- if donor_score > threshold:
798
- donor_bed.write(f"{chrom}\t{end-pos-3}\t{end-pos-1}\t{name}_Donor\t{donor_score:.6f}\t{strand}\n")
799
- else:
823
+ if strand not in ['+', '-']:
800
824
  print(f'\t[ERR] Undefined strand {strand}. Skipping {seq_name} batch...')
825
+ return
826
+
827
+ for pos in range(seq_len):
828
+ acceptor_score = acceptor_scores[pos]
829
+ donor_score = donor_scores[pos]
830
+ acceptor_interval = get_window(pos, ACCEPTOR_WINDOW, seq_len)
831
+ donor_interval = get_window(pos, DONOR_WINDOW, seq_len)
832
+
833
+ if acceptor_score > threshold:
834
+ write_interval(
835
+ acceptor_bed, chrom, acceptor_interval, name, "Acceptor",
836
+ acceptor_score, strand, start, end
837
+ )
838
+ if donor_score > threshold:
839
+ write_interval(
840
+ donor_bed, chrom, donor_interval, name, "Donor",
841
+ donor_score, strand, start, end
842
+ )
801
843
 
802
844
  else: # does not match pattern, could be due to not having gff file, keep writing it
803
845
 
804
846
  strand = seq_name[-1] # use the ending as the strand (when lack other information)
805
847
 
806
848
  # write to file using absolute coordinates (using input FASTA as coordinates rather than GFF)
807
- for pos in range(len(acceptor_scores)):
849
+ for pos in range(seq_len):
808
850
  acceptor_score = acceptor_scores[pos]
809
851
  donor_score = donor_scores[pos]
852
+ acceptor_interval = get_window(pos, ACCEPTOR_WINDOW, seq_len)
853
+ donor_interval = get_window(pos, DONOR_WINDOW, seq_len)
854
+
810
855
  if acceptor_score > threshold:
811
- acceptor_bed.write(f"{seq_name}\t{pos-3}\t{pos-1}\t{seq_name}_Acceptor\t{acceptor_score:.6f}\t{strand}\tabsolute_coordinates\n")
856
+ write_interval(
857
+ acceptor_bed, None, acceptor_interval, seq_name, "Acceptor",
858
+ acceptor_score, strand
859
+ )
812
860
  if donor_score > threshold:
813
- donor_bed.write(f"{seq_name}\t{pos}\t{pos-2}\t{seq_name}_Donor\t{donor_score:.6f}\t{strand}\tabsolute_coordinates\n")
861
+ write_interval(
862
+ donor_bed, None, donor_interval, seq_name, "Donor",
863
+ donor_score, strand
864
+ )
814
865
 
815
866
  # NOTE: need to handle naming when gff file not provided.
816
867
  def generate_bed(predict_file, NAME, LEN, output_dir, threshold=1e-6, batch_ypred=None, debug=False):
@@ -14,7 +14,7 @@ from tqdm import tqdm
14
14
  from openspliceai.train_base.openspliceai import *
15
15
  from openspliceai.train_base.utils import *
16
16
  from openspliceai.constants import *
17
-
17
+ import openspliceai.create_data.paralogs as paralogs
18
18
 
19
19
  def initialize_model_and_optim(device, flanking_size, epochs, scheduler):
20
20
  # Hyper-parameters:
@@ -67,14 +67,16 @@ def train(args):
67
67
  print("Running OpenSpliceAI with 'train' mode")
68
68
  device = setup_environment(args)
69
69
  model_output_base, log_output_train_base, log_output_val_base, log_output_test_base = initialize_paths(args)
70
- train_h5f, test_h5f, batch_num = load_datasets(args)
71
- train_idxs, val_idxs, test_idxs = generate_indices(batch_num, args.random_seed, test_h5f)
70
+ train_h5f, valid_h5f, test_h5f, batch_num = load_datasets(args)
71
+ train_idxs, val_idxs, test_idxs = generate_indices(train_h5f, valid_h5f, test_h5f)
72
+
72
73
  model, optimizer, scheduler, params = initialize_model_and_optim(device, args.flanking_size, args.epochs, args.scheduler)
73
74
  params["RANDOM_SEED"] = args.random_seed
74
75
  train_metric_files = create_metric_files(log_output_train_base)
75
76
  valid_metric_files = create_metric_files(log_output_val_base)
76
77
  test_metric_files = create_metric_files(log_output_test_base)
77
- train_model(model, optimizer, scheduler, train_h5f, test_h5f,
78
+ train_model(model, optimizer, scheduler, train_h5f, valid_h5f, test_h5f,
78
79
  train_idxs, val_idxs, test_idxs, model_output_base, args, device, params, train_metric_files, valid_metric_files, test_metric_files)
79
80
  train_h5f.close()
81
+ valid_h5f.close()
80
82
  test_h5f.close()
@@ -233,17 +233,23 @@ def initialize_paths(args):
233
233
 
234
234
  def load_datasets(args):
235
235
  train_h5f = h5py.File(args.train_dataset, 'r')
236
+ os.path.dirname(args.train_dataset)
237
+ valid_dataset = os.path.join(os.path.dirname(args.train_dataset), os.path.basename(args.train_dataset).replace("train", "validation"))
238
+ valid_h5f = h5py.File(valid_dataset, 'r')
236
239
  test_h5f = h5py.File(args.test_dataset, 'r')
237
240
  batch_num = len(train_h5f.keys()) // 2
238
241
  print("* Batch_num: ", batch_num, file=sys.stderr)
239
- return train_h5f, test_h5f, batch_num
242
+ return train_h5f, valid_h5f, test_h5f, batch_num
240
243
 
241
244
 
242
- def generate_indices(batch_num, random_seed, test_h5f):
243
- np.random.seed(random_seed)
244
- idxs = np.random.permutation(batch_num)
245
- train_idxs = idxs[:int(0.9 * batch_num)]
246
- val_idxs = idxs[int(0.9 * batch_num):]
245
+ def generate_indices(train_h5f, valid_h5f, test_h5f):
246
+ # np.random.seed(random_seed)
247
+ # idxs = np.random.permutation(batch_num)
248
+ # train_idxs = idxs[:int(0.9 * batch_num)]
249
+ # val_idxs = idxs[int(0.9 * batch_num):]
250
+ # test_idxs = np.arange(len(test_h5f.keys()) // 2)
251
+ train_idxs = np.arange(len(train_h5f.keys()) // 2)
252
+ val_idxs = np.arange(len(valid_h5f.keys()) // 2)
247
253
  test_idxs = np.arange(len(test_h5f.keys()) // 2)
248
254
  # # Other approach of splitting test set
249
255
  # # Generate and shuffle indices for training set
@@ -568,7 +574,7 @@ def focal_loss(y_true, y_pred, alpha=0.25, gamma=2.0):
568
574
  + y_true[:, 2, :]*torch.log(y_pred[:, 2, :]+epsilon) * torch.pow(torch.sub(1, y_pred[:, 2, :]), gamma))
569
575
 
570
576
 
571
- def train_model(model, optimizer, scheduler, train_h5f, test_h5f, train_idxs, val_idxs, test_idxs,
577
+ def train_model(model, optimizer, scheduler, train_h5f, valid_h5f, test_h5f, train_idxs, val_idxs, test_idxs,
572
578
  model_output_base, args, device, params,
573
579
  train_metric_files, valid_metric_files, test_metric_files):
574
580
  print(f"train_idxs (count: {len(train_idxs)}): ", train_idxs)
@@ -584,7 +590,7 @@ def train_model(model, optimizer, scheduler, train_h5f, test_h5f, train_idxs, va
584
590
  start_time = time.time()
585
591
  train_loss, global_batch_idx= train_epoch(model, train_h5f,
586
592
  train_idxs, params["BATCH_SIZE"], args.loss, optimizer, scheduler, device, params, train_metric_files, args.flanking_size, run_mode="train", global_batch_idx=global_batch_idx)
587
- val_loss = valid_epoch(model, train_h5f, val_idxs, params["BATCH_SIZE"], args.loss, device,
593
+ val_loss = valid_epoch(model, valid_h5f, val_idxs, params["BATCH_SIZE"], args.loss, device,
588
594
  params, valid_metric_files, args.flanking_size, "validation")
589
595
  test_loss = valid_epoch(model, test_h5f, test_idxs, params["BATCH_SIZE"], args.loss, device,
590
596
  params, test_metric_files, args.flanking_size, "test")
@@ -91,15 +91,16 @@ def transfer(args):
91
91
  # assert training_target in ["RefSeq", "MANE", "SpliceAI", "SpliceAI27"]
92
92
  device = setup_environment(args)
93
93
  model_output_base, log_output_train_base, log_output_val_base, log_output_test_base = initialize_paths(args)
94
- train_h5f, test_h5f, batch_num = load_datasets(args)
95
- train_idxs, val_idxs, test_idxs = generate_indices(batch_num, args.random_seed, test_h5f)
94
+ train_h5f, valid_h5f, test_h5f, batch_num = load_datasets(args)
95
+ train_idxs, val_idxs, test_idxs = generate_indices(train_h5f, valid_h5f, test_h5f)
96
96
  model, optimizer, scheduler, params = initialize_model_and_optim_transfer(device, args.flanking_size, args.epochs, args.scheduler, args.pretrained_model, args.unfreeze, args.unfreeze_all)
97
97
 
98
98
  params["RANDOM_SEED"] = args.random_seed
99
99
  train_metric_files = create_metric_files(log_output_train_base)
100
100
  valid_metric_files = create_metric_files(log_output_val_base)
101
101
  test_metric_files = create_metric_files(log_output_test_base)
102
- train_model(model, optimizer, scheduler, train_h5f, test_h5f, train_idxs,
102
+ train_model(model, optimizer, scheduler, train_h5f, valid_h5f, test_h5f, train_idxs,
103
103
  val_idxs, test_idxs, model_output_base, args, device, params, train_metric_files, valid_metric_files, test_metric_files)
104
104
  train_h5f.close()
105
+ valid_h5f.close()
105
106
  test_h5f.close()
@@ -111,15 +111,29 @@ def load_pytorch_models(model_path, CL):
111
111
  # NOTE: supplied model paths should be state dicts, not model files
112
112
  loaded_models = []
113
113
 
114
+ mismatch_hint = (
115
+ "[HINT] Ensure the checkpoint was trained with the same flanking size "
116
+ f"({CL}) that you supplied. For packaged weights, choose the model from "
117
+ f"the `{CL}nt` directory."
118
+ )
119
+
114
120
  for state_dict in models:
115
- try:
116
- model, params = load_model(device, CL) # loads new SpliceAI model with correct hyperparams
117
- model.load_state_dict(state_dict) # loads state dict
118
- model = model.to(device) # puts model on device
119
- model.eval() # puts model in evaluation mode
120
- loaded_models.append(model) # appends model to list of loaded models
121
- except Exception as e:
122
- logging.error(f"Error processing model for device: {e}. Skipping...")
121
+ model, params = load_model(device, CL) # loads new SpliceAI model with correct hyperparams
122
+ try:
123
+ model.load_state_dict(state_dict) # loads state dict
124
+ except RuntimeError as e:
125
+ err_msg = str(e)
126
+ if "size mismatch" in err_msg or "shape" in err_msg:
127
+ logging.warning("Skipping model due to incompatible tensor shapes.")
128
+ logging.warning("This typically indicates a flanking-size mismatch between the model and CLI arguments.")
129
+ logging.warning(mismatch_hint)
130
+ continue
131
+ logging.error(f"Error processing model for device: {err_msg}. Skipping...")
132
+ continue
133
+
134
+ model = model.to(device) # puts model on device
135
+ model.eval() # puts model in evaluation mode
136
+ loaded_models.append(model) # appends model to list of loaded models
123
137
 
124
138
  if not loaded_models:
125
139
  logging.error("No models were successfully loaded to the device.")
@@ -196,8 +210,9 @@ def one_hot_encode(seq):
196
210
  seq = seq.upper().replace('A', '\x01').replace('C', '\x02')
197
211
  seq = seq.replace('G', '\x03').replace('T', '\x04').replace('N', '\x00')
198
212
 
199
- # Convert the sequence to one-hot encoded numpy array
200
- return map[np.fromstring(seq, np.int8) % 5]
213
+ # Convert the sequence to one-hot encoded numpy array.
214
+ # np.fromstring(binary) was removed in NumPy 2.0; frombuffer works across NumPy versions.
215
+ return map[np.frombuffer(seq.encode('latin-1'), dtype=np.int8) % 5]
201
216
 
202
217
 
203
218
  ####################################################################################################################################
@@ -349,7 +364,7 @@ def normalise_chrom(source, target):
349
364
 
350
365
  return source # Return source as is if both or neither have 'chr' prefix
351
366
 
352
- def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=2):
367
+ def get_delta_scores(record, ann, dist_var, mask, flanking_size=10000, precision=2):
353
368
  """
354
369
  Calculate delta scores for variant impacts on splice sites.
355
370
 
@@ -358,7 +373,7 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=
358
373
  ann (Annotator): Annotator instance with annotation and reference genome data.
359
374
  dist_var (int): Max distance between variant and gained/lost splice site, defaults to 50.
360
375
  mask (bool): Mask scores representing annotated acceptor/donor gain and unannotated acceptor/donor loss, defaults to 0.
361
- flanking_size (int, optional): Size of the flanking region around the variant, defaults to 5000.
376
+ flanking_size (int, optional): Size of the flanking region around the variant, defaults to 10000.
362
377
 
363
378
  Returns:
364
379
  list: Delta scores indicating the impact of variants on splicing.
@@ -366,7 +381,7 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=
366
381
 
367
382
  # Define coverage and window size around the variant
368
383
  cov = 2 * dist_var + 1
369
- wid = 2 * flanking_size + cov
384
+ wid = flanking_size + cov
370
385
  delta_scores = []
371
386
  device = setup_device()
372
387
 
@@ -436,7 +451,6 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=
436
451
  x_alt = one_hot_encode(x_alt)[None, :]
437
452
 
438
453
  '''separate handling of PyTorch and Keras models'''
439
-
440
454
  if ann.keras: # keras model handling
441
455
  # Reverse the sequences if on the negative strand
442
456
  if strands[i] == '-':
@@ -488,9 +502,16 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=
488
502
  # Convert to numpy arrays
489
503
  y_ref = y_ref.numpy()
490
504
  y_alt = y_alt.numpy()
491
-
492
505
  '''end'''
493
506
 
507
+ # Manually crop the output if it exceeds the expected coverage window
508
+ # This handles cases where the model output is not automatically cropped to the target window
509
+ if y_ref.shape[1] > cov:
510
+ start_idx = wid // 2 - cov // 2
511
+ y_ref = y_ref[:, start_idx : start_idx + cov, :]
512
+ y_alt = y_alt[:, start_idx : start_idx + cov + alt_len - ref_len, :]
513
+
514
+
494
515
  # Adjust the alternative sequence scores based on reference and alternative lengths
495
516
  if ref_len > 1 and alt_len == 1:
496
517
  y_alt = np.concatenate([
@@ -514,6 +535,9 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=5000, precision=
514
535
  idx_pd = (y[1, :, 2] - y[0, :, 2]).argmax()
515
536
  idx_nd = (y[0, :, 2] - y[1, :, 2]).argmax()
516
537
 
538
+ # print(f"idx_pa: {idx_pa}, idx_na: {idx_na}, idx_pd: {idx_pd}, idx_nd: {idx_nd}")
539
+ # print("cov:", cov)
540
+
517
541
  # Apply masks to delta scores based on calculated indices and provided mask
518
542
  mask_pa = np.logical_and((idx_pa - cov // 2 == dist_ann[2]), mask)
519
543
  mask_na = np.logical_and((idx_na - cov // 2 != dist_ann[2]), mask)
@@ -25,7 +25,7 @@ def variant(args):
25
25
 
26
26
  # Error handling for required arguments
27
27
  if None in [args.input_vcf, args.output_vcf, args.ref_genome, args.annotation, args.model, args.flanking_size]:
28
- logging.error('Usage: spliceai [-h] [-m [model]] [-f [flanking_size]] [-I [input]] [-O [output]] -R reference -A annotation '
28
+ logging.error('Usage: openspliceai [-h] [-m [model]] [-f [flanking_size]] [-I [input]] [-O [output]] -R reference -A annotation '
29
29
  '[-D [distance]] [-M [mask]]')
30
30
  exit(1)
31
31
 
@@ -56,7 +56,7 @@ def variant(args):
56
56
 
57
57
  # Adding annotation to the header
58
58
  header = vcf.header
59
- header.add_line('##INFO=<ID=SpliceAI,Number=.,Type=String,Description="OpenSpliceAI variant '
59
+ header.add_line('##INFO=<ID=OpenSpliceAI,Number=.,Type=String,Description="OpenSpliceAI variant '
60
60
  'annotation. These include delta scores (DS) and delta positions (DP) for '
61
61
  'acceptor gain (AG), acceptor loss (AL), donor gain (DG), and donor loss (DL). '
62
62
  'Format: ALLELE|SYMBOL|DS_AG|DS_AL|DS_DG|DS_DL|DP_AG|DP_AL|DP_DG|DP_DL">')
@@ -78,7 +78,7 @@ def variant(args):
78
78
  for record in tqdm(vcf):
79
79
  scores = get_delta_scores(record, ann, distance, mask, flanking_size, precision)
80
80
  if scores:
81
- record.info['SpliceAI'] = scores
81
+ record.info['OpenSpliceAI'] = scores
82
82
  output.write(record)
83
83
 
84
84
  # Close input and output VCF files
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
2
- Name: OpenSpliceai
3
- Version: 0.0.3
1
+ Metadata-Version: 2.4
2
+ Name: openspliceai
3
+ Version: 0.0.5
4
4
  Summary: Deep learning framework that decodes splicing across species
5
5
  Home-page: https://github.com/Kuanhao-Chao/OpenSpliceAI
6
6
  Author: Kuan-Hao Chao
@@ -29,6 +29,7 @@ Dynamic: author-email
29
29
  Dynamic: description
30
30
  Dynamic: description-content-type
31
31
  Dynamic: home-page
32
+ Dynamic: license-file
32
33
  Dynamic: requires-dist
33
34
  Dynamic: requires-python
34
35
  Dynamic: summary
@@ -37,7 +38,7 @@ Dynamic: summary
37
38
 
38
39
 
39
40
  <a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
40
- <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.3-blue"><img alt="https://img.shields.io/badge/version-v.0.0.3-blue" src="https://img.shields.io/badge/version-v.0.0.3-blue"></a>
41
+ <a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.4-blue"><img alt="https://img.shields.io/badge/version-v.0.0.4-blue" src="https://img.shields.io/badge/version-v.0.0.4-blue"></a>
41
42
  <a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&amp;units=abbreviation&amp;left_color=grey&amp;right_color=blue&amp;left_text=PyPi%20downloads"></a>
42
43
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&amp;logo=github&amp;label=Download"></a>
43
44
  <a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
@@ -97,11 +98,10 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
97
98
  <section id="cite-us">
98
99
  <h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
99
100
  <p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
100
- <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI: An efficient, modular implementation of SpliceAI enabling easy retraining on non-human species"</i> <b>bioRxiv coming soon!</b>.
101
- <a href="https://khchao.com/" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p>
101
+ <p>Kuan-Hao Chao, Alan Mao, Anqi Liu, Mihaela Pertea, and Steven L. Salzberg. <i>"OpenSpliceAI provides an efficient modular implementation of SpliceAI enabling easy retraining across nonhuman species"</i> <a href="https://doi.org/10.7554/eLife.107454.3" target="_blank"><b><i>eLife</i> 14:RP107454</b></a>.
102
102
 
103
103
  <p>Kishore Jaganathan, Sofia Kyriazopoulou Panagiotopoulou, Jeremy F. McRae, Siavash Fazel Darbandi, David Knowles, Yang I. Li, Jack A. Kosmicki, Juan Arbelaez, Wenwu Cui, Grace B. Schwartz, Eric D. Chow, Efstathios Kanterakis, Hong Gao, Amirali Kia, Serafim Batzoglou, Stephan J. Sanders, and Kyle Kai-How Farh. <i>"Predicting splicing from primary sequence with deep learning"</i> <b>Cell</b>.
104
- <a href="https://doi.org/10.1016/j.cell.2018.12.015" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> </a> </p><div class="line-block">
104
+
105
105
  <div class="line"><br></div>
106
106
  </div>
107
107
  </section>
@@ -2,12 +2,6 @@ LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
4
  setup.py
5
- OpenSpliceai.egg-info/PKG-INFO
6
- OpenSpliceai.egg-info/SOURCES.txt
7
- OpenSpliceai.egg-info/dependency_links.txt
8
- OpenSpliceai.egg-info/entry_points.txt
9
- OpenSpliceai.egg-info/requires.txt
10
- OpenSpliceai.egg-info/top_level.txt
11
5
  logo/jhu-logo-dark.png
12
6
  logo/logo_black.png
13
7
  logo/logo_white.png
@@ -15,6 +9,12 @@ openspliceai/__init__.py
15
9
  openspliceai/constants.py
16
10
  openspliceai/header.py
17
11
  openspliceai/openspliceai.py
12
+ openspliceai.egg-info/PKG-INFO
13
+ openspliceai.egg-info/SOURCES.txt
14
+ openspliceai.egg-info/dependency_links.txt
15
+ openspliceai.egg-info/entry_points.txt
16
+ openspliceai.egg-info/requires.txt
17
+ openspliceai.egg-info/top_level.txt
18
18
  openspliceai/calibrate/__init__.py
19
19
  openspliceai/calibrate/calibrate.py
20
20
  openspliceai/calibrate/calibrate_utils.py
@@ -4,8 +4,8 @@ from pathlib import Path
4
4
  this_directory = Path(__file__).resolve().parent
5
5
  long_description = (this_directory / "./README.md").read_text()
6
6
  setuptools.setup(
7
- name="OpenSpliceai",
8
- version="0.0.3",
7
+ name="openspliceai",
8
+ version="0.0.5",
9
9
  author="Kuan-Hao Chao",
10
10
  author_email="kh.chao@cs.jhu.edu",
11
11
  description="Deep learning framework that decodes splicing across species",
@@ -1 +0,0 @@
1
- __version__ = 'v0.0.3'
File without changes
File without changes
File without changes