varcode 9.2.4__tar.gz → 9.2.6__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.
- varcode-9.2.6/PKG-INFO +106 -0
- varcode-9.2.6/README.md +79 -0
- varcode-9.2.6/tests/test_documentation_examples.py +149 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/variant.py +1 -1
- {varcode-9.2.4 → varcode-9.2.6}/varcode/variant_collection.py +1 -1
- varcode-9.2.6/varcode/version.py +1 -0
- varcode-9.2.6/varcode.egg-info/PKG-INFO +106 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode.egg-info/SOURCES.txt +1 -0
- varcode-9.2.4/PKG-INFO +0 -287
- varcode-9.2.4/README.md +0 -260
- varcode-9.2.4/varcode/version.py +0 -1
- varcode-9.2.4/varcode.egg-info/PKG-INFO +0 -287
- {varcode-9.2.4 → varcode-9.2.6}/LICENSE +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/MANIFEST.in +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/pyproject.toml +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/requirements.txt +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/setup.cfg +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_annotator_divergence_scenarios.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_annotator_parity_adversarial.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_annotators.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_bnd_retained_segments.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_cli_effects.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_cli_genes.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_cli_without_pkg_resources.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_collection_filtering.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_collection_variants_attr_consistency.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_common.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_cosmic_mutations.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_cryptic_exons.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_csv_roundtrip.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_dbnsfp_validation.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_default_structural_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_annotation_errors.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_candidates.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_classes.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_collection.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_collection_serialization.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_collection_sort_order.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effect_hypotheses.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_effects_from_mutagenix_variants.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_exacto_fusions.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_exonic_splice_site.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_fast_path.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_frameshift_cterminus_regression.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_frameshift_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_genome_contig_validation.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_genome_sequence.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_genomic_layout.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_genotype.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_genotype_from_vcf.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_germline_context.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_germline_effects.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_haplotype_effect.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_maf.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_mitochondrial.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_mm10_klf6_frameshift.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_mouse.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_mutant_transcript.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_mutate.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_no_duplicate_variants.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_nonlocal_sv_transcripts.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_osteosarc_fusions.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_partial_annotators.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_premature_stop_short_description.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_problematic_variants.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_protein_diff_parity.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_read_phase_resolver.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_real_world_callers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_reference.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_reference_mismatch_error.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_reference_segments.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_rna_evidence.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_rna_haplotype_sequences.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_rna_read_phasing_source.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_selenocysteine.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_silent_aa_pos.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_silent_hgvs_description.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_splice_graph.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_splice_outcomes.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_splice_site_effects.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_stop_codon_classification_bugs.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_string_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_structural_variant_annotator.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_structural_variants.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_sv_tabular_metadata.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_symbolic_alleles.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_symbolic_sv_padding.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_timings.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_transcript_layout.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_transcript_model.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_transforms_left_align.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_transforms_pair_breakends.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_variant.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_variant_collection.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_vcf.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_vcf_output.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_vcf_parsing.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_vcf_phase_resolver.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/tests/test_vcf_spec_examples.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/__init__.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/annotators/__init__.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/annotators/fast.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/annotators/protein_diff.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/annotators/registry.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/__init__.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/effects_script.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/genes_script.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/logging.conf +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/variant_args.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cli/version_info.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/common.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/cryptic_exons.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/csv_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effect_candidates.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effect_hypotheses.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/__init__.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/classify.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/codon_tables.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/common.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_classes.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_collection.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_ordering.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_prediction.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_prediction_coding.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_prediction_coding_frameshift.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/effect_prediction_coding_in_frame.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/fast_path.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/mutate.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/structural.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/transcript_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/effects/translate.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/errors.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/exacto.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/genome.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/genome_sequence.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/genomic_layout.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/genotype.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/germline.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/maf.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/mutant_transcript.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/nucleotides.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/phasing.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/realized_effects.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/reference.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/rna_evidence.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/rna_read_phasing.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/splice_graph.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/splice_outcomes.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/string_helpers.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/structural_variant.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/sv_allele_parser.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/transcript_layout.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/transcript_model.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/transforms/__init__.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/ucsc_reference_names.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/util.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/vcf.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/vcf_output.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode/vcf_parsing.py +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode.egg-info/dependency_links.txt +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode.egg-info/entry_points.txt +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode.egg-info/requires.txt +0 -0
- {varcode-9.2.4 → varcode-9.2.6}/varcode.egg-info/top_level.txt +0 -0
varcode-9.2.6/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: varcode
|
|
3
|
+
Version: 9.2.6
|
|
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
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
[](https://github.com/openvax/varcode/actions/workflows/tests.yml)
|
|
29
|
+
[](https://coveralls.io/github/openvax/varcode?branch=main)
|
|
30
|
+
[](https://pypi.python.org/pypi/varcode/)
|
|
31
|
+
[](https://pypistats.org/packages/varcode)
|
|
32
|
+
|
|
33
|
+
# Varcode
|
|
34
|
+
|
|
35
|
+
Varcode helps you work with genomic variants in Python and predict their effects
|
|
36
|
+
on genes, transcripts, and protein sequences.
|
|
37
|
+
|
|
38
|
+
Load variants from VCF or MAF files, annotate them, and inspect the results.
|
|
39
|
+
The same interface handles small variants and structural variants; optional
|
|
40
|
+
germline, phasing, and RNA evidence can refine predictions.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Requires Python 3.9 or later:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install varcode
|
|
48
|
+
pyensembl install --release 81 --species human
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The second command downloads the annotation and transcript sequences for the
|
|
52
|
+
GRCh38 example below. Release 81 is pinned for reproducibility, not a requirement
|
|
53
|
+
to use that release for your own data. Choose an annotation matching your
|
|
54
|
+
input's genome build; see [reference setup](https://openvax.github.io/varcode/getting_started/#reference-data).
|
|
55
|
+
|
|
56
|
+
<a id="example"></a>
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
Predict the effect of a single GRCh38 variant on a CFTR transcript:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from varcode import Variant
|
|
64
|
+
|
|
65
|
+
variant = Variant("7", 117_531_100, "T", "A", genome=81)
|
|
66
|
+
transcript = variant.genome.transcript_by_id("ENST00000003084")
|
|
67
|
+
effect = variant.effect_on_transcript(transcript)
|
|
68
|
+
|
|
69
|
+
print(effect.short_description) # p.L159M
|
|
70
|
+
protein = effect.mutant_protein_sequence
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For a VCF called against the same genome build:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from varcode import load_vcf
|
|
77
|
+
|
|
78
|
+
variants = load_vcf("variants.vcf", genome=81)
|
|
79
|
+
effects = variants.effects()
|
|
80
|
+
for variant, effect in effects.top_priority_effect_per_variant().items():
|
|
81
|
+
print(variant.short_description, effect.short_description)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
A variant can affect several transcripts. Priority is a summary of predicted
|
|
85
|
+
consequence, not proof of expression or pathogenicity. A protein sequence may be
|
|
86
|
+
unavailable for unresolved effects.
|
|
87
|
+
|
|
88
|
+
<a id="further-reading"></a>
|
|
89
|
+
|
|
90
|
+
## Learn more
|
|
91
|
+
|
|
92
|
+
Start with the [getting-started guide](https://openvax.github.io/varcode/getting_started/)
|
|
93
|
+
for file loading, result access, and saving a table. Then follow the
|
|
94
|
+
[task guides](https://openvax.github.io/varcode/#find-your-next-task) for sample
|
|
95
|
+
filtering, structural variants, phasing, and RNA evidence.
|
|
96
|
+
|
|
97
|
+
<a id="effect-types"></a>
|
|
98
|
+
<a id="coordinate-system"></a>
|
|
99
|
+
|
|
100
|
+
Detailed [effect types](https://openvax.github.io/varcode/effect_types/),
|
|
101
|
+
[coordinate conventions](https://openvax.github.io/varcode/getting_started/#coordinate-conventions),
|
|
102
|
+
and the [API reference](https://openvax.github.io/varcode/api/) live in the docs.
|
|
103
|
+
|
|
104
|
+
For bugs or questions, [open an issue](https://github.com/openvax/varcode/issues).
|
|
105
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
106
|
+
[changelog](CHANGELOG.md).
|
varcode-9.2.6/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[](https://github.com/openvax/varcode/actions/workflows/tests.yml)
|
|
2
|
+
[](https://coveralls.io/github/openvax/varcode?branch=main)
|
|
3
|
+
[](https://pypi.python.org/pypi/varcode/)
|
|
4
|
+
[](https://pypistats.org/packages/varcode)
|
|
5
|
+
|
|
6
|
+
# Varcode
|
|
7
|
+
|
|
8
|
+
Varcode helps you work with genomic variants in Python and predict their effects
|
|
9
|
+
on genes, transcripts, and protein sequences.
|
|
10
|
+
|
|
11
|
+
Load variants from VCF or MAF files, annotate them, and inspect the results.
|
|
12
|
+
The same interface handles small variants and structural variants; optional
|
|
13
|
+
germline, phasing, and RNA evidence can refine predictions.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Requires Python 3.9 or later:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install varcode
|
|
21
|
+
pyensembl install --release 81 --species human
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The second command downloads the annotation and transcript sequences for the
|
|
25
|
+
GRCh38 example below. Release 81 is pinned for reproducibility, not a requirement
|
|
26
|
+
to use that release for your own data. Choose an annotation matching your
|
|
27
|
+
input's genome build; see [reference setup](https://openvax.github.io/varcode/getting_started/#reference-data).
|
|
28
|
+
|
|
29
|
+
<a id="example"></a>
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
Predict the effect of a single GRCh38 variant on a CFTR transcript:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from varcode import Variant
|
|
37
|
+
|
|
38
|
+
variant = Variant("7", 117_531_100, "T", "A", genome=81)
|
|
39
|
+
transcript = variant.genome.transcript_by_id("ENST00000003084")
|
|
40
|
+
effect = variant.effect_on_transcript(transcript)
|
|
41
|
+
|
|
42
|
+
print(effect.short_description) # p.L159M
|
|
43
|
+
protein = effect.mutant_protein_sequence
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For a VCF called against the same genome build:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from varcode import load_vcf
|
|
50
|
+
|
|
51
|
+
variants = load_vcf("variants.vcf", genome=81)
|
|
52
|
+
effects = variants.effects()
|
|
53
|
+
for variant, effect in effects.top_priority_effect_per_variant().items():
|
|
54
|
+
print(variant.short_description, effect.short_description)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A variant can affect several transcripts. Priority is a summary of predicted
|
|
58
|
+
consequence, not proof of expression or pathogenicity. A protein sequence may be
|
|
59
|
+
unavailable for unresolved effects.
|
|
60
|
+
|
|
61
|
+
<a id="further-reading"></a>
|
|
62
|
+
|
|
63
|
+
## Learn more
|
|
64
|
+
|
|
65
|
+
Start with the [getting-started guide](https://openvax.github.io/varcode/getting_started/)
|
|
66
|
+
for file loading, result access, and saving a table. Then follow the
|
|
67
|
+
[task guides](https://openvax.github.io/varcode/#find-your-next-task) for sample
|
|
68
|
+
filtering, structural variants, phasing, and RNA evidence.
|
|
69
|
+
|
|
70
|
+
<a id="effect-types"></a>
|
|
71
|
+
<a id="coordinate-system"></a>
|
|
72
|
+
|
|
73
|
+
Detailed [effect types](https://openvax.github.io/varcode/effect_types/),
|
|
74
|
+
[coordinate conventions](https://openvax.github.io/varcode/getting_started/#coordinate-conventions),
|
|
75
|
+
and the [API reference](https://openvax.github.io/varcode/api/) live in the docs.
|
|
76
|
+
|
|
77
|
+
For bugs or questions, [open an issue](https://github.com/openvax/varcode/issues).
|
|
78
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
79
|
+
[changelog](CHANGELOG.md).
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""Keep the reader-facing examples executable, using their actual Markdown."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import re
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from pyensembl import cached_release
|
|
9
|
+
|
|
10
|
+
import varcode
|
|
11
|
+
from varcode import EffectCandidate, StructuralVariant, Variant
|
|
12
|
+
from varcode.effect_hypotheses import RealizedEffectCandidate
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _blocks(path, heading=None):
|
|
19
|
+
text = (ROOT / path).read_text()
|
|
20
|
+
if heading is not None:
|
|
21
|
+
text = text.split(heading + "\n", 1)[1]
|
|
22
|
+
return re.findall(r"```python\n(.*?)```", text, re.S)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _run(blocks, namespace=None):
|
|
26
|
+
namespace = {} if namespace is None else namespace
|
|
27
|
+
for block in blocks:
|
|
28
|
+
exec(compile(block, "documentation example", "exec"), namespace)
|
|
29
|
+
return namespace
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture
|
|
33
|
+
def input_directory(tmp_path, monkeypatch):
|
|
34
|
+
for fixture in (ROOT / "tests/data/documentation").glob("*.vcf"):
|
|
35
|
+
shutil.copy(fixture, tmp_path / fixture.name)
|
|
36
|
+
shutil.copy(tmp_path / "variants.vcf", tmp_path / "tumor.vcf")
|
|
37
|
+
monkeypatch.chdir(tmp_path)
|
|
38
|
+
return tmp_path
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@pytest.mark.parametrize("path,count", [
|
|
42
|
+
("README.md", 2),
|
|
43
|
+
("docs/getting_started.md", 4),
|
|
44
|
+
("docs/index.md", 1),
|
|
45
|
+
("docs/effect_annotation.md", 3),
|
|
46
|
+
("docs/structural_variants.md", 1),
|
|
47
|
+
("docs/transforms.md", 1),
|
|
48
|
+
("docs/germline.md", 1),
|
|
49
|
+
])
|
|
50
|
+
def test_documentation_first_steps(path, count, input_directory):
|
|
51
|
+
namespace = _run(_blocks(path)[:count])
|
|
52
|
+
if path == "docs/transforms.md":
|
|
53
|
+
assert len(namespace["paired"]) == len(namespace["normalized"]) == 1
|
|
54
|
+
else:
|
|
55
|
+
assert len(namespace["effects"]) > 0
|
|
56
|
+
if path in ("README.md", "docs/getting_started.md"):
|
|
57
|
+
assert namespace["protein"][158] == "M"
|
|
58
|
+
if path == "docs/getting_started.md":
|
|
59
|
+
assert (input_directory / "effects.csv").is_file()
|
|
60
|
+
if path == "docs/structural_variants.md":
|
|
61
|
+
assert namespace["variants"][0].is_structural
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_documentation_germline_scenarios():
|
|
65
|
+
namespace = _run(_blocks(
|
|
66
|
+
"docs/germline.md", "## Concrete example: same codon, three scenarios")[:4])
|
|
67
|
+
assert namespace["eff_cis"].short_description == "p.S159T"
|
|
68
|
+
assert namespace["eff_trans"].short_description == "p.L159M"
|
|
69
|
+
assert {c.effect.short_description for c in namespace["eff"].candidates} == {
|
|
70
|
+
"p.S159T", "p.L159M"}
|
|
71
|
+
|
|
72
|
+
_run(_blocks("docs/germline.md", "## Loss of heterozygosity (LOH)")[:1],
|
|
73
|
+
namespace)
|
|
74
|
+
assert any(getattr(effect, "is_loh", False)
|
|
75
|
+
for effect in namespace["overlap"].effects(germline=namespace["ctx"]))
|
|
76
|
+
|
|
77
|
+
validation = _blocks("docs/germline.md", "## Cross-VCF build mismatch")[:1]
|
|
78
|
+
_run(validation, namespace)
|
|
79
|
+
namespace["ctx"] = varcode.GermlineContext.from_variants(
|
|
80
|
+
[namespace["germline"]], reference_name="GRCh37")
|
|
81
|
+
with pytest.raises(varcode.GenomeBuildMismatchError):
|
|
82
|
+
_run(validation, namespace)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_documentation_splice_accessors():
|
|
86
|
+
namespace = _run(_blocks("docs/splice_variants.md"))
|
|
87
|
+
assert isinstance(namespace["splice_set"], varcode.SpliceOutcomeSet)
|
|
88
|
+
assert namespace["coding"] is not None
|
|
89
|
+
assert namespace["preferred"] is not None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_documentation_moved_sections_keep_incoming_links():
|
|
93
|
+
guide = (ROOT / "docs/effect_annotation.md").read_text()
|
|
94
|
+
destinations = {
|
|
95
|
+
"splice-disrupting-variants": "splice_variants.md",
|
|
96
|
+
"how-it-composes": "transcript_models.md",
|
|
97
|
+
"annotator-selection": "experimental_annotators.md",
|
|
98
|
+
"writing-an-annotator": "annotator_contract.md",
|
|
99
|
+
"provenance": "csv.md#annotation-provenance",
|
|
100
|
+
}
|
|
101
|
+
for anchor, destination in destinations.items():
|
|
102
|
+
# Old fragment URLs land beside a link to the relocated content.
|
|
103
|
+
row = next(line for line in guide.splitlines() if f'id="{anchor}"' in line)
|
|
104
|
+
assert f"]({destination})" in row
|
|
105
|
+
assert (ROOT / "docs" / destination.split("#")[0]).is_file()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_documentation_custom_annotator_adapter():
|
|
109
|
+
namespace = _run(_blocks("docs/annotator_contract.md")[:1])
|
|
110
|
+
adapter = namespace["MyAnnotator"]
|
|
111
|
+
variant = Variant("7", 117531100, "T", "A", genome=81)
|
|
112
|
+
transcript = variant.genome.transcript_by_id("ENST00000003084")
|
|
113
|
+
effect = variant.effect_on_transcript(transcript)
|
|
114
|
+
supported = adapter(lambda variant, transcript: effect)
|
|
115
|
+
unsupported = adapter(lambda variant, transcript: None)
|
|
116
|
+
assert supported.annotate_on_transcript(variant, transcript) is effect
|
|
117
|
+
assert unsupported.annotate_on_transcript(variant, transcript) is NotImplemented
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@pytest.mark.parametrize("kind", ["point", "BND", "CNV"])
|
|
121
|
+
def test_documentation_experimental_result_access(kind):
|
|
122
|
+
genome = cached_release(81)
|
|
123
|
+
transcript = genome.transcript_by_id("ENST00000003084")
|
|
124
|
+
if kind == "point":
|
|
125
|
+
variant = Variant("7", 117531100, "T", "A", genome)
|
|
126
|
+
elif kind == "BND":
|
|
127
|
+
variant = StructuralVariant(
|
|
128
|
+
"7", transcript.start + 50, "BND", alt="N]22:15500000]",
|
|
129
|
+
mate_contig="22", mate_start=15500000, genome=genome)
|
|
130
|
+
else:
|
|
131
|
+
variant = StructuralVariant(
|
|
132
|
+
"7", transcript.start + 50, "CNV", end=transcript.start + 100,
|
|
133
|
+
genome=genome)
|
|
134
|
+
namespace = dict(varcode=varcode, variant=variant, transcript=transcript)
|
|
135
|
+
advanced_blocks = _blocks("docs/experimental_annotators.md")
|
|
136
|
+
assert "comparison =" in advanced_blocks[0]
|
|
137
|
+
assert "candidate.outcomes" in advanced_blocks[1]
|
|
138
|
+
_run(advanced_blocks[:2], namespace)
|
|
139
|
+
_run(_blocks("docs/transcript_models.md"), namespace)
|
|
140
|
+
candidates = getattr(namespace["experimental"], "candidates", ())
|
|
141
|
+
if kind == "point":
|
|
142
|
+
assert candidates and all(isinstance(c, RealizedEffectCandidate)
|
|
143
|
+
for c in candidates)
|
|
144
|
+
assert namespace["protein"][158] == "M"
|
|
145
|
+
elif kind == "BND":
|
|
146
|
+
assert candidates and all(isinstance(c, EffectCandidate) for c in candidates)
|
|
147
|
+
else:
|
|
148
|
+
assert not candidates
|
|
149
|
+
assert isinstance(namespace["experimental"], varcode.Unresolved)
|
|
@@ -464,7 +464,7 @@ class Variant(Serializable):
|
|
|
464
464
|
:func:`varcode.use_annotator`). String names are resolved
|
|
465
465
|
against the registry. See openvax/varcode#271.
|
|
466
466
|
|
|
467
|
-
phase_resolver :
|
|
467
|
+
phase_resolver : resolver object or None
|
|
468
468
|
Optional phase-evidence source (typically a
|
|
469
469
|
:class:`~varcode.phasing.MolecularPhaseResolver` wrapping an
|
|
470
470
|
upstream RNA-phasing tool, or
|
|
@@ -140,7 +140,7 @@ class VariantCollection(Collection):
|
|
|
140
140
|
the collection. See :meth:`Variant.effects` and
|
|
141
141
|
openvax/varcode#271.
|
|
142
142
|
|
|
143
|
-
phase_resolver :
|
|
143
|
+
phase_resolver : resolver object or None
|
|
144
144
|
Optional phase-evidence source (e.g. a
|
|
145
145
|
:class:`~varcode.phasing.MolecularPhaseResolver` wrapping an
|
|
146
146
|
upstream RNA-phasing tool, or
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "9.2.6"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: varcode
|
|
3
|
+
Version: 9.2.6
|
|
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
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
[](https://github.com/openvax/varcode/actions/workflows/tests.yml)
|
|
29
|
+
[](https://coveralls.io/github/openvax/varcode?branch=main)
|
|
30
|
+
[](https://pypi.python.org/pypi/varcode/)
|
|
31
|
+
[](https://pypistats.org/packages/varcode)
|
|
32
|
+
|
|
33
|
+
# Varcode
|
|
34
|
+
|
|
35
|
+
Varcode helps you work with genomic variants in Python and predict their effects
|
|
36
|
+
on genes, transcripts, and protein sequences.
|
|
37
|
+
|
|
38
|
+
Load variants from VCF or MAF files, annotate them, and inspect the results.
|
|
39
|
+
The same interface handles small variants and structural variants; optional
|
|
40
|
+
germline, phasing, and RNA evidence can refine predictions.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Requires Python 3.9 or later:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install varcode
|
|
48
|
+
pyensembl install --release 81 --species human
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The second command downloads the annotation and transcript sequences for the
|
|
52
|
+
GRCh38 example below. Release 81 is pinned for reproducibility, not a requirement
|
|
53
|
+
to use that release for your own data. Choose an annotation matching your
|
|
54
|
+
input's genome build; see [reference setup](https://openvax.github.io/varcode/getting_started/#reference-data).
|
|
55
|
+
|
|
56
|
+
<a id="example"></a>
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
Predict the effect of a single GRCh38 variant on a CFTR transcript:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from varcode import Variant
|
|
64
|
+
|
|
65
|
+
variant = Variant("7", 117_531_100, "T", "A", genome=81)
|
|
66
|
+
transcript = variant.genome.transcript_by_id("ENST00000003084")
|
|
67
|
+
effect = variant.effect_on_transcript(transcript)
|
|
68
|
+
|
|
69
|
+
print(effect.short_description) # p.L159M
|
|
70
|
+
protein = effect.mutant_protein_sequence
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For a VCF called against the same genome build:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from varcode import load_vcf
|
|
77
|
+
|
|
78
|
+
variants = load_vcf("variants.vcf", genome=81)
|
|
79
|
+
effects = variants.effects()
|
|
80
|
+
for variant, effect in effects.top_priority_effect_per_variant().items():
|
|
81
|
+
print(variant.short_description, effect.short_description)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
A variant can affect several transcripts. Priority is a summary of predicted
|
|
85
|
+
consequence, not proof of expression or pathogenicity. A protein sequence may be
|
|
86
|
+
unavailable for unresolved effects.
|
|
87
|
+
|
|
88
|
+
<a id="further-reading"></a>
|
|
89
|
+
|
|
90
|
+
## Learn more
|
|
91
|
+
|
|
92
|
+
Start with the [getting-started guide](https://openvax.github.io/varcode/getting_started/)
|
|
93
|
+
for file loading, result access, and saving a table. Then follow the
|
|
94
|
+
[task guides](https://openvax.github.io/varcode/#find-your-next-task) for sample
|
|
95
|
+
filtering, structural variants, phasing, and RNA evidence.
|
|
96
|
+
|
|
97
|
+
<a id="effect-types"></a>
|
|
98
|
+
<a id="coordinate-system"></a>
|
|
99
|
+
|
|
100
|
+
Detailed [effect types](https://openvax.github.io/varcode/effect_types/),
|
|
101
|
+
[coordinate conventions](https://openvax.github.io/varcode/getting_started/#coordinate-conventions),
|
|
102
|
+
and the [API reference](https://openvax.github.io/varcode/api/) live in the docs.
|
|
103
|
+
|
|
104
|
+
For bugs or questions, [open an issue](https://github.com/openvax/varcode/issues).
|
|
105
|
+
Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
106
|
+
[changelog](CHANGELOG.md).
|
|
@@ -18,6 +18,7 @@ tests/test_cryptic_exons.py
|
|
|
18
18
|
tests/test_csv_roundtrip.py
|
|
19
19
|
tests/test_dbnsfp_validation.py
|
|
20
20
|
tests/test_default_structural_helpers.py
|
|
21
|
+
tests/test_documentation_examples.py
|
|
21
22
|
tests/test_effect_annotation_errors.py
|
|
22
23
|
tests/test_effect_candidates.py
|
|
23
24
|
tests/test_effect_classes.py
|