This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sequence extraction

Hello, I have a fasta file that contains sequences of different lengths. I want to extract the base sequences greater than 500 and less than 10000bp and regenerate a fasta file. What should I do? Thanks a lot if anyone can help.

extraction sequence

3 answers

One of the ways to do it is with seqkit:

seqkit seq -M 10000 -m 500 file.fas > new_file.fas
$ bioawk -c fastx '{ml=500;ML=10000;print (length($seq)>ml && length($seq)<ML)? (">"$name"\n"$seq) :""}' test.fna
$ cutadapt --quiet -m 500 -M 10000 test.fna

Using BBMap suite:

reformat.sh in=input.fa out=filterd.fa minlength=500 maxlength=10000

Log in to answer this question.