How can I convert GFF3 to GFF file using rtracklayer package?
1
0
Entering edit mode
9.6 years ago

Hi everyone. I'm trying to convert a GFF3 annotation file to GFF format, using the command lines below on rtracklayer package, but I'm not successfull. Does anyone could help me with this? I'm new on R.

annotation_path <- system.file("annotation", package = "rtracklayer")
annotation_gff3 <- file.path(test_path, "TrireRUTC30_1_GeneCatalog_genes_20110526.fix2.gff3")
test <- import(annotation_gff3)
export(test,"annotation.gtf","gtf")

Thanks a lot!

Gustavo P.

R RNA-Seq • 5.5k views
ADD COMMENT
0
Entering edit mode

I've tried this, but I can't find any GFF output file. I have to set a directory for the output file? Sorry about my inexperience. I'm a master student and I'm trying to convert this file to use as a object in the rsubread package.

> annotation<- import("TrireRUTC30_1_GeneCatalog_genes_20110526.fix2.gff3")
> annotation
GRanges with 76358 ranges and 7 metadata columns:
                           seqnames         ranges strand   |   source
                              <Rle>      <IRanges>  <Rle>   | <factor>
      [1] TrireRUTC30_1_scaffold_23 [44782, 45986]      -   |      JGI
      [2] TrireRUTC30_1_scaffold_23 [44782, 45986]      -   |      JGI
      [3] TrireRUTC30_1_scaffold_23 [44782, 45549]      -   |      JGI
      [4] TrireRUTC30_1_scaffold_23 [45634, 45819]      -   |      JGI
      [5] TrireRUTC30_1_scaffold_23 [45921, 45986]      -   |      JGI
      ...                       ...            ...    ... ...      ...
  [76354] TrireRUTC30_1_scaffold_47 [22225, 23399]      -   |      JGI
  [76355] TrireRUTC30_1_scaffold_47 [22225, 23275]      -   |      JGI
  [76356] TrireRUTC30_1_scaffold_47 [23359, 23399]      -   |      JGI
  [76357] TrireRUTC30_1_scaffold_47 [22225, 23275]      -   |      JGI
  [76358] TrireRUTC30_1_scaffold_47 [23359, 23399]      -   |      JGI
              type     score     phase                      ID
          <factor> <numeric> <integer>             <character>
      [1]     gene      <NA>      <NA>           e_gw1.23.89.1
      [2]     mRNA      <NA>      <NA>         e_gw1.23.89.1-T
      [3]     exon      <NA>      <NA>      e_gw1.23.89.1-T-E1
      [4]     exon      <NA>      <NA>      e_gw1.23.89.1-T-E2
      [5]     exon      <NA>      <NA>      e_gw1.23.89.1-T-E3
      ...      ...       ...       ...                     ...
  [76354]     mRNA      <NA>      <NA>    fgenesh1_pg.47_#_6-T
  [76355]     exon      <NA>      <NA> fgenesh1_pg.47_#_6-T-E1
  [76356]     exon      <NA>      <NA> fgenesh1_pg.47_#_6-T-E2
  [76357]      CDS      <NA>         1  fgenesh1_pg.47_#_6-T-P
  [76358]      CDS      <NA>         0  fgenesh1_pg.47_#_6-T-P
                        Name               Parent
                 <character>      <CharacterList>
      [1]      e_gw1.23.89.1                     
      [2]      e_gw1.23.89.1        e_gw1.23.89.1
      [3]               <NA>      e_gw1.23.89.1-T
      [4]               <NA>      e_gw1.23.89.1-T
      [5]               <NA>      e_gw1.23.89.1-T
      ...                ...                  ...
  [76354] fgenesh1_pg.47_#_6   fgenesh1_pg.47_#_6
  [76355]               <NA> fgenesh1_pg.47_#_6-T
  [76356]               <NA> fgenesh1_pg.47_#_6-T
  [76357]               <NA> fgenesh1_pg.47_#_6-T
  [76358]               <NA> fgenesh1_pg.47_#_6-T
  ---
  seqlengths:
    TrireRUTC30_1_scaffold_23 ...  TrireRUTC30_1_scaffold_47
                           NA ...                         NA
> export.gff2(annotation, "TrireRUTC30_1_GeneCatalog_genes_20110526.fix2.gff3")
ADD REPLY
0
Entering edit mode

but I can't find any GFF output file. I have to set a directory for the output file?

No, the files will be created in your working directory, but you are using the same filename of the input file and therby overwriting it:

export.gff2(annotation, "TrireRUTC30_1_GeneCatalog_genes_20110526.fix2.gff3")
                                                                      ^___^

should it be .gff2?

ADD REPLY
1
Entering edit mode
9.6 years ago
Michael 54k

Try export.gff2

ADD COMMENT
0
Entering edit mode

Thanks Michael for help me! I have tried to do what you said me, but it didn't work. So, I try to use the gffread function from cufflinks package and finally it worked. For who wants to convert GFF3 to GTF, I recommend using the command line below:

gffread my.gff3 -T -o my.gtf
ADD REPLY

Login before adding your answer.

Traffic: 1754 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6