varcode 9.3.5__tar.gz → 9.3.7__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 (169) hide show
  1. {varcode-9.3.5/varcode.egg-info → varcode-9.3.7}/PKG-INFO +1 -1
  2. {varcode-9.3.5 → varcode-9.3.7}/tests/test_annotator_divergence_scenarios.py +32 -8
  3. {varcode-9.3.5 → varcode-9.3.7}/tests/test_osteosarc_dataset.py +6 -1
  4. varcode-9.3.7/tests/test_osteosarc_variants.py +78 -0
  5. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_prediction.py +5 -2
  6. {varcode-9.3.5 → varcode-9.3.7}/varcode/transcript_layout.py +5 -1
  7. varcode-9.3.7/varcode/version.py +1 -0
  8. {varcode-9.3.5 → varcode-9.3.7/varcode.egg-info}/PKG-INFO +1 -1
  9. {varcode-9.3.5 → varcode-9.3.7}/varcode.egg-info/SOURCES.txt +1 -0
  10. varcode-9.3.5/varcode/version.py +0 -1
  11. {varcode-9.3.5 → varcode-9.3.7}/LICENSE +0 -0
  12. {varcode-9.3.5 → varcode-9.3.7}/MANIFEST.in +0 -0
  13. {varcode-9.3.5 → varcode-9.3.7}/README.md +0 -0
  14. {varcode-9.3.5 → varcode-9.3.7}/pyproject.toml +0 -0
  15. {varcode-9.3.5 → varcode-9.3.7}/requirements.txt +0 -0
  16. {varcode-9.3.5 → varcode-9.3.7}/setup.cfg +0 -0
  17. {varcode-9.3.5 → varcode-9.3.7}/tests/test_annotator_parity_adversarial.py +0 -0
  18. {varcode-9.3.5 → varcode-9.3.7}/tests/test_annotators.py +0 -0
  19. {varcode-9.3.5 → varcode-9.3.7}/tests/test_bnd_retained_segments.py +0 -0
  20. {varcode-9.3.5 → varcode-9.3.7}/tests/test_cli_effects.py +0 -0
  21. {varcode-9.3.5 → varcode-9.3.7}/tests/test_cli_genes.py +0 -0
  22. {varcode-9.3.5 → varcode-9.3.7}/tests/test_cli_without_pkg_resources.py +0 -0
  23. {varcode-9.3.5 → varcode-9.3.7}/tests/test_collection_filtering.py +0 -0
  24. {varcode-9.3.5 → varcode-9.3.7}/tests/test_collection_variants_attr_consistency.py +0 -0
  25. {varcode-9.3.5 → varcode-9.3.7}/tests/test_common.py +0 -0
  26. {varcode-9.3.5 → varcode-9.3.7}/tests/test_cosmic_mutations.py +0 -0
  27. {varcode-9.3.5 → varcode-9.3.7}/tests/test_cryptic_exons.py +0 -0
  28. {varcode-9.3.5 → varcode-9.3.7}/tests/test_csv_roundtrip.py +0 -0
  29. {varcode-9.3.5 → varcode-9.3.7}/tests/test_dbnsfp_validation.py +0 -0
  30. {varcode-9.3.5 → varcode-9.3.7}/tests/test_default_structural_helpers.py +0 -0
  31. {varcode-9.3.5 → varcode-9.3.7}/tests/test_documentation_examples.py +0 -0
  32. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_annotation_errors.py +0 -0
  33. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_candidates.py +0 -0
  34. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_classes.py +0 -0
  35. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_collection.py +0 -0
  36. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_collection_serialization.py +0 -0
  37. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_collection_sort_order.py +0 -0
  38. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effect_hypotheses.py +0 -0
  39. {varcode-9.3.5 → varcode-9.3.7}/tests/test_effects_from_mutagenix_variants.py +0 -0
  40. {varcode-9.3.5 → varcode-9.3.7}/tests/test_exacto_fusions.py +0 -0
  41. {varcode-9.3.5 → varcode-9.3.7}/tests/test_exonic_splice_site.py +0 -0
  42. {varcode-9.3.5 → varcode-9.3.7}/tests/test_fast_path.py +0 -0
  43. {varcode-9.3.5 → varcode-9.3.7}/tests/test_frameshift_cterminus_regression.py +0 -0
  44. {varcode-9.3.5 → varcode-9.3.7}/tests/test_frameshift_helpers.py +0 -0
  45. {varcode-9.3.5 → varcode-9.3.7}/tests/test_fusion_partner_candidates.py +0 -0
  46. {varcode-9.3.5 → varcode-9.3.7}/tests/test_genome_contig_validation.py +0 -0
  47. {varcode-9.3.5 → varcode-9.3.7}/tests/test_genome_sequence.py +0 -0
  48. {varcode-9.3.5 → varcode-9.3.7}/tests/test_genomic_layout.py +0 -0
  49. {varcode-9.3.5 → varcode-9.3.7}/tests/test_genotype.py +0 -0
  50. {varcode-9.3.5 → varcode-9.3.7}/tests/test_genotype_from_vcf.py +0 -0
  51. {varcode-9.3.5 → varcode-9.3.7}/tests/test_germline_context.py +0 -0
  52. {varcode-9.3.5 → varcode-9.3.7}/tests/test_germline_effects.py +0 -0
  53. {varcode-9.3.5 → varcode-9.3.7}/tests/test_haplotype_effect.py +0 -0
  54. {varcode-9.3.5 → varcode-9.3.7}/tests/test_maf.py +0 -0
  55. {varcode-9.3.5 → varcode-9.3.7}/tests/test_mitochondrial.py +0 -0
  56. {varcode-9.3.5 → varcode-9.3.7}/tests/test_mm10_klf6_frameshift.py +0 -0
  57. {varcode-9.3.5 → varcode-9.3.7}/tests/test_mouse.py +0 -0
  58. {varcode-9.3.5 → varcode-9.3.7}/tests/test_mutant_transcript.py +0 -0
  59. {varcode-9.3.5 → varcode-9.3.7}/tests/test_mutate.py +0 -0
  60. {varcode-9.3.5 → varcode-9.3.7}/tests/test_no_duplicate_variants.py +0 -0
  61. {varcode-9.3.5 → varcode-9.3.7}/tests/test_nonlocal_sv_transcripts.py +0 -0
  62. {varcode-9.3.5 → varcode-9.3.7}/tests/test_osteosarc_fusions.py +0 -0
  63. {varcode-9.3.5 → varcode-9.3.7}/tests/test_partial_annotators.py +0 -0
  64. {varcode-9.3.5 → varcode-9.3.7}/tests/test_premature_stop_short_description.py +0 -0
  65. {varcode-9.3.5 → varcode-9.3.7}/tests/test_problematic_variants.py +0 -0
  66. {varcode-9.3.5 → varcode-9.3.7}/tests/test_protein_diff_parity.py +0 -0
  67. {varcode-9.3.5 → varcode-9.3.7}/tests/test_read_phase_resolver.py +0 -0
  68. {varcode-9.3.5 → varcode-9.3.7}/tests/test_real_world_callers.py +0 -0
  69. {varcode-9.3.5 → varcode-9.3.7}/tests/test_reference.py +0 -0
  70. {varcode-9.3.5 → varcode-9.3.7}/tests/test_reference_mismatch_error.py +0 -0
  71. {varcode-9.3.5 → varcode-9.3.7}/tests/test_reference_segments.py +0 -0
  72. {varcode-9.3.5 → varcode-9.3.7}/tests/test_rna_evidence.py +0 -0
  73. {varcode-9.3.5 → varcode-9.3.7}/tests/test_rna_haplotype_sequences.py +0 -0
  74. {varcode-9.3.5 → varcode-9.3.7}/tests/test_rna_read_phasing_source.py +0 -0
  75. {varcode-9.3.5 → varcode-9.3.7}/tests/test_selenocysteine.py +0 -0
  76. {varcode-9.3.5 → varcode-9.3.7}/tests/test_selenocysteine_proteins.py +0 -0
  77. {varcode-9.3.5 → varcode-9.3.7}/tests/test_silent_aa_pos.py +0 -0
  78. {varcode-9.3.5 → varcode-9.3.7}/tests/test_silent_hgvs_description.py +0 -0
  79. {varcode-9.3.5 → varcode-9.3.7}/tests/test_splice_graph.py +0 -0
  80. {varcode-9.3.5 → varcode-9.3.7}/tests/test_splice_outcomes.py +0 -0
  81. {varcode-9.3.5 → varcode-9.3.7}/tests/test_splice_site_effects.py +0 -0
  82. {varcode-9.3.5 → varcode-9.3.7}/tests/test_stop_codon_classification_bugs.py +0 -0
  83. {varcode-9.3.5 → varcode-9.3.7}/tests/test_string_helpers.py +0 -0
  84. {varcode-9.3.5 → varcode-9.3.7}/tests/test_structural_variant_annotator.py +0 -0
  85. {varcode-9.3.5 → varcode-9.3.7}/tests/test_structural_variants.py +0 -0
  86. {varcode-9.3.5 → varcode-9.3.7}/tests/test_sv_selenocysteine.py +0 -0
  87. {varcode-9.3.5 → varcode-9.3.7}/tests/test_sv_sequence_changes.py +0 -0
  88. {varcode-9.3.5 → varcode-9.3.7}/tests/test_sv_tabular_metadata.py +0 -0
  89. {varcode-9.3.5 → varcode-9.3.7}/tests/test_symbolic_alleles.py +0 -0
  90. {varcode-9.3.5 → varcode-9.3.7}/tests/test_symbolic_sv_padding.py +0 -0
  91. {varcode-9.3.5 → varcode-9.3.7}/tests/test_timings.py +0 -0
  92. {varcode-9.3.5 → varcode-9.3.7}/tests/test_transcript_layout.py +0 -0
  93. {varcode-9.3.5 → varcode-9.3.7}/tests/test_transcript_model.py +0 -0
  94. {varcode-9.3.5 → varcode-9.3.7}/tests/test_transforms_left_align.py +0 -0
  95. {varcode-9.3.5 → varcode-9.3.7}/tests/test_transforms_pair_breakends.py +0 -0
  96. {varcode-9.3.5 → varcode-9.3.7}/tests/test_variant.py +0 -0
  97. {varcode-9.3.5 → varcode-9.3.7}/tests/test_variant_collection.py +0 -0
  98. {varcode-9.3.5 → varcode-9.3.7}/tests/test_vcf.py +0 -0
  99. {varcode-9.3.5 → varcode-9.3.7}/tests/test_vcf_output.py +0 -0
  100. {varcode-9.3.5 → varcode-9.3.7}/tests/test_vcf_parsing.py +0 -0
  101. {varcode-9.3.5 → varcode-9.3.7}/tests/test_vcf_phase_resolver.py +0 -0
  102. {varcode-9.3.5 → varcode-9.3.7}/tests/test_vcf_spec_examples.py +0 -0
  103. {varcode-9.3.5 → varcode-9.3.7}/varcode/__init__.py +0 -0
  104. {varcode-9.3.5 → varcode-9.3.7}/varcode/annotators/__init__.py +0 -0
  105. {varcode-9.3.5 → varcode-9.3.7}/varcode/annotators/fast.py +0 -0
  106. {varcode-9.3.5 → varcode-9.3.7}/varcode/annotators/protein_diff.py +0 -0
  107. {varcode-9.3.5 → varcode-9.3.7}/varcode/annotators/registry.py +0 -0
  108. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/__init__.py +0 -0
  109. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/effects_script.py +0 -0
  110. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/genes_script.py +0 -0
  111. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/logging.conf +0 -0
  112. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/variant_args.py +0 -0
  113. {varcode-9.3.5 → varcode-9.3.7}/varcode/cli/version_info.py +0 -0
  114. {varcode-9.3.5 → varcode-9.3.7}/varcode/common.py +0 -0
  115. {varcode-9.3.5 → varcode-9.3.7}/varcode/cryptic_exons.py +0 -0
  116. {varcode-9.3.5 → varcode-9.3.7}/varcode/csv_helpers.py +0 -0
  117. {varcode-9.3.5 → varcode-9.3.7}/varcode/effect_candidates.py +0 -0
  118. {varcode-9.3.5 → varcode-9.3.7}/varcode/effect_hypotheses.py +0 -0
  119. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/__init__.py +0 -0
  120. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/classify.py +0 -0
  121. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/codon_tables.py +0 -0
  122. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/common.py +0 -0
  123. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_classes.py +0 -0
  124. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_collection.py +0 -0
  125. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_helpers.py +0 -0
  126. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_ordering.py +0 -0
  127. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_prediction_coding.py +0 -0
  128. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_prediction_coding_frameshift.py +0 -0
  129. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/effect_prediction_coding_in_frame.py +0 -0
  130. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/fast_path.py +0 -0
  131. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/mutate.py +0 -0
  132. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/selenocysteine.py +0 -0
  133. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/sequence_change.py +0 -0
  134. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/structural.py +0 -0
  135. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/transcript_helpers.py +0 -0
  136. {varcode-9.3.5 → varcode-9.3.7}/varcode/effects/translate.py +0 -0
  137. {varcode-9.3.5 → varcode-9.3.7}/varcode/errors.py +0 -0
  138. {varcode-9.3.5 → varcode-9.3.7}/varcode/exacto.py +0 -0
  139. {varcode-9.3.5 → varcode-9.3.7}/varcode/genome.py +0 -0
  140. {varcode-9.3.5 → varcode-9.3.7}/varcode/genome_sequence.py +0 -0
  141. {varcode-9.3.5 → varcode-9.3.7}/varcode/genomic_layout.py +0 -0
  142. {varcode-9.3.5 → varcode-9.3.7}/varcode/genotype.py +0 -0
  143. {varcode-9.3.5 → varcode-9.3.7}/varcode/germline.py +0 -0
  144. {varcode-9.3.5 → varcode-9.3.7}/varcode/maf.py +0 -0
  145. {varcode-9.3.5 → varcode-9.3.7}/varcode/mutant_transcript.py +0 -0
  146. {varcode-9.3.5 → varcode-9.3.7}/varcode/nucleotides.py +0 -0
  147. {varcode-9.3.5 → varcode-9.3.7}/varcode/phasing.py +0 -0
  148. {varcode-9.3.5 → varcode-9.3.7}/varcode/realized_effects.py +0 -0
  149. {varcode-9.3.5 → varcode-9.3.7}/varcode/reference.py +0 -0
  150. {varcode-9.3.5 → varcode-9.3.7}/varcode/rna_evidence.py +0 -0
  151. {varcode-9.3.5 → varcode-9.3.7}/varcode/rna_read_phasing.py +0 -0
  152. {varcode-9.3.5 → varcode-9.3.7}/varcode/splice_graph.py +0 -0
  153. {varcode-9.3.5 → varcode-9.3.7}/varcode/splice_outcomes.py +0 -0
  154. {varcode-9.3.5 → varcode-9.3.7}/varcode/string_helpers.py +0 -0
  155. {varcode-9.3.5 → varcode-9.3.7}/varcode/structural_variant.py +0 -0
  156. {varcode-9.3.5 → varcode-9.3.7}/varcode/sv_allele_parser.py +0 -0
  157. {varcode-9.3.5 → varcode-9.3.7}/varcode/transcript_model.py +0 -0
  158. {varcode-9.3.5 → varcode-9.3.7}/varcode/transforms/__init__.py +0 -0
  159. {varcode-9.3.5 → varcode-9.3.7}/varcode/ucsc_reference_names.py +0 -0
  160. {varcode-9.3.5 → varcode-9.3.7}/varcode/util.py +0 -0
  161. {varcode-9.3.5 → varcode-9.3.7}/varcode/variant.py +0 -0
  162. {varcode-9.3.5 → varcode-9.3.7}/varcode/variant_collection.py +0 -0
  163. {varcode-9.3.5 → varcode-9.3.7}/varcode/vcf.py +0 -0
  164. {varcode-9.3.5 → varcode-9.3.7}/varcode/vcf_output.py +0 -0
  165. {varcode-9.3.5 → varcode-9.3.7}/varcode/vcf_parsing.py +0 -0
  166. {varcode-9.3.5 → varcode-9.3.7}/varcode.egg-info/dependency_links.txt +0 -0
  167. {varcode-9.3.5 → varcode-9.3.7}/varcode.egg-info/entry_points.txt +0 -0
  168. {varcode-9.3.5 → varcode-9.3.7}/varcode.egg-info/requires.txt +0 -0
  169. {varcode-9.3.5 → varcode-9.3.7}/varcode.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: varcode
