varcode 10.2.0__tar.gz → 10.3.0__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 (196) hide show
  1. varcode-10.3.0/PKG-INFO +150 -0
  2. varcode-10.3.0/README.md +121 -0
  3. varcode-10.3.0/tests/__init__.py +13 -0
  4. varcode-10.3.0/tests/benchmark_vcf_load.py +73 -0
  5. varcode-10.3.0/tests/common.py +91 -0
  6. varcode-10.3.0/tests/data.py +67 -0
  7. {varcode-10.2.0 → varcode-10.3.0}/tests/test_germline_effects.py +302 -29
  8. {varcode-10.2.0 → varcode-10.3.0}/tests/test_read_phase_resolver.py +62 -0
  9. {varcode-10.2.0 → varcode-10.3.0}/tests/test_transcript_model.py +94 -4
  10. {varcode-10.2.0 → varcode-10.3.0}/varcode/__init__.py +14 -1
  11. {varcode-10.2.0 → varcode-10.3.0}/varcode/effect_hypotheses.py +3 -2
  12. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/__init__.py +2 -0
  13. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_classes.py +43 -1
  14. {varcode-10.2.0 → varcode-10.3.0}/varcode/errors.py +18 -0
  15. {varcode-10.2.0 → varcode-10.3.0}/varcode/germline.py +252 -153
  16. {varcode-10.2.0 → varcode-10.3.0}/varcode/phasing.py +37 -10
  17. {varcode-10.2.0 → varcode-10.3.0}/varcode/transcript_model.py +73 -35
  18. varcode-10.3.0/varcode/version.py +1 -0
  19. varcode-10.3.0/varcode.egg-info/PKG-INFO +150 -0
  20. {varcode-10.2.0 → varcode-10.3.0}/varcode.egg-info/SOURCES.txt +4 -0
  21. varcode-10.2.0/PKG-INFO +0 -114
  22. varcode-10.2.0/README.md +0 -85
  23. varcode-10.2.0/varcode/version.py +0 -1
  24. varcode-10.2.0/varcode.egg-info/PKG-INFO +0 -114
  25. {varcode-10.2.0 → varcode-10.3.0}/LICENSE +0 -0
  26. {varcode-10.2.0 → varcode-10.3.0}/MANIFEST.in +0 -0
  27. {varcode-10.2.0 → varcode-10.3.0}/pyproject.toml +0 -0
  28. {varcode-10.2.0 → varcode-10.3.0}/requirements.txt +0 -0
  29. {varcode-10.2.0 → varcode-10.3.0}/setup.cfg +0 -0
  30. {varcode-10.2.0 → varcode-10.3.0}/tests/test_annotator_divergence_scenarios.py +0 -0
  31. {varcode-10.2.0 → varcode-10.3.0}/tests/test_annotator_haplotypes.py +0 -0
  32. {varcode-10.2.0 → varcode-10.3.0}/tests/test_annotator_parity_adversarial.py +0 -0
  33. {varcode-10.2.0 → varcode-10.3.0}/tests/test_annotators.py +0 -0
  34. {varcode-10.2.0 → varcode-10.3.0}/tests/test_bnd_retained_segments.py +0 -0
  35. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cli_effects.py +0 -0
  36. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cli_genes.py +0 -0
  37. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cli_records.py +0 -0
  38. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cli_without_pkg_resources.py +0 -0
  39. {varcode-10.2.0 → varcode-10.3.0}/tests/test_collection_filtering.py +0 -0
  40. {varcode-10.2.0 → varcode-10.3.0}/tests/test_collection_variants_attr_consistency.py +0 -0
  41. {varcode-10.2.0 → varcode-10.3.0}/tests/test_common.py +0 -0
  42. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cosmic_mutations.py +0 -0
  43. {varcode-10.2.0 → varcode-10.3.0}/tests/test_cryptic_exons.py +0 -0
  44. {varcode-10.2.0 → varcode-10.3.0}/tests/test_csv_roundtrip.py +0 -0
  45. {varcode-10.2.0 → varcode-10.3.0}/tests/test_dbnsfp_validation.py +0 -0
  46. {varcode-10.2.0 → varcode-10.3.0}/tests/test_default_structural_helpers.py +0 -0
  47. {varcode-10.2.0 → varcode-10.3.0}/tests/test_documentation_examples.py +0 -0
  48. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_annotation_errors.py +0 -0
  49. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_candidates.py +0 -0
  50. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_classes.py +0 -0
  51. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_collection.py +0 -0
  52. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_collection_serialization.py +0 -0
  53. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_collection_sort_order.py +0 -0
  54. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effect_hypotheses.py +0 -0
  55. {varcode-10.2.0 → varcode-10.3.0}/tests/test_effects_from_mutagenix_variants.py +0 -0
  56. {varcode-10.2.0 → varcode-10.3.0}/tests/test_exacto_fusions.py +0 -0
  57. {varcode-10.2.0 → varcode-10.3.0}/tests/test_exonic_splice_site.py +0 -0
  58. {varcode-10.2.0 → varcode-10.3.0}/tests/test_fast_path.py +0 -0
  59. {varcode-10.2.0 → varcode-10.3.0}/tests/test_frameshift_cterminus_regression.py +0 -0
  60. {varcode-10.2.0 → varcode-10.3.0}/tests/test_frameshift_helpers.py +0 -0
  61. {varcode-10.2.0 → varcode-10.3.0}/tests/test_fusion_insertions.py +0 -0
  62. {varcode-10.2.0 → varcode-10.3.0}/tests/test_fusion_partner_candidates.py +0 -0
  63. {varcode-10.2.0 → varcode-10.3.0}/tests/test_genome_contig_validation.py +0 -0
  64. {varcode-10.2.0 → varcode-10.3.0}/tests/test_genome_sequence.py +0 -0
  65. {varcode-10.2.0 → varcode-10.3.0}/tests/test_genomic_layout.py +0 -0
  66. {varcode-10.2.0 → varcode-10.3.0}/tests/test_genotype.py +0 -0
  67. {varcode-10.2.0 → varcode-10.3.0}/tests/test_genotype_from_vcf.py +0 -0
  68. {varcode-10.2.0 → varcode-10.3.0}/tests/test_germline_context.py +0 -0
  69. {varcode-10.2.0 → varcode-10.3.0}/tests/test_germline_overlap.py +0 -0
  70. {varcode-10.2.0 → varcode-10.3.0}/tests/test_haplotype_effect.py +0 -0
  71. {varcode-10.2.0 → varcode-10.3.0}/tests/test_local_sv_insertions.py +0 -0
  72. {varcode-10.2.0 → varcode-10.3.0}/tests/test_maf.py +0 -0
  73. {varcode-10.2.0 → varcode-10.3.0}/tests/test_mitochondrial.py +0 -0
  74. {varcode-10.2.0 → varcode-10.3.0}/tests/test_mm10_klf6_frameshift.py +0 -0
  75. {varcode-10.2.0 → varcode-10.3.0}/tests/test_mouse.py +0 -0
  76. {varcode-10.2.0 → varcode-10.3.0}/tests/test_mutant_transcript.py +0 -0
  77. {varcode-10.2.0 → varcode-10.3.0}/tests/test_mutate.py +0 -0
  78. {varcode-10.2.0 → varcode-10.3.0}/tests/test_no_duplicate_variants.py +0 -0
  79. {varcode-10.2.0 → varcode-10.3.0}/tests/test_nonlocal_layout.py +0 -0
  80. {varcode-10.2.0 → varcode-10.3.0}/tests/test_nonlocal_sv_transcripts.py +0 -0
  81. {varcode-10.2.0 → varcode-10.3.0}/tests/test_osteosarc_dataset.py +0 -0
  82. {varcode-10.2.0 → varcode-10.3.0}/tests/test_osteosarc_fusions.py +0 -0
  83. {varcode-10.2.0 → varcode-10.3.0}/tests/test_osteosarc_variants.py +0 -0
  84. {varcode-10.2.0 → varcode-10.3.0}/tests/test_partial_annotators.py +0 -0
  85. {varcode-10.2.0 → varcode-10.3.0}/tests/test_premature_stop_short_description.py +0 -0
  86. {varcode-10.2.0 → varcode-10.3.0}/tests/test_problematic_variants.py +0 -0
  87. {varcode-10.2.0 → varcode-10.3.0}/tests/test_protein_diff_parity.py +0 -0
  88. {varcode-10.2.0 → varcode-10.3.0}/tests/test_real_world_callers.py +0 -0
  89. {varcode-10.2.0 → varcode-10.3.0}/tests/test_reference.py +0 -0
  90. {varcode-10.2.0 → varcode-10.3.0}/tests/test_reference_mismatch_error.py +0 -0
  91. {varcode-10.2.0 → varcode-10.3.0}/tests/test_reference_segments.py +0 -0
  92. {varcode-10.2.0 → varcode-10.3.0}/tests/test_rna_evidence.py +0 -0
  93. {varcode-10.2.0 → varcode-10.3.0}/tests/test_rna_haplotype_sequences.py +0 -0
  94. {varcode-10.2.0 → varcode-10.3.0}/tests/test_rna_read_phasing_source.py +0 -0
  95. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sample_identity.py +0 -0
  96. {varcode-10.2.0 → varcode-10.3.0}/tests/test_selenocysteine.py +0 -0
  97. {varcode-10.2.0 → varcode-10.3.0}/tests/test_selenocysteine_proteins.py +0 -0
  98. {varcode-10.2.0 → varcode-10.3.0}/tests/test_silent_aa_pos.py +0 -0
  99. {varcode-10.2.0 → varcode-10.3.0}/tests/test_silent_hgvs_description.py +0 -0
  100. {varcode-10.2.0 → varcode-10.3.0}/tests/test_splice_graph.py +0 -0
  101. {varcode-10.2.0 → varcode-10.3.0}/tests/test_splice_outcomes.py +0 -0
  102. {varcode-10.2.0 → varcode-10.3.0}/tests/test_splice_site_effects.py +0 -0
  103. {varcode-10.2.0 → varcode-10.3.0}/tests/test_stop_codon_classification_bugs.py +0 -0
  104. {varcode-10.2.0 → varcode-10.3.0}/tests/test_string_helpers.py +0 -0
  105. {varcode-10.2.0 → varcode-10.3.0}/tests/test_structural_serialization.py +0 -0
  106. {varcode-10.2.0 → varcode-10.3.0}/tests/test_structural_variant_annotator.py +0 -0
  107. {varcode-10.2.0 → varcode-10.3.0}/tests/test_structural_variants.py +0 -0
  108. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sv_comparison.py +0 -0
  109. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sv_consequences.py +0 -0
  110. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sv_selenocysteine.py +0 -0
  111. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sv_sequence_changes.py +0 -0
  112. {varcode-10.2.0 → varcode-10.3.0}/tests/test_sv_tabular_metadata.py +0 -0
  113. {varcode-10.2.0 → varcode-10.3.0}/tests/test_symbolic_alleles.py +0 -0
  114. {varcode-10.2.0 → varcode-10.3.0}/tests/test_symbolic_sv_padding.py +0 -0
  115. {varcode-10.2.0 → varcode-10.3.0}/tests/test_test_script.py +0 -0
  116. {varcode-10.2.0 → varcode-10.3.0}/tests/test_timings.py +0 -0
  117. {varcode-10.2.0 → varcode-10.3.0}/tests/test_transcript_layout.py +0 -0
  118. {varcode-10.2.0 → varcode-10.3.0}/tests/test_transcript_model_start_codons.py +0 -0
  119. {varcode-10.2.0 → varcode-10.3.0}/tests/test_transforms_left_align.py +0 -0
  120. {varcode-10.2.0 → varcode-10.3.0}/tests/test_transforms_pair_breakends.py +0 -0
  121. {varcode-10.2.0 → varcode-10.3.0}/tests/test_variant.py +0 -0
  122. {varcode-10.2.0 → varcode-10.3.0}/tests/test_variant_collection.py +0 -0
  123. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf.py +0 -0
  124. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_export_integrity.py +0 -0
  125. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_limits.py +0 -0
  126. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_output.py +0 -0
  127. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_parsing.py +0 -0
  128. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_phase_resolver.py +0 -0
  129. {varcode-10.2.0 → varcode-10.3.0}/tests/test_vcf_spec_examples.py +0 -0
  130. {varcode-10.2.0 → varcode-10.3.0}/varcode/_sample_vcf.py +0 -0
  131. {varcode-10.2.0 → varcode-10.3.0}/varcode/annotators/__init__.py +0 -0
  132. {varcode-10.2.0 → varcode-10.3.0}/varcode/annotators/fast.py +0 -0
  133. {varcode-10.2.0 → varcode-10.3.0}/varcode/annotators/protein_diff.py +0 -0
  134. {varcode-10.2.0 → varcode-10.3.0}/varcode/annotators/registry.py +0 -0
  135. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/__init__.py +0 -0
  136. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/effects_script.py +0 -0
  137. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/genes_script.py +0 -0
  138. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/logging.conf +0 -0
  139. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/main.py +0 -0
  140. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/sample_checks.py +0 -0
  141. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/variant_args.py +0 -0
  142. {varcode-10.2.0 → varcode-10.3.0}/varcode/cli/version_info.py +0 -0
  143. {varcode-10.2.0 → varcode-10.3.0}/varcode/common.py +0 -0
  144. {varcode-10.2.0 → varcode-10.3.0}/varcode/cryptic_exons.py +0 -0
  145. {varcode-10.2.0 → varcode-10.3.0}/varcode/csv_helpers.py +0 -0
  146. {varcode-10.2.0 → varcode-10.3.0}/varcode/effect_candidates.py +0 -0
  147. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/classify.py +0 -0
  148. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/codon_tables.py +0 -0
  149. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/common.py +0 -0
  150. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_collection.py +0 -0
  151. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_helpers.py +0 -0
  152. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_ordering.py +0 -0
  153. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_prediction.py +0 -0
  154. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_prediction_coding.py +0 -0
  155. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_prediction_coding_frameshift.py +0 -0
  156. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/effect_prediction_coding_in_frame.py +0 -0
  157. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/fast_path.py +0 -0
  158. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/mutate.py +0 -0
  159. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/selenocysteine.py +0 -0
  160. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/sequence_change.py +0 -0
  161. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/structural.py +0 -0
  162. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/structural_serialization.py +0 -0
  163. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/transcript_helpers.py +0 -0
  164. {varcode-10.2.0 → varcode-10.3.0}/varcode/effects/translate.py +0 -0
  165. {varcode-10.2.0 → varcode-10.3.0}/varcode/exacto.py +0 -0
  166. {varcode-10.2.0 → varcode-10.3.0}/varcode/genome.py +0 -0
  167. {varcode-10.2.0 → varcode-10.3.0}/varcode/genome_sequence.py +0 -0
  168. {varcode-10.2.0 → varcode-10.3.0}/varcode/genomic_layout.py +0 -0
  169. {varcode-10.2.0 → varcode-10.3.0}/varcode/genotype.py +0 -0
  170. {varcode-10.2.0 → varcode-10.3.0}/varcode/maf.py +0 -0
  171. {varcode-10.2.0 → varcode-10.3.0}/varcode/mutant_transcript.py +0 -0
  172. {varcode-10.2.0 → varcode-10.3.0}/varcode/nucleotides.py +0 -0
  173. {varcode-10.2.0 → varcode-10.3.0}/varcode/realized_effects.py +0 -0
  174. {varcode-10.2.0 → varcode-10.3.0}/varcode/reference.py +0 -0
  175. {varcode-10.2.0 → varcode-10.3.0}/varcode/rna_evidence.py +0 -0
  176. {varcode-10.2.0 → varcode-10.3.0}/varcode/rna_read_phasing.py +0 -0
  177. {varcode-10.2.0 → varcode-10.3.0}/varcode/sample_identity.py +0 -0
  178. {varcode-10.2.0 → varcode-10.3.0}/varcode/splice_graph.py +0 -0
  179. {varcode-10.2.0 → varcode-10.3.0}/varcode/splice_outcomes.py +0 -0
  180. {varcode-10.2.0 → varcode-10.3.0}/varcode/string_helpers.py +0 -0
  181. {varcode-10.2.0 → varcode-10.3.0}/varcode/structural_variant.py +0 -0
  182. {varcode-10.2.0 → varcode-10.3.0}/varcode/sv_allele_parser.py +0 -0
  183. {varcode-10.2.0 → varcode-10.3.0}/varcode/sv_comparison.py +0 -0
  184. {varcode-10.2.0 → varcode-10.3.0}/varcode/transcript_layout.py +0 -0
  185. {varcode-10.2.0 → varcode-10.3.0}/varcode/transforms/__init__.py +0 -0
  186. {varcode-10.2.0 → varcode-10.3.0}/varcode/ucsc_reference_names.py +0 -0
  187. {varcode-10.2.0 → varcode-10.3.0}/varcode/util.py +0 -0
  188. {varcode-10.2.0 → varcode-10.3.0}/varcode/variant.py +0 -0
  189. {varcode-10.2.0 → varcode-10.3.0}/varcode/variant_collection.py +0 -0
  190. {varcode-10.2.0 → varcode-10.3.0}/varcode/vcf.py +0 -0
  191. {varcode-10.2.0 → varcode-10.3.0}/varcode/vcf_output.py +0 -0
  192. {varcode-10.2.0 → varcode-10.3.0}/varcode/vcf_parsing.py +0 -0
  193. {varcode-10.2.0 → varcode-10.3.0}/varcode.egg-info/dependency_links.txt +0 -0
  194. {varcode-10.2.0 → varcode-10.3.0}/varcode.egg-info/entry_points.txt +0 -0
  195. {varcode-10.2.0 → varcode-10.3.0}/varcode.egg-info/requires.txt +0 -0
  196. {varcode-10.2.0 → varcode-10.3.0}/varcode.egg-info/top_level.txt +0 -0
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: varcode
3
+ Version: 10.3.0
4
+ Summary: Variant annotation in Python
5
+ Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
+ Project-URL: Homepage, https://github.com/openvax/varcode
7
+ Project-URL: Bug Tracker, https://github.com/openvax/varcode/issues
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy<3.0.0,>=2.0.0
19
+ Requires-Dist: pandas<3.0.0,>=2.0.0
20
+ Requires-Dist: pyensembl>=2.6.4
21
+ Requires-Dist: memoized_property>=1.0.2
22
+ Requires-Dist: serializable>=1.1.0
23
+ Requires-Dist: sercol>=0.1.4
24
+ Provides-Extra: rna
25
+ Requires-Dist: pysam>=0.21; extra == "rna"
26
+ Provides-Extra: test-data
27
+ Requires-Dist: osteosarc==0.2.3; extra == "test-data"
28
+ Dynamic: license-file
29
+
30
+ [![Tests](https://github.com/openvax/varcode/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/varcode/actions/workflows/tests.yml)
31
+ [![Coverage Status](https://coveralls.io/repos/openvax/varcode/badge.svg?branch=main&service=github)](https://coveralls.io/github/openvax/varcode?branch=main)
32
+ [![PyPI](https://img.shields.io/pypi/v/varcode.svg?maxAge=1000)](https://pypi.org/project/varcode/)
33
+ [![PyPI downloads](https://img.shields.io/pypi/dm/varcode.svg)](https://pypistats.org/packages/varcode)
34
+
35
+ # Varcode
36
+
37
+ Varcode is a Python library that predicts what genomic variants do to genes,
38
+ transcripts, and proteins. Load a VCF or MAF file, and for each variant on each
39
+ overlapping transcript, Varcode reports the predicted consequence (for example
40
+ a substitution such as `p.L159M`, a frameshift, or a gene fusion). Where the
41
+ sequence can be determined, it also gives the mutant protein.
42
+
43
+ ## What it does
44
+
45
+ - **Small variants:** SNVs, indels, and multi-base substitutions are classified
46
+ as coding changes (substitution, frameshift, premature stop, and others) or
47
+ by where they fall (UTR, intron, splice site, intergenic).
48
+ - **Splice variants:** returns the possible outcomes, such as exon skipping,
49
+ intron retention, or a cryptic splice site, each with its own predicted
50
+ protein when it can be determined.
51
+ - **Structural variants:** deletions, duplications, inversions, and breakends
52
+ get transcript consequences and gene-fusion candidates.
53
+ - **Patient context (optional):** germline variants, phase from a phased VCF
54
+ or RNA reads, and observed RNA structures refine predictions.
55
+ - **Sample checks:** screens a cohort for possible sample mix-ups using donor
56
+ genotypes and shared somatic mutations.
57
+
58
+ ## Installation
59
+
60
+ Requires Python 3.9 or later:
61
+
62
+ ```bash
63
+ pip install varcode
64
+ pyensembl install --release 81 --species human
65
+ ```
66
+
67
+ The second command downloads the gene annotation and transcript sequences used
68
+ in the example below (Ensembl 81, GRCh38). For your own data, choose an
69
+ annotation that matches your input's genome build; see
70
+ [reference setup](https://openvax.github.io/varcode/getting_started/#reference-data).
71
+
72
+ <a id="example"></a>
73
+
74
+ ## Quick start
75
+
76
+ Predict the effect of a single GRCh38 variant on a CFTR transcript:
77
+
78
+ ```python
79
+ from varcode import Variant
80
+
81
+ variant = Variant("7", 117_531_100, "T", "A", genome=81)
82
+ transcript = variant.genome.transcript_by_id("ENST00000003084")
83
+ effect = variant.effect_on_transcript(transcript)
84
+
85
+ print(effect.short_description) # p.L159M
86
+ protein = effect.mutant_protein_sequence
87
+ ```
88
+
89
+ Annotate every variant in a VCF called against the same genome build, and
90
+ print the most severe effect for each:
91
+
92
+ ```python
93
+ from varcode import load_vcf
94
+
95
+ variants = load_vcf("variants.vcf", genome=81)
96
+ effects = variants.effects()
97
+ for variant, effect in effects.top_priority_effect_per_variant().items():
98
+ print(variant.short_description, effect.short_description)
99
+ ```
100
+
101
+ Or from the command line:
102
+
103
+ ```bash
104
+ varcode --genome GRCh38 --vcf variants.vcf --output-csv effects.csv
105
+ ```
106
+
107
+ <a id="reading-results"></a>
108
+
109
+ ## Reading the results
110
+
111
+ - **One variant, many transcripts.** Each prediction belongs to one
112
+ transcript, and a variant's effect can differ between transcripts.
113
+ `top_priority_effect_per_variant()` picks one per variant for a summary.
114
+ - **"Top priority" means most severe, not most likely.** The ranking is
115
+ Varcode's ordering of consequence severity. It is not a probability, a
116
+ pathogenicity score, or a clinical classification.
117
+ - **Some effects have several possible outcomes.** Splice variants,
118
+ structural variants, and variants with unknown phase keep all their
119
+ candidate outcomes rather than guessing one.
120
+ - **`None` means unknown, not unchanged.** A missing protein sequence means
121
+ Varcode could not determine it.
122
+ - **Predictions are not observations.** A predicted protein doesn't show that
123
+ the transcript or protein is expressed.
124
+
125
+ <a id="further-reading"></a>
126
+
127
+ ## Learn more
128
+
129
+ The [documentation](https://openvax.github.io/varcode/) starts with a
130
+ [getting-started guide](https://openvax.github.io/varcode/getting_started/)
131
+ and then covers sample filtering, splice and structural variants, germline
132
+ and phasing, RNA evidence, and saving results.
133
+
134
+ <a id="effect-types"></a>
135
+ <a id="coordinate-system"></a>
136
+
137
+ Reference pages cover [effect types](https://openvax.github.io/varcode/effect_types/),
138
+ [coordinate conventions](https://openvax.github.io/varcode/getting_started/#coordinate-conventions),
139
+ and the [API](https://openvax.github.io/varcode/api/).
140
+
141
+ Varcode is part of the [OpenVax](https://github.com/openvax) tools.
142
+ [Isovar](https://github.com/openvax/isovar) reconstructs variant sequences from
143
+ RNA reads, and [Vaxrank](https://github.com/openvax/vaxrank) evaluates the resulting
144
+ protein/peptide candidates; see
145
+ [how the libraries fit together](https://openvax.github.io/varcode/library_roles/).
146
+
147
+ For bugs or questions, [open an issue](https://github.com/openvax/varcode/issues).
148
+ Contributions are welcome; see
149
+ [CONTRIBUTING.md](https://github.com/openvax/varcode/blob/main/CONTRIBUTING.md)
150
+ and the [changelog](https://github.com/openvax/varcode/blob/main/CHANGELOG.md).
@@ -0,0 +1,121 @@
1
+ [![Tests](https://github.com/openvax/varcode/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/varcode/actions/workflows/tests.yml)
2
+ [![Coverage Status](https://coveralls.io/repos/openvax/varcode/badge.svg?branch=main&service=github)](https://coveralls.io/github/openvax/varcode?branch=main)
3
+ [![PyPI](https://img.shields.io/pypi/v/varcode.svg?maxAge=1000)](https://pypi.org/project/varcode/)
4
+ [![PyPI downloads](https://img.shields.io/pypi/dm/varcode.svg)](https://pypistats.org/packages/varcode)
5
+
6
+ # Varcode
7
+
8
+ Varcode is a Python library that predicts what genomic variants do to genes,
9
+ transcripts, and proteins. Load a VCF or MAF file, and for each variant on each
10
+ overlapping transcript, Varcode reports the predicted consequence (for example
11
+ a substitution such as `p.L159M`, a frameshift, or a gene fusion). Where the
12
+ sequence can be determined, it also gives the mutant protein.
13
+
14
+ ## What it does
15
+
16
+ - **Small variants:** SNVs, indels, and multi-base substitutions are classified
17
+ as coding changes (substitution, frameshift, premature stop, and others) or
18
+ by where they fall (UTR, intron, splice site, intergenic).
19
+ - **Splice variants:** returns the possible outcomes, such as exon skipping,
20
+ intron retention, or a cryptic splice site, each with its own predicted
21
+ protein when it can be determined.
22
+ - **Structural variants:** deletions, duplications, inversions, and breakends
23
+ get transcript consequences and gene-fusion candidates.
24
+ - **Patient context (optional):** germline variants, phase from a phased VCF
25
+ or RNA reads, and observed RNA structures refine predictions.
26
+ - **Sample checks:** screens a cohort for possible sample mix-ups using donor
27
+ genotypes and shared somatic mutations.
28
+
29
+ ## Installation
30
+
31
+ Requires Python 3.9 or later:
32
+
33
+ ```bash
34
+ pip install varcode
35
+ pyensembl install --release 81 --species human
36
+ ```
37
+
38
+ The second command downloads the gene annotation and transcript sequences used
39
+ in the example below (Ensembl 81, GRCh38). For your own data, choose an
40
+ annotation that matches your input's genome build; see
41
+ [reference setup](https://openvax.github.io/varcode/getting_started/#reference-data).
42
+
43
+ <a id="example"></a>
44
+
45
+ ## Quick start
46
+
47
+ Predict the effect of a single GRCh38 variant on a CFTR transcript:
48
+
49
+ ```python
50
+ from varcode import Variant
51
+
52
+ variant = Variant("7", 117_531_100, "T", "A", genome=81)
53
+ transcript = variant.genome.transcript_by_id("ENST00000003084")
54
+ effect = variant.effect_on_transcript(transcript)
55
+
56
+ print(effect.short_description) # p.L159M
57
+ protein = effect.mutant_protein_sequence
58
+ ```
59
+
60
+ Annotate every variant in a VCF called against the same genome build, and
61
+ print the most severe effect for each:
62
+
63
+ ```python
64
+ from varcode import load_vcf
65
+
66
+ variants = load_vcf("variants.vcf", genome=81)
67
+ effects = variants.effects()
68
+ for variant, effect in effects.top_priority_effect_per_variant().items():
69
+ print(variant.short_description, effect.short_description)
70
+ ```
71
+
72
+ Or from the command line:
73
+
74
+ ```bash
75
+ varcode --genome GRCh38 --vcf variants.vcf --output-csv effects.csv
76
+ ```
77
+
78
+ <a id="reading-results"></a>
79
+
80
+ ## Reading the results
81
+
82
+ - **One variant, many transcripts.** Each prediction belongs to one
83
+ transcript, and a variant's effect can differ between transcripts.
84
+ `top_priority_effect_per_variant()` picks one per variant for a summary.
85
+ - **"Top priority" means most severe, not most likely.** The ranking is
86
+ Varcode's ordering of consequence severity. It is not a probability, a
87
+ pathogenicity score, or a clinical classification.
88
+ - **Some effects have several possible outcomes.** Splice variants,
89
+ structural variants, and variants with unknown phase keep all their
90
+ candidate outcomes rather than guessing one.
91
+ - **`None` means unknown, not unchanged.** A missing protein sequence means
92
+ Varcode could not determine it.
93
+ - **Predictions are not observations.** A predicted protein doesn't show that
94
+ the transcript or protein is expressed.
95
+
96
+ <a id="further-reading"></a>
97
+
98
+ ## Learn more
99
+
100
+ The [documentation](https://openvax.github.io/varcode/) starts with a
101
+ [getting-started guide](https://openvax.github.io/varcode/getting_started/)
102
+ and then covers sample filtering, splice and structural variants, germline
103
+ and phasing, RNA evidence, and saving results.
104
+
105
+ <a id="effect-types"></a>
106
+ <a id="coordinate-system"></a>
107
+
108
+ Reference pages cover [effect types](https://openvax.github.io/varcode/effect_types/),
109
+ [coordinate conventions](https://openvax.github.io/varcode/getting_started/#coordinate-conventions),
110
+ and the [API](https://openvax.github.io/varcode/api/).
111
+
112
+ Varcode is part of the [OpenVax](https://github.com/openvax) tools.
113
+ [Isovar](https://github.com/openvax/isovar) reconstructs variant sequences from
114
+ RNA reads, and [Vaxrank](https://github.com/openvax/vaxrank) evaluates the resulting
115
+ protein/peptide candidates; see
116
+ [how the libraries fit together](https://openvax.github.io/varcode/library_roles/).
117
+
118
+ For bugs or questions, [open an issue](https://github.com/openvax/varcode/issues).
119
+ Contributions are welcome; see
120
+ [CONTRIBUTING.md](https://github.com/openvax/varcode/blob/main/CONTRIBUTING.md)
121
+ and the [changelog](https://github.com/openvax/varcode/blob/main/CHANGELOG.md).
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ from __future__ import print_function, division, absolute_import
@@ -0,0 +1,73 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """
14
+ Time how long it takes to open a VCF.
15
+
16
+ Run as:
17
+ python -m profile -s cumtime %(prog)s
18
+
19
+ to get profiling output.
20
+
21
+ """
22
+ import argparse
23
+ import time
24
+
25
+ import varcode
26
+
27
+ parser = argparse.ArgumentParser(description=__doc__)
28
+
29
+ parser.add_argument(
30
+ "path", help="Path or URL to VCF")
31
+
32
+ parser.add_argument(
33
+ "--profile", action="store_true",
34
+ default=False,
35
+ help="Run in a profiler.")
36
+
37
+ parser.add_argument(
38
+ "--no-info-field",
39
+ dest="info_field",
40
+ action="store_false",
41
+ default=True)
42
+
43
+ parser.add_argument(
44
+ "--pyvcf",
45
+ help="use pyvcf implementation",
46
+ action="store_true",
47
+ default=False)
48
+
49
+ def run():
50
+ args = parser.parse_args()
51
+
52
+ extra_args = {}
53
+ if not args.info_field:
54
+ extra_args["include_info"] = False
55
+
56
+ start = time.time()
57
+
58
+ if args.pyvcf:
59
+ result = varcode.load_vcf(
60
+ args.path,
61
+ allow_extended_nucleotides=True)
62
+ else:
63
+ result = varcode.load_vcf_fast(
64
+ args.path,
65
+ allow_extended_nucleotides=True,
66
+ **extra_args)
67
+
68
+ print("Loaded %d variants in %0.3f sec. " % (
69
+ len(result), time.time() - start))
70
+ print(result.to_string(limit=5))
71
+
72
+ if __name__ == '__main__':
73
+ run()
@@ -0,0 +1,91 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+
14
+ expected_effect_properties = [
15
+ 'gene',
16
+ 'gene_name',
17
+ 'gene_id',
18
+ 'transcript',
19
+ 'transcript_name',
20
+ 'transcript_id',
21
+ 'modifies_coding_sequence',
22
+ 'modifies_protein_sequence',
23
+ 'aa_mutation_start_offset',
24
+ 'aa_mutation_end_offset',
25
+ 'mutant_protein_sequence',
26
+ 'short_description'
27
+ ]
28
+
29
+ def check_effect_properties(effect):
30
+ assert effect is not None
31
+ # try accessing all the properties to make sure none crash
32
+ for attribute_name in expected_effect_properties:
33
+ getattr(effect, attribute_name)
34
+ assert len(str(effect)) > 0
35
+ assert len(repr(effect)) > 0
36
+ assert effect.short_description is not None, \
37
+ "Expected effect %s to have a `short_description` property" % (effect,)
38
+ assert len(effect.short_description) > 0
39
+ assert effect.__class__.__name__ in str(effect), \
40
+ "Expected string representation of %s to include effect name %s" % (
41
+ effect, effect.__class__.__name__)
42
+
43
+ def expect_effect(
44
+ variant,
45
+ transcript_id=None,
46
+ effect_class=None,
47
+ protein_sequence=None,
48
+ **kwargs):
49
+ if transcript_id is None:
50
+ effects = variant.effects()
51
+ effect = effects.top_priority_effect()
52
+ else:
53
+ transcript = variant.ensembl.transcript_by_id(transcript_id)
54
+ effect = variant.effect_on_transcript(transcript)
55
+ check_effect_properties(effect)
56
+ if effect_class is not None:
57
+ # Splice-disrupting effects are always wrapped in a
58
+ # SpliceOutcomeSet (varcode 6.0+); when the caller asks for a
59
+ # splice-signal class (ExonicSpliceSite, SpliceDonor, ...),
60
+ # match against the wrapper's `disrupted_signal_class`.
61
+ from varcode import SpliceOutcomeSet
62
+ actual_class = effect.__class__
63
+ matches = (
64
+ actual_class is effect_class
65
+ or (actual_class is SpliceOutcomeSet
66
+ and getattr(effect, "disrupted_signal_class", None)
67
+ is effect_class))
68
+ assert matches, \
69
+ "Expected effect class %s but got %s" % (
70
+ effect_class.__name__,
71
+ actual_class.__name__)
72
+ if protein_sequence is not None:
73
+ assert effect.mutant_protein_sequence == protein_sequence, \
74
+ "Expected protein sequence %s but got %s" % (
75
+ protein_sequence,
76
+ effect.mutant_protein_sequence)
77
+ for field, expected_value in kwargs.items():
78
+ actual_value = getattr(effect, field)
79
+ if isinstance(expected_value, int):
80
+ format_string = "Expected %s=%d but got %s"
81
+ elif isinstance(expected_value, float):
82
+ format_string = "Expected %s=%f but got %s"
83
+ else:
84
+ format_string = "Expected %s='%s' but got '%s'"
85
+ assert actual_value == expected_value, format_string % (field, expected_value, actual_value)
86
+
87
+ def eq_(x, y, s=None):
88
+ if s is None:
89
+ assert x == y, "%s != %s" % (x, y)
90
+ else:
91
+ assert x == y, s
@@ -0,0 +1,67 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """
14
+ Helper functions and shared datasets for tests
15
+ """
16
+
17
+ import os
18
+ from pyensembl import cached_release
19
+ from varcode import Variant, VariantCollection, load_maf
20
+ import pandas as pd
21
+
22
+ # Pin shared fixtures to the suite's standard GRCh38 release (81) rather than
23
+ # letting Variant default to "GRCh38", which resolves to pyensembl's LATEST
24
+ # release (e.g. 115). That default is not installed in CI (the
25
+ # openvax/ensembl-data mirror tops out at GRCh38.95), so any test that
26
+ # annotates these snps -- including test_collection_filtering, which calls
27
+ # .effects() at import -- would flake on "GTF database needs to be created".
28
+ # Release 81 is what the downstream transcript-id assertions were written
29
+ # against.
30
+ ENSEMBL_GRCH38 = cached_release(81)
31
+
32
+
33
+ def data_path(name):
34
+ """
35
+ Return the absolute path to a file in the varcode/test/data directory.
36
+ The name specified should be relative to varcode/test/data.
37
+ """
38
+ return os.path.join(os.path.dirname(__file__), "data", name)
39
+
40
+ dbnsp_validation_df = pd.read_csv(data_path('dbnsfp_validation_set.csv'))
41
+ tcga_ov_variants = load_maf(data_path("tcga_ov.head.maf"))
42
+ ov_wustle_variants = load_maf(data_path("ov.wustle.subset5.maf"))
43
+
44
+ snp_rs4244285 = Variant(
45
+ contig=10,
46
+ start=94781859,
47
+ ref="G",
48
+ alt="A",
49
+ ensembl=ENSEMBL_GRCH38)
50
+ snp_rs1537415 = Variant(
51
+ contig=9,
52
+ start=135637876,
53
+ ref="C",
54
+ alt="G",
55
+ ensembl=ENSEMBL_GRCH38)
56
+ snp_rs3892097 = Variant(
57
+ contig=22,
58
+ start=42524947,
59
+ ref="G",
60
+ alt="A",
61
+ ensembl=ENSEMBL_GRCH38)
62
+
63
+ db_snp_variants = VariantCollection([
64
+ snp_rs4244285,
65
+ snp_rs1537415,
66
+ snp_rs3892097,
67
+ ])