Question: Modifying fasta header
0
gravatar for empyrean999
5.0 years ago by
empyrean999160
Canada
empyrean999160 wrote:

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.

awk unix sed python perl • 2.0k views
ADD COMMENTlink modified 5.0 years ago by Pierre Lindenbaum121k • written 5.0 years ago by empyrean999160
3
gravatar for Pierre Lindenbaum
5.0 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum121k wrote:

is 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

ADD COMMENTlink modified 5.0 years ago • written 5.0 years ago by Pierre Lindenbaum121k

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.

ADD REPLYlink written 5.0 years ago by empyrean999160

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.

ADD REPLYlink written 5.0 years ago by Neilfws48k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1551 users visited in the last hour