How to extract a particular region from a nucleotide contig?
Hi,
I have downloaded a contig from NCBI. It is around 100 kbp long and has a integrated prophage region. The prophage region is between 54501-90604 bp. How to extract only 54501-90604 bp from this contig?
Cheers
• 1,928 views
•
link
3 answers
use samtools faidx to index and retrieve those coordinates
• 0 views
•
link
grep -v -E '^>|^$' input.fasta | tr -d '\n' | cut -c 54501-90604 | fold -w 60
• 0 views
•
link
The easiest (for me) would be:
from Bio import SeqIO
rec = SeqIO.read('/path/to/file', 'format') # assuming only one sequence in the file
prophage = rec[54501:90604]
# write sequence out or do whatever analysis next.
You will need to double check the coordinates. Since python starts at 0, I think you may need to subtract 1 from each index.
• 0 views
•
link
Log in to answer this question.