Pick contigs from a .fasta file

If you have a genome in a .fasta file and you want to pick out a list of contigs by name, just put the list in a .txt file and fgrep them in a for loop:

for f in $(cat names.txt); do fgrep -A 1 $f genome.fasta >> contigs.fasta; done

Note: make sure that the .fasta file uses only one line per sequence

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s