The space thing worked. Thanks for the tip. I just substituted in vim using space . Unfortunately i cannot change the upstream flow as this itself is starting file which was given to me.
Modifying fasta header
I have strange fasta headers like this for some good number of sequences,
>gi|61221638|sp|P0A366.1| >gi|61221640|sp|P0A368.1|CR1AA_BACTE RecName: Full= protein synthase>gi|40267|emb|CAA31886.1| unnamed protein product
HTSIDGRPINQGNFSATMSSGSNLQSGSFRTVGFTTPFNFSNGSSVFTLSAHVFNSGNEVYIDRIEFVPAEVTFEAEYDLERAQKAVNELFTSSNQIGLKTDVTDYHIDQVSNLVECLSDEFCLDEKQELSEKVKHAKRLSDERNLLQDPNFRGINRQLDRGWRGSTDITIQGGDDVFKENYVTLLGTFDECYPTYLYQKIDESKLKAYTRYQLRGYIEDSQDLEIYLIRYNAKHETVNVPGTGSLWPLSAQSPIGKCGEPNRCAPHLEWNPDLDCSCRDGEKCAHHSHHFSLDIDVGCTDLNEDLGVWVIFKIKTQDGHARLGNLEFLEEKPLVGEALARVKRAEKKWRDKREKLEWETNIVYKEAKESVDALFVNSQYDQLQADTNIAMIHAADKRVHSI
I would like to replace the other (>gi) in the fasta header to blank or ;. Can anyone suggest how to do it. I have many such sequences in a big fasta file.
• 3,860 views
•
link
1 answer
If the symbol before the second > is a space, just:
cut -d ' ' -f 1 in.fasta > out.fasta
But imho, if your fasta headers are broken, you'd better check your upstream workflow
• 0 views
•
link
• 1 views
•
link
You should at least inform whoever gave it to you that what they gave you was not valid fasta. This kind of error is just a waste of everyone's time and should be fixed.
• 0 views
•
link
Log in to answer this question.