varcode 2.0.0__tar.gz → 2.2.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 (86) hide show
  1. {varcode-2.0.0/varcode.egg-info → varcode-2.2.0}/PKG-INFO +1 -1
  2. varcode-2.2.0/tests/test_collection_variants_attr_consistency.py +88 -0
  3. varcode-2.2.0/tests/test_csv_roundtrip.py +659 -0
  4. varcode-2.2.0/varcode/csv_helpers.py +144 -0
  5. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_collection.py +191 -3
  6. {varcode-2.0.0 → varcode-2.2.0}/varcode/variant_collection.py +152 -7
  7. varcode-2.2.0/varcode/version.py +1 -0
  8. {varcode-2.0.0 → varcode-2.2.0/varcode.egg-info}/PKG-INFO +1 -1
  9. {varcode-2.0.0 → varcode-2.2.0}/varcode.egg-info/SOURCES.txt +3 -0
  10. varcode-2.0.0/varcode/version.py +0 -1
  11. {varcode-2.0.0 → varcode-2.2.0}/LICENSE +0 -0
  12. {varcode-2.0.0 → varcode-2.2.0}/MANIFEST.in +0 -0
  13. {varcode-2.0.0 → varcode-2.2.0}/README.md +0 -0
  14. {varcode-2.0.0 → varcode-2.2.0}/pyproject.toml +0 -0
  15. {varcode-2.0.0 → varcode-2.2.0}/requirements.txt +0 -0
  16. {varcode-2.0.0 → varcode-2.2.0}/setup.cfg +0 -0
  17. {varcode-2.0.0 → varcode-2.2.0}/tests/__init__.py +0 -0
  18. {varcode-2.0.0 → varcode-2.2.0}/tests/benchmark_vcf_load.py +0 -0
  19. {varcode-2.0.0 → varcode-2.2.0}/tests/common.py +0 -0
  20. {varcode-2.0.0 → varcode-2.2.0}/tests/data.py +0 -0
  21. {varcode-2.0.0 → varcode-2.2.0}/tests/test_cli_effects.py +0 -0
  22. {varcode-2.0.0 → varcode-2.2.0}/tests/test_cli_genes.py +0 -0
  23. {varcode-2.0.0 → varcode-2.2.0}/tests/test_collection_filtering.py +0 -0
  24. {varcode-2.0.0 → varcode-2.2.0}/tests/test_common.py +0 -0
  25. {varcode-2.0.0 → varcode-2.2.0}/tests/test_cosmic_mutations.py +0 -0
  26. {varcode-2.0.0 → varcode-2.2.0}/tests/test_dbnsfp_validation.py +0 -0
  27. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effect_annotation_errors.py +0 -0
  28. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effect_classes.py +0 -0
  29. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effect_collection.py +0 -0
  30. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effect_collection_serialization.py +0 -0
  31. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effect_collection_sort_order.py +0 -0
  32. {varcode-2.0.0 → varcode-2.2.0}/tests/test_effects_from_mutagenix_variants.py +0 -0
  33. {varcode-2.0.0 → varcode-2.2.0}/tests/test_exonic_splice_site.py +0 -0
  34. {varcode-2.0.0 → varcode-2.2.0}/tests/test_frameshift_helpers.py +0 -0
  35. {varcode-2.0.0 → varcode-2.2.0}/tests/test_maf.py +0 -0
  36. {varcode-2.0.0 → varcode-2.2.0}/tests/test_mm10_klf6_frameshift.py +0 -0
  37. {varcode-2.0.0 → varcode-2.2.0}/tests/test_mouse.py +0 -0
  38. {varcode-2.0.0 → varcode-2.2.0}/tests/test_mutate.py +0 -0
  39. {varcode-2.0.0 → varcode-2.2.0}/tests/test_no_duplicate_variants.py +0 -0
  40. {varcode-2.0.0 → varcode-2.2.0}/tests/test_premature_stop_short_description.py +0 -0
  41. {varcode-2.0.0 → varcode-2.2.0}/tests/test_problematic_variants.py +0 -0
  42. {varcode-2.0.0 → varcode-2.2.0}/tests/test_reference.py +0 -0
  43. {varcode-2.0.0 → varcode-2.2.0}/tests/test_silent_aa_pos.py +0 -0
  44. {varcode-2.0.0 → varcode-2.2.0}/tests/test_silent_hgvs_description.py +0 -0
  45. {varcode-2.0.0 → varcode-2.2.0}/tests/test_splice_site_effects.py +0 -0
  46. {varcode-2.0.0 → varcode-2.2.0}/tests/test_stop_codon_classification_bugs.py +0 -0
  47. {varcode-2.0.0 → varcode-2.2.0}/tests/test_string_helpers.py +0 -0
  48. {varcode-2.0.0 → varcode-2.2.0}/tests/test_symbolic_alleles.py +0 -0
  49. {varcode-2.0.0 → varcode-2.2.0}/tests/test_timings.py +0 -0
  50. {varcode-2.0.0 → varcode-2.2.0}/tests/test_variant.py +0 -0
  51. {varcode-2.0.0 → varcode-2.2.0}/tests/test_variant_collection.py +0 -0
  52. {varcode-2.0.0 → varcode-2.2.0}/tests/test_vcf.py +0 -0
  53. {varcode-2.0.0 → varcode-2.2.0}/tests/test_vcf_output.py +0 -0
  54. {varcode-2.0.0 → varcode-2.2.0}/varcode/__init__.py +0 -0
  55. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/__init__.py +0 -0
  56. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/effects_script.py +0 -0
  57. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/genes_script.py +0 -0
  58. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/logging.conf +0 -0
  59. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/variant_args.py +0 -0
  60. {varcode-2.0.0 → varcode-2.2.0}/varcode/cli/version_info.py +0 -0
  61. {varcode-2.0.0 → varcode-2.2.0}/varcode/common.py +0 -0
  62. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/__init__.py +0 -0
  63. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/common.py +0 -0
  64. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_classes.py +0 -0
  65. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_helpers.py +0 -0
  66. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_ordering.py +0 -0
  67. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_prediction.py +0 -0
  68. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_prediction_coding.py +0 -0
  69. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_prediction_coding_frameshift.py +0 -0
  70. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/effect_prediction_coding_in_frame.py +0 -0
  71. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/mutate.py +0 -0
  72. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/transcript_helpers.py +0 -0
  73. {varcode-2.0.0 → varcode-2.2.0}/varcode/effects/translate.py +0 -0
  74. {varcode-2.0.0 → varcode-2.2.0}/varcode/maf.py +0 -0
  75. {varcode-2.0.0 → varcode-2.2.0}/varcode/nucleotides.py +0 -0
  76. {varcode-2.0.0 → varcode-2.2.0}/varcode/reference.py +0 -0
  77. {varcode-2.0.0 → varcode-2.2.0}/varcode/string_helpers.py +0 -0
  78. {varcode-2.0.0 → varcode-2.2.0}/varcode/ucsc_reference_names.py +0 -0
  79. {varcode-2.0.0 → varcode-2.2.0}/varcode/util.py +0 -0
  80. {varcode-2.0.0 → varcode-2.2.0}/varcode/variant.py +0 -0
  81. {varcode-2.0.0 → varcode-2.2.0}/varcode/vcf.py +0 -0
  82. {varcode-2.0.0 → varcode-2.2.0}/varcode/vcf_output.py +0 -0
  83. {varcode-2.0.0 → varcode-2.2.0}/varcode.egg-info/dependency_links.txt +0 -0
  84. {varcode-2.0.0 → varcode-2.2.0}/varcode.egg-info/entry_points.txt +0 -0
  85. {varcode-2.0.0 → varcode-2.2.0}/varcode.egg-info/requires.txt +0 -0
  86. {varcode-2.0.0 → varcode-2.2.0}/varcode.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: varcode
3
- Version: 2.0.0
3
+ Version: 2.2.0
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
@@ -0,0 +1,88 @@
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
+ Regression tests for https://github.com/openvax/varcode/issues/220
15
+
16
+ VariantCollection.variants was assigned the raw input list before
17
+ Collection.__init__ sorted / de-duplicated elements, so iterating a
18
+ VariantCollection produced one order while `.variants` produced
19
+ another. The same pattern existed in EffectCollection.effects.
20
+ """
21
+
22
+ import varcode
23
+ from varcode import Variant, VariantCollection
24
+ from varcode.effects.effect_collection import EffectCollection
25
+
26
+
27
+ def _unsorted_variants():
28
+ return [
29
+ Variant(contig="1", start=4, ref="A", alt="T"),
30
+ Variant(contig="1", start=1, ref="A", alt="T"),
31
+ Variant(contig="1", start=3, ref="A", alt="T"),
32
+ Variant(contig="1", start=2, ref="A", alt="T"),
33
+ ]
34
+
35
+
36
+ def test_variant_collection_variants_matches_iteration_with_default_sort():
37
+ vc = VariantCollection(variants=_unsorted_variants())
38
+ iterated = [v.start for v in vc]
39
+ via_attr = [v.start for v in vc.variants]
40
+ assert iterated == via_attr, (
41
+ "vc.variants should match iteration order, got %r vs %r"
42
+ % (via_attr, iterated)
43
+ )
44
+
45
+
46
+ def test_variant_collection_variants_matches_iteration_with_sort_key_none_distinct_false():
47
+ # Explicitly opt out of sorting and deduplication. Iteration and
48
+ # .variants should both preserve the original input order.
49
+ variants = _unsorted_variants()
50
+ vc = VariantCollection(
51
+ variants=variants, sort_key=None, distinct=False
52
+ )
53
+ iterated = [v.start for v in vc]
54
+ via_attr = [v.start for v in vc.variants]
55
+ assert iterated == via_attr
56
+ # And the order should match the input.
57
+ assert iterated == [4, 1, 3, 2]
58
+
59
+
60
+ def test_variant_collection_variants_matches_iteration_with_distinct_true():
61
+ # When distinct=True and sort_key=None, the base Collection uses
62
+ # set() which loses order. Regardless of what order it ends up in,
63
+ # iteration and .variants should agree.
64
+ variants = _unsorted_variants()
65
+ vc = VariantCollection(
66
+ variants=variants, sort_key=None, distinct=True
67
+ )
68
+ iterated = [v.start for v in vc]
69
+ via_attr = [v.start for v in vc.variants]
70
+ assert iterated == via_attr
71
+
72
+
73
+ def test_variant_collection_len_matches_variants_attr():
74
+ vc = VariantCollection(variants=_unsorted_variants())
75
+ assert len(vc) == len(vc.variants)
76
+
77
+
78
+ def test_effect_collection_effects_matches_iteration():
79
+ # Same bug existed in EffectCollection.effects — produce an effect
80
+ # collection and verify the two access paths agree.
81
+ variant = Variant("17", 43082575 - 5, "CCT", "GGG", "GRCh38")
82
+ effects = variant.effects()
83
+ iterated = [e.__class__.__name__ for e in effects]
84
+ via_attr = [e.__class__.__name__ for e in effects.effects]
85
+ assert iterated == via_attr, (
86
+ "effects.effects should match iteration order, got %r vs %r"
87
+ % (via_attr, iterated)
88
+ )