Edit FASTA header
I want to remove part of the header of all my sequences in a fasta file, so only the Otu number appears as the header.
So from:
>M02300_51_000000000-CJMTC_1_1115_17014_15334 Otu0001
T-AC--GG-AG-GGT---GCA-A-G-C--G-T-T--AA-T-CGG-AA--TT-A-C-TI would like to change it to:
>Otu0001
T-AC--GG-AG-GGT---GCA-A-G-C--G-T-T--AA-T-CGG-AA--TT-A-C-TI believe this should be possible with the sed command but haven't been able to make it work. Any help would be great! Thank you in advance.
1 Answer
I don't know anything about the structure of FASTA, but if the substring Otu cannot appear anywhere else in the header, then
sed 's/^>.*Otu/>Otu/' file.fastashould do it
1