I have downloaded whole genome file from this link (ftp://ftp.broadinstitute.org/pub/genepattern/rna_seq/whole_genomes/Homo_sapiens_UCSC_hg19.fa). Now I need a program in Perl or Python to retrive nucleotide (user defined position) sequnce from the whole genome. I need to perform this offline The user input can be 1. Enter the chromosome number 2. Enter start position 3.Enter end position
The genome file i downloaded looks like
chrM
GATCGGTCTGACGTGCTgaTGATGATA GATCGGTCTGACGTGCTGATGATGATA
chr1
NNNNNNNNNNNNNNNNNNNNNNNNNNtggGGAATTttaag
3 answers
You can simply use samtools to index the FASTA file, and then query the indexed FASTA file with your interval of interest.
- Generate the index:
samtools faidx in.fasta - Query via:
samtools faidx in.fasta chrN:X-Y
Replace chrN:X-Y with the chromosome name (chrN), start position (X) and stop position (Y) of interest.
Look at the Biopython cookbook. Especially Sections 2.4 and 3.3
Log in to answer this question.