This is a test version of Biostars. For the public version, visit https://www.biostars.org.
convert Trinotate resulte to GFF file

how i can convert Trinotate result to GFF file also how i can replace gene name in gff file by another annotation example thse is the GFF file

 MA_CS_1000      transdecoder    mRNA    1       3238    .       - ID=MA_CS_1000.p1;Parent=GENE.MA_CS_1000~~MA_CS_1000.p1;Name=ORF%20type%3Acomplete%20len%3A560%20%28-%29%2Cscore%3D45.62

and thise is the annotation file

   MA_CS_1000.p1 ,  Zinc finger C2H2-like

i want match those id to the Gff and change Gene_Name by colmne 2 in the Gff file any help !

desired output

MA_CS_1000      transdecoder    mRNA    1       3238    .       - ID=MA_CS_1000.p1;Parent=GENE.MA_CS_1000~~MA_CS_1000.p1;Name=Zinc%finger%C2H2-like
rna-seq bash annotation

Hello Mostafa,

please rephrase your question. To me it looks like you're asking two things.

  1. How to convert Trinotate output to a GFF file
  2. How to replace a column in a GFF file based on informations in another file

It is very good to always provide an example of the input files and the desired output based on this examples.

In the examples you gave ,above I cannot see any overlap.

Regarding this note makes it much more probably to receive an answer in short time.

Thanks.

fin swimmer

Thanks fin for replay i have just two one tabulated and another is GFF i want replace anntoations in tab file to the GFF file by change the gene name

Hello Mostafa,

better but still many things that are unclear.

In the annotation file the values are comma seperated. Is there a whitespace before the first comma (this is important!)?

The first part in the annotation file (until the comma) should match the value of ID in the last column of your gff file? The value for Name in the last column should be replaced by anything that followed the ID in the annotation file? Why is the comma URL encoded but the whitespace not? Is it necessary?

fin swimmer

Please also answer the rest of my questions.

Please use the ADD REPLY Button to reply to a comment/answer. Answers are only meant for (full) answers to the original question. So I moved your post to a comment. As you can see this is not perfect.

Also note that I changed my command a little bit, to make sure that also line to which no changes where made are printed.

fin swimmer

second question is how to convert Trinotate.xls to gff do you have any idea.

Cite from this post:

Please use the ADD REPLY Button to reply to a comment/answer. Answers are only meant for (full) answers to the original question.

Cite from this post:

It is very good to always provide an example of the input files and the desired output based on this examples.

[...]

Regarding this note makes it much more probably to receive an answer in short time.

second question is how to convert Trinotate.xls to gff do you have any idea.

I'm personally not a fan of including these functional annotations in a GFF file format. GFF is messy enough as it is without adding all this data

1 answer

Hello Mostafa,

you haven't answer my questions, so I had to make some guesses.

Input files:

$ cat annotation.txt
MA_CS_1000.p1,Zinc finger C2H2-like


$ cat input.gff
MA_CS_1000      transdecoder    mRNA    1       3238    .       - ID=MA_CS_1000.p1;Parent=GENE.MA_CS_1000~~MA_CS_1000.p1;Name=ORF%20type%3Acomplete%20len%3A560%20%28-%29%2Cscore%3D45.62

Command:

$  awk 'NR==FNR {split($0, ann,","); new[ann[1]]=ann[2]; next;} { match($0, /ID=([^;]+);/, id); if(id[1] in new) {gsub("Name=[^;]*", "Name="new[id[1]])} print}' > output.gff

Output:

$ cat output.gff
MA_CS_1000      transdecoder    mRNA    1       3238    .       - ID=MA_CS_1000.p1;Parent=GENE.MA_CS_1000~~MA_CS_1000.p1;Name=Zinc finger C2H2-like

fin swimmer

Log in to answer this question.