how to remove description from header?
2
1
Entering edit mode
14 months ago
Sapphire ▴ 10

I have a header like this-

>sp|A0A0H2Z7X0|TPBB_PSEAB Diguanylate cyclase TpbB OS=Pseudomonas aeruginosa (strain UCBPP-PA14) OX=208963 GN=tpbB PE=1 SV=1
MNRRRRYTGSNPSLRRVLYRAHLGVALVAVFTAGLAVTLVGLLTLRAYADPNQQLIARSI
SYTVEAAVVFGDAQAAEESLALIASSEEVSSAIVYDRQGQPLASWHRESTGPLHLLEQQL

And I want my header like this

>A0A0H2Z7X0 
MNRRRRYTGSNPSLRRVLYRAHLGVALVAVFTAGLAVTLVGLLTLRAYADPNQQLIARSI
SYTVEAAVVFGDAQAAEESLALIASSEEVSSAIVYDRQGQPLASWHRESTGPLHLLEQQL

Thank you!

fasta • 657 views
ADD COMMENT
3
Entering edit mode
14 months ago
biofalconch ★ 1.3k

Under the assumption that everything starts with sp:

sed 's/>sp|/>/;s/|.*//' YourSequences.fa > YourNewSequences.fa
ADD COMMENT
0
Entering edit mode

Thanks a lot

ADD REPLY
2
Entering edit mode
14 months ago
bk11 ★ 3.0k

You can use awk too for this propose-

cat yourdata.fasta

>sp|A0A0H2Z7X0|TPBB_PSEAB Diguanylate cyclase TpbB OS=Pseudomonas aeruginosa (strain UCBPP-PA14) OX=208963 GN=tpbB PE=1 SV=1
MNRRRRYTGSNPSLRRVLYRAHLGVALVAVFTAGLAVTLVGLLTLRAYADPNQQLIARSI
SYTVEAAVVFGDAQAAEESLALIASSEEVSSAIVYDRQGQPLASWHRESTGPLHLLEQQL

cat yourdata.fasta |awk 'BEGIN { FS=OFS="|" } /^>/ { print ">" $2; next }1'
>A0A0H2Z7X0
MNRRRRYTGSNPSLRRVLYRAHLGVALVAVFTAGLAVTLVGLLTLRAYADPNQQLIARSI
SYTVEAAVVFGDAQAAEESLALIASSEEVSSAIVYDRQGQPLASWHRESTGPLHLLEQQL
ADD COMMENT

Login before adding your answer.

Traffic: 1599 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6