This keeps the , complete sequence part.
If that is common for all sequences then it could also be removed by doing sed -e 's/gi.*| //g' -e 's/,.*//' input.fa > output.fa
Dear All, please, I would like to modify my Fasta file header:
>gi|51039021|ref|NC_006130.1| Streptococcus pyogenes 71-724 plasmid pDN571, complete sequence
to
> Streptococcus pyogenes 71-724 plasmid pDN571
Please could somebody help?
Many thanks
Simple sed solution
sed -e 's/gi.*| //g' input.fa > output.fa
This keeps the , complete sequence part.
If that is common for all sequences then it could also be removed by doing sed -e 's/gi.*| //g' -e 's/,.*//' input.fa > output.fa
Thank you @Sej , I still have problem since it is a multifasta file. Please how to also remove the bacteria name and just keep
71-724 plasmid pDN571
Thanks
Please post headers of 2+ records in your original post otherwise we are going to have a back and forth as we get additional bits of information from you.
hello guys, i want to change headers in a fasta file from:
>rna18149 gene=LOC103954069 Dbxref=GeneID:103954069,Genbank:XM_009365876.1 Name=XM_009365876.1 gbkey=mRNA product=uncharacterized LOC103954069 transcript_id=XM_009365876.1 gene_biotype=protein_coding
>rna18150 gene=LOC103953996 Dbxref=GeneID:103953996,Genbank:XM_009365794.1 Name=XM_009365794.1 gbkey=mRNA product=non-structural maintenance of chromosomes element 4 homolog A transcript_id=XM_009365794.1 gene_biotype=protein_coding
>rna18151 gene=LOC103953997 Dbxref=GeneID:103953997,Genbank:XM_009365795.1 Name=XM_009365795.1 gbkey=mRNA product=enoyl-[acyl-carrier-protein] reductase [NADH]%2C chloroplastic-like transcript_id=XM_009365795.1 gene_biotype=protein_coding
>rna18152 gene=LOC103954070 Dbxref=GeneID:103954070,Genbank:XM_009365877.1 Name=XM_009365877.1 gbkey=mRNA product=protein NRT1/ PTR FAMILY 7.1-like transcript_id=XM_009365877.1 gene_biotype=protein_coding
to:
>LOC103954069
>LOC103953996
>LOC103953997
>LOC103954070
whould you please give me some tips with sed or awk, thank you!
Log in to answer this question.
Do you want a general purpose solution for multiple files or do you just want this exact fasta modified?
@genomax and @sej, for running a BLAT, Please, I need:
to
Thank you
Question is do ALL of your fasta headers follow that exact format in terms of where the spaces are etc. That is why we need more than one record.
BTW: This request already does not match what you had originally asked.
Try this in mean time:
awk -F " " '{ if ($0 ~ /^>/) { print ">"$6;} else { print $0}}' input.fa | sed -e 's/,//' > output.fa@genomax2, Sorry, I was not very clear in my request. It is in fact a multifasta file for conducting a BLAT.
No need to be sorry but we need additional information to ensure that solutions provided so far will work.
I have to transform:
and so on....
to:
and so on....
Can you try the
awksolution I posted above? It should work. Assumption here is the actual sequence part is left as is.Simple regex for lowercase p followed by 1 or more uppercase/digits should work I think.