I appologize for asking this, but I really am really bad with regex...
Can someone help me transform the headers of my fasta files from this:
>Agaricus_chiangmaiensis|JF514531|SH174817.07FU|reps|k__Fungi;p__Basidiomycota;c__Agaricomycetes;o__Agaricales;f__Agaricaceae;g__Agaricus;s__Agaricus_chiangmaiensis
to this:
>JF514531|SH174817.07FU;tax=d:Fungi,p:Basidiomycota,c:Agaricomycetes,o:Agaricales,f:Agaricaceae,g:Agaricus,s:Agaricus_chiangmaiensis_SH174817.07FU;
seems like I could use the command
sed 's/__/:/g;s/;/,/g;s/.*|/|/g'
to substitute :
for __
, and ,
for ;
. I'm not entirely sure how to proceed from there though...
Thank you
__
with:
and;
with,
. You also seem to be removing some text. Do you always want to remove whatever is before the first|
? And what happened to thereps
? And why isk__Fungi
becomingtax=d:Fungi
instead ofk:Fungi
? We need to know exactly what you are trying to do in order to give an answer that works for you. $\endgroup$