Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Created April 8, 2016 00:57
Show Gist options
  • Save mdshw5/c562118a084c581c836078ea7ff92252 to your computer and use it in GitHub Desktop.
Save mdshw5/c562118a084c581c836078ea7ff92252 to your computer and use it in GitHub Desktop.
biostars 183260
from pyfaidx import FastaVariant
with FastaVariant('genome.fasta', 'tabix_indexed_variants.vcf.gz', het=True, hom=True) as consensus:
for chromosome in consensus:
for site in chromosome.variant_sites:
flanking = chromosome[site-2:site+1]
## do something with flanking sequence
print(flanking.seq) ## ATG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment