This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to remove contigs below 201 nuclotide from a genome assembly?

Hi all,

Can anyone tell me how to remove contigs below 201 nucleotides in length from a genome assembly for submission to NCBI - genome is currently in fasta format and created with SOAPdenovo2

Many thanks

genome assembly

2 answers

If you want to do it CLI, there is a program called bioawk (see here) that can do this job easily!

 bioawk -c fastx 'length($seq) >200 {print $name"\n"$seq}' scaffolds.fasta

if you want to print it pretty, then pipe it through fold command!

here, -c is for specifying the input file type (fastx for fasta, fastq etc) filtering criteria is specified as length($seq) >200 which is straight forward and to print the fasta sequence back print $name"\n"$seq}

Hope this helps!

This command line leaves the sequence names without ">" what corrupts the file. Just modify according to bioawk example:

bioawk -c fastx 'length($seq) >200 {print ">"$name"\n"$seq}' scaffolds.fasta

If you have limited bioinformatics skills, I recommend using Bioedit. With it you can sort your contigs by length, and manually exclude those not desirable. Otherwise, you can use this fantastic toolkit: FAST (https://github.com/tlawrence3/FAST).

Log in to answer this question.