Entering edit mode
3.6 years ago
MSRS
▴
590
Hi, 1. My fasta looks like
>AAM01497_1 Glutamate-1-semialdehyde aminotransferase [Methanopyrus kandleri AV19]
MGYEDEFPESLELFKRAERVMPGGVSSPVRRFDPYPFYVERAEGSRLYTVDGHVLIDYCLAFGPLILGHAHPEVVEAVVERVR
>AAM04025_1 glutamate-1-semialdehyde 2,1-aminomutase [Methanosarcina acetivorans C2A]
MVSEVTLDKSRQMYEKAKTLIPGGVSSPVRAIKPYPFYTASADGSKIRDLDGNEYIDYCLAYGPAVLGHNHPVIKAAIKEQLD
I want the output like
>acc|AAM01497|Glutamate-1-semialdehyde aminotransferase [Methanopyrus kandleri AV19]
MGYEDEFPESLELFKRAERVMPGGVSSPVRRFDPYPFYVERAEGSRLYTVDGHVLIDYCLAFGPLILGHAHPEVVEAVVERVR
>acc|AAM04025|glutamate-1-semialdehyde 2,1-aminomutase [Methanosarcina acetivorans C2A]
MVSEVTLDKSRQMYEKAKTLIPGGVSSPVRAIKPYPFYTASADGSKIRDLDGNEYIDYCLAYGPAVLGHNHPVIKAAIKEQLD
Please suggest to me any sed or awk command.
My CSV file looks like
MK0280,GCA_000007185.1,AAM01497.1,430,1-430,430,COG0001,COG0001,0,570.0,1.0e-200,432,3-431 MA_0581,GCA_000007345.1,AAM04025.1,424,1-424,424,COG0001,COG0001,0,574.0,1.0e-200,432,3-426
I want the output like
MK0280,GCA_000007185.1,AAM01497,430,1-430,430,COG0001,COG0001,0,570.0,1.0e-200,432,3-431
MA_0581,GCA_000007345.1,AAM04025,424,1-424,424,COG0001,COG0001,0,574.0,1.0e-200,432,3-426
this time the change needs to just in the third column. I think sed/ awk will work here. Thank you for your assistance.
Right, go ahead and try something.
Unable to figure it out. Need expertise assistance. Thank you.
There are many modules in python, like biopython etc which you can leverage to modify this.
To modify fasta,
Add acc| after >
perl -p -e 's/^>(.*)/>acc|$1/' in.fa > output.fasta
Replace
"_1 "
to|
"_2 "
to|
Any better way?
You don't need any better way. Anything that gives you the output you want is good enough. You are asking a trivial question here, one that can be answered many different ways and using many different tools. Heck, you can load this into any editor or spreadsheet and do a simple
search-and-replace
. I don't think you should be expecting us to put together a highly optimized algorithm for an obscure problem that seems very easy to solve. It is one thing to come asking for help for a difficult problem that you have tried to solve yourself and failed. This feels like you are asking us to pick black olives out of your salad, which you can do fine on your own with some effort.Thank you. As a new commer in this area, we are learning a lot from you experience guy. Sorry.
I don't see how a winking emoji is appropriate in the forum or in this context.