Trim the ID line of a fasta
I have a fasta file with some very silly ID's (straight from NCBI) that look like this:
>KF859747.1 HIV-1 isolate DEURF09UG005 from Uganda gag protein (gag) gene, complete cds; pol protein (pol) gene, partial cds; vif protein (vif), vpr protein (vpr), tat protein (tat), rev protein (rev), vpu protein (vpu), and envelope glycoprotein (env) genes, complete cds; and nonfunctional nef protein (nef) gene, complete sequence
If all I wanted was the >KF859747 part to be in my fasta, are there any nifty one liners to do this on the command line?
• 1,182 views
•
link
2 answers
Something like
cat blabla.fasta | cut -f 1 -d " " > output.fasta
That should keep your FastA sequence, as it simply returns the first column (-f 1) of each row before a single dash (-d " ") .
• 0 views
•
link
same principle but with sed
cat file.fasta | sed 's/ .*//g' > out.fasta
• 0 views
•
link
Log in to answer this question.
In case you are interested in obtaining such headers using a desktop GUI application, you may have a look at our SEDA software (http://www.sing-group.org/seda/). It has different options for processing headers as well as obtaining them using the "Statistics" option. Regards.
Hello SaltedPork!
Commonly asked question. Please search Biostars first in future.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!