3
- Version: 9.3.5
3
+ Version: 9.3.7
4
4
  Summary: Variant annotation in Python
5
5
  Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
6
  Project-URL: Homepage, https://github.com/openvax/varcode
@@ -331,20 +331,44 @@ def test_alternate_start_codon_atg_to_ctg_agrees(dual_annotator):
331
331
  assert effect.short_description == "alternate-start-codon (ATG>CTG)"
332
332
 
333
333
 
334
- @pytest.mark.parametrize("alt", ["CAG", "CAA", "CAT", "TTT"])
335
- def test_insertion_before_retained_start_codon_is_five_prime_utr(alt):
336
- from varcode.mutant_transcript import apply_variant_to_transcript
337
-
338
- t = ensembl_grch38.transcript_by_id(BRCA1_ID)
339
- variant = Variant("17", 43124096, "", alt, ensembl_grch38)
334
+ @pytest.mark.parametrize("annotator", ["fast", "protein_diff", "transcript_model"])
335
+ @pytest.mark.parametrize("transcript_id", [BRCA1_ID, CFTR_ID])
336
+ @pytest.mark.parametrize("alt", ["CAG", "CAA", "CAT", "TTT", "A", "AG"])
337
+ def test_insertion_before_retained_start_codon_is_five_prime_utr(
338
+ annotator, transcript_id, alt):
339
+ from varcode.mutant_transcript import _translate_from_cds, apply_variant_to_transcript
340
+
341
+ t = ensembl_grch38.transcript_by_id(transcript_id)
342
+ anchor = (max(t.start_codon_positions) if t.on_backward_strand
343
+ else min(t.start_codon_positions) - 1)
344
+ variant = Variant(t.contig, anchor, "", alt, ensembl_grch38)
340
345
  mt = apply_variant_to_transcript(variant, t)
