Question: Fasta file name change: Change contig to annotated name
0
gravatar for taekim009
3.5 years ago by
taekim0090
United States
taekim0090 wrote:

Hello All,

 

I have two files a fasta file with:

>Contig1

atgcatgcatgcaatgcagcga

>Contig2

atagtagtattagcatcgatcgt

>Contig3

atgcagcagcgacg

AND

a text or .csv file with:

Contig1-metalloprotease

Contig2-serpin

Contig3-cystatin

 

Does anyone know how to match and replace:

>Contig1 with >Contig1-metalloprotease

??

 

Any help would be much appreciated. Thanks in advance!

 

 

fasta file assembly • 1.5k views
ADD COMMENTlink modified 3.5 years ago by apelin20470 • written 3.5 years ago by taekim0090
0
gravatar for apelin20
3.5 years ago by
apelin20470
Canada
apelin20470 wrote:

I would just have a table:

Contig1 <tab> Contig1-metallo...

same for all contigs, tab delimited.

Then:

awk 'NR==FNR{array[">"$1]=(">" $1 "-" $2);next} {if($1 in array){$1=array[$1]}}1' Table.file original.fasta > annotated.fasta

ADD COMMENTlink written 3.5 years ago by apelin20470
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: 2286 users visited in the last hour