sed: Cut text string off select sequences

Had some unwanted text on the end of sequence names in a fasta file (it was originally added by Jalview). Couldn’t stop Jalview from doing this, but could remove it with the cut utility in Ubuntu.

>RS530/unwanted-stuff.onEnd
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS533/unwanted-stuff.onEnd
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS535
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS596
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
##Uses 'cut' utility to remove everything after seq name (or'/')
cut -d '/' -f1 <filename.fasta> output.fasta
>RS530
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS533
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS535
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
>RS596
CTAGCTGACTGACTAGCTGCAGCTGACTAGCTAG
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