341
- assert mt.mutant_protein_sequence == t.protein_sequence
342
- effect = _PDIFF.annotate_on_transcript(variant, t)
346
+ assert _translate_from_cds(mt.cdna_sequence, t, mt.edits) == t.protein_sequence
347
+ effect = variant.effect_on_transcript(t, annotator=annotator)
343
348
  assert isinstance(effect, FivePrimeUTR)
344
349
  assert effect.modifies_coding_sequence is False
345
350
  assert effect.modifies_protein_sequence is False
346
351
 
347
352
 
353
+ @pytest.mark.parametrize("annotator", ["fast", "protein_diff", "transcript_model"])
354
+ @pytest.mark.parametrize("transcript_id", [BRCA1_ID, CFTR_ID])
355
+ @pytest.mark.parametrize("case", ["first_base_substitution", "internal_insertion"])
356
+ def test_edit_touching_start_codon_remains_coding(annotator, transcript_id, case):
357
+ t = ensembl_grch38.transcript_by_id(transcript_id)
358
+ first = (max(t.start_codon_positions) if t.on_backward_strand
359
+ else min(t.start_codon_positions))
360
+ if case == "first_base_substitution":
361
+ ref, alt = ("T", "G") if t.on_backward_strand else ("A", "C")
362
+ variant = Variant(t.contig, first, ref, alt, ensembl_grch38)
363
+ else:
364
+ # Insert after the first base of ATG in transcript orientation.
365
+ anchor = first - 1 if t.on_backward_strand else first
366
+ variant = Variant(t.contig, anchor, "", "AAA", ensembl_grch38)
367
+ effect = variant.effect_on_transcript(t, annotator=annotator)
368
+ assert effect.modifies_coding_sequence is True
369
+ assert not isinstance(effect, FivePrimeUTR)
370
+
371
+
348
372
  def test_divergence_frameshift_immediate_stop():
349
373
  """Frameshift that creates a stop codon at (or very near) the
350
374
  insertion point. Fast may report FrameShift with a short
@@ -13,8 +13,9 @@ from pyensembl import cached_release
13
13
  from varcode import Variant
14
14
  from varcode.mutant_transcript import apply_variant_to_transcript
15
15
 
16
+ from .collect_osteosarc_variants import collect_variants, render_fixture
17
+ from .osteosarc_variants import FIXTURE_PATH, SNAPSHOT_ID
16
18
 
17
- SNAPSHOT_ID = "9b34ea0e13f9c1c35c3c88b7e646c0e608b86a143dee0e668bf3f74b909f815c"
18
19
 
19
20
 
20
21
  @pytest.fixture(scope="module")
@@ -67,3 +68,7 @@ def test_osteosarc_corrected_map2_is_a_distinct_complex_allele(dataset):
67
68
  assert model is not None
68
69
  assert model.mutant_protein_sequence is not None
69
70
  assert model.mutant_protein_sequence != t.protein_sequence
71
+
72
+
73
+ def test_collected_fixture_matches_verified_snapshot(dataset):
74
+ assert render_fixture(collect_variants(dataset)) == FIXTURE_PATH.read_text()
@@ -0,0 +1,78 @@
1
+ """Run real public site alleles through annotation without an external cache."""
2
+
3
+ from collections import Counter
4
+
5
+ import pytest
6
+ from pyensembl import cached_release
7
+
8
+ from varcode.effects import Failure, Unresolved
9
+
10
+ from .osteosarc_variants import (
11
+ OSTEOSARC_VERSION,
12
+ SNAPSHOT_ID,
13
+ load_variants,
14
+ read_fixture,
15
+ variant_from_entry,
16
+ )
17
+
18
+
19
+ FIXTURE = read_fixture()
20
+ READY = [entry for entry in FIXTURE["entries"] if entry["status"] == "ready"]
21
+ UNRESOLVED = [entry for entry in FIXTURE["entries"] if entry["status"] != "ready"]
22
+
23
+
24
+ def test_collected_variants_keep_provenance_and_unresolved_entries():
25
+ assert FIXTURE["source"]["snapshot_id"] == SNAPSHOT_ID
26
+ assert FIXTURE["osteosarc_version"] == OSTEOSARC_VERSION
27
+ assert FIXTURE["selection"] == {"set": "site", "corrections": True}
28
+ assert len(READY) == 177
29
+ assert len(UNRESOLVED) == 5
30
+ assert Counter(entry["status"] for entry in UNRESOLVED) == {
31
+ "missing_literal_allele": 3, "non_literal_allele": 2}
32
+ assert len({entry["id"] for entry in FIXTURE["entries"]}) == 182
33
+ assert all(len(entry["osteosarc_entry_sha256"]) == 64 for entry in FIXTURE["entries"])
34
+ assert all(receipt["url"] and len(receipt["sha256"]) == 64
35
+ for receipt in FIXTURE["source"]["receipts"].values())
36
+ variants = load_variants()
37
+ assert variants.source == "osteosarc:" + SNAPSHOT_ID
38
+ assert {entry["id"] for metadata in variants.metadata.values()
39
+ for entry in metadata["entries"]} == {entry["id"] for entry in READY}
40
+
41
+
42
+ @pytest.mark.parametrize("entry", READY, ids=lambda entry: entry["id"])
43
+ def test_collected_variant_can_be_annotated(entry, dual_annotator):
44
+ variant = variant_from_entry(entry, cached_release(81))
45
+ effects = variant.effects(raise_on_error=True, annotator=dual_annotator)
46
+ assert effects
47
+ assert not any(isinstance(effect, (Failure, Unresolved)) for effect in effects)
48
+
49
+
50
+ @pytest.mark.parametrize("entry", UNRESOLVED, ids=lambda entry: entry["id"])
51
+ def test_unresolved_entries_are_not_fabricated_as_native_variants(entry):
52
+ with pytest.raises(ValueError, match="unique literal allele"):
53
+ variant_from_entry(entry, cached_release(81))
54
+
55
+
56
+ def test_collected_variants_reject_wrong_assembly():
57
+ with pytest.raises(ValueError, match="assembly"):
58
+ load_variants(genome=cached_release(75))
59
+
60
+
61
+ def test_collected_mitochondrial_variant_preserves_original_contig():
62
+ entry, = [entry for entry in READY if entry["alleles"][0][0] == "chrM"]
63
+ variant = variant_from_entry(entry, cached_release(81))
64
+ assert variant.original_contig == "chrM"
65
+ assert variant.contig == "MT"
66
+ assert variant.transcripts
67
+
68
+
69
+ def test_collected_map2_retains_corrected_allele_and_distinct_split_call():
70
+ entries = {entry["id"]: entry for entry in READY}
71
+ corrected = entries["MAP2-chr2-209694768"]
72
+ assert corrected["alleles"] == [[
73
+ "chr2", 209694768, "CCTGGGCTACTGTGTGTTCAATAAGTACACAGT", "CAGGG"]]
74
+ assert "allele-MAP2-chr2-209694768" in corrected["corrections"]
75
+ split = entries["MAP2-chr2-209694772"]
76
+ assert "map2-split-representations" in split["corrections"]
77
+ genome = cached_release(81)
78
+ assert variant_from_entry(corrected, genome) != variant_from_entry(split, genome)
@@ -535,8 +535,11 @@ def exonic_transcript_effect(variant, exon, exon_number, transcript):
535
535
 
536
536
  utr5_length = min(transcript.start_codon_spliced_offsets)
537
537
 
538
- # does the variant start inside the 5' UTR?
539
- if utr5_length > transcript_offset:
538
+ # A reverse-strand insertion goes before its anchor base. An anchor
539
+ # on the first CDS base therefore still places the insertion in the UTR.
540
+ if (utr5_length > transcript_offset
541
+ or (n_ref == 0 and transcript.on_backward_strand
542
+ and utr5_length == transcript_offset)):
540
543
  # does the variant end after the 5' UTR, within the coding region?
541
544
  if utr5_length < transcript_offset + n_ref:
542
545
  # TODO: we *might* lose the Kozak sequence or the start codon
@@ -467,7 +467,11 @@ def _unchanged_product_effect(variant, transcript, mutant):
467
467
  stop_offsets = tuple(transcript.stop_codon_spliced_offsets)
468
468
  cds_end = max(stop_offsets) + 1 if stop_offsets else (
469
469
  cds_start + 3 * len(str(transcript.protein_sequence)))
470
- if first_offset < cds_start:
470
+ # On the reverse strand, inserted bases precede their genomic anchor.
471
+ # Anchoring on the retained first CDS base leaves the insertion in the UTR.
472
+ if (first_offset < cds_start
473
+ or (getattr(variant, "is_insertion", False)
474
+ and transcript.on_backward_strand and first_offset == cds_start)):
471
475
  return FivePrimeUTR(variant, transcript)
472
476
  if first_offset >= cds_end:
473
477
  return ThreePrimeUTR(variant, transcript)
@@ -0,0 +1 @@
1
+ __version__ = "9.3.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: varcode
3
- Version: 9.3.5
3
+ Version: 9.3.7
4
4
  Summary: Variant annotation in Python
5
5
  Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
6
  Project-URL: Homepage, https://github.com/openvax/varcode
@@ -51,6 +51,7 @@ tests/test_no_duplicate_variants.py
51
51
  tests/test_nonlocal_sv_transcripts.py
52
52
  tests/test_osteosarc_dataset.py
53
53
  tests/test_osteosarc_fusions.py
54
+ tests/test_osteosarc_variants.py
54
55
  tests/test_partial_annotators.py
55
56
  tests/test_premature_stop_short_description.py
56
57
  tests/test_problematic_variants.py
@@ -1 +0,0 @@
1
- __version__ = "9.3.5"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes