Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Created July 19, 2017 14:27
Show Gist options
  • Save mdshw5/d1e4af5ef83a04630175f0dcc0638b6a to your computer and use it in GitHub Desktop.
Save mdshw5/d1e4af5ef83a04630175f0dcc0638b6a to your computer and use it in GitHub Desktop.
biostars 263478
from pyfaidx import Fasta
with Fasta('input.fasta') as fasta:
with open('pos.txt', 'r') as nucleotides:
for line in nucleotides:
chrom, pos = line.rstrip().split()
nuc = fasta[chrom][int(pos)].seq
print("{chrom}\t{pos}\t{nuc}".format(**locals()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment