Created
August 6, 2018 21:13
-
-
Save clintval/44f023bc6f090f43f39a49bf4a1b75ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cyvcf2 import VCFReader | |
| from snv_spectrum import Snv | |
| reader = VCFReader(str(root / 'all.ann.vcf')) | |
| samples = reader.samples | |
| for variant in reader: | |
| for sample, depth, alt_depth, gt_base in zip( | |
| samples, | |
| variant.gt_depths, | |
| variant.gt_alt_depths, | |
| variant.gt_bases | |
| ): | |
| ref, alt = gt_base.split('/') | |
| if alt == ref == '.': continue | |
| snv = Snv(ref, alt) | |
| snv.set_context_from_fasta_locus(reference, variant.CHROM, variant.POS) | |
| snv = snv.with_pyrimidine_reference() | |
| print(snv.context) | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment