I have a FASTA file. I want to extract from some sequence using seqtk. What should be the command for it?
1
0
Entering edit mode
15 months ago
Mustafa • 0

I have Fasta fie with 5555 bp. I wanted to extract a small region from 501 to 1532 and run blastn. What should be the code in Seqtk to go about it?

WGS • 699 views
ADD COMMENT
1
Entering edit mode

Check seqtk subseq. You will need to provide the region you are interested in as BED file. You may also want to use samtools faidx your.fa fasta_header:501-1532.

ADD REPLY
0
Entering edit mode

THanks i will try thiss !

ADD REPLY
1
Entering edit mode
15 months ago
bk11 ★ 3.0k

You can create a bed file and use it to extract range of sequences you want. Please try something like this.

cat region.bed
chr1    20  50
chr2    10  30

cat input.fasta
>chr1
TGCGGGCGGTGAGGTCGCCCGCCGCGATCGCCTGCAATACCGTCGAGAGCGCGTGCAGATTCGCATCGGAGGTGGCCATC
AATTGATTGAGGCTGTCCACCATCGCGCGGAAGTCGTACTGGAAGCGCTGTGCGTCGCCGCGCACGCTGAAATCGCCATT
GGCTGCGGCCTGCGCAAGCAGCTTGATCTCGCTGTTCATCGCCGACAGGTTG
>chr2
CCCTCCACAGGAAGCGGACCGGACAATGACGCTTGATTGCCGCGCAGGAAATGCCCCCGTTCCCGCAGGCATACACCCCA
TTTGCCGCGGACATACGCCGCACATTTCTCGGAGCCTGGACAAGTCGCCACAGCTTTGATGGAACGACGGAAAAAACGCC
CCGGAGTTGACCAGAACAACCGCCAGTACTGAAATCTGGACCTTAAGTTCCAGTTCCTGCAGCTCTGGACCTGGTTCATC
AGCGAGCTTCTATCGCTTCGCGGCGGCTTCGATCGCAGCGTGTGCGCGCCATCACTTGGTCGTGCGAAATCGTCGGCCGC
GTGTCGGCCACGGCGCGCTCGATCTTCGCCCGGAACTACCAGTCGTAGTCCTCGGCGGCTTCGGTCGACTCAAATTCGGA
AACAGGTGGTCGAGTGATACGCCCAGGGTTC

seqtk subseq input.fasta region.bed >results.fasta

cat results.fasta
>chr1:21-50
GCCGCGATCGCCTGCAATACCGTCGAGAGC
>chr2:11-30
GAAGCGGACCGGACAATGAC
ADD COMMENT
0
Entering edit mode

Thank you !

ADD REPLY

Login before adding your answer.

Traffic: 2332 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6