Thursday 9 July 2015

Pulling out individual chromosomes from fasta file

This is probably only useful under certain instances, but I thought I would share.

Using sed, you can grab a single chromosome from a fasta file.

sed -n '/>chr1/,/>chr2/p' <fasta>

Note that you can use this to grab multiple consecutive chromosomes too.

sed -n '/>chr1/,/>chr4/p' <fasta>

No comments:

Post a Comment