Error in normSplitFactor(f, x)
1
0
Entering edit mode
mictadlo ▴ 10
@mictadlo-10885
Last seen 4.8 years ago

Hi, I found the below code here:

> library(GenomicRanges)
> library(rtracklayer)
> library(Rsamtools)
Loading required package: Biostrings
Loading required package: XVector
> 
> GFFfile = "snap_augustus.gff"
> FASTAfile = "genome_29155.faa"
> 
> #Load the annotation and reduce it
> GFF <- import.gff(GFFfile, format="gff", feature.type="exon")
> head(GFF)
GRanges object with 6 ranges and 6 metadata columns:
              seqnames         ranges strand |   source     type     score     phase                        ID
                 <Rle>      <IRanges>  <Rle> | <factor> <factor> <numeric> <integer>               <character>
  [1] lcl|ScwjSwM_3729 [15533, 15536]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:210
  [2] lcl|ScwjSwM_3729 [14631, 14650]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:209
  [3] lcl|ScwjSwM_3729 [12563, 14608]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:208
  [4] lcl|ScwjSwM_3729 [11160, 11346]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:207
  [5] lcl|ScwjSwM_3729 [10840, 10985]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:206
  [6] lcl|ScwjSwM_3729 [10109, 10739]      - |    maker     exon      <NA>      <NA> sp0000001-mRNA-1:exon:205
                Parent
       <CharacterList>
  [1] sp0000001-mRNA-1
  [2] sp0000001-mRNA-1
  [3] sp0000001-mRNA-1
  [4] sp0000001-mRNA-1
  [5] sp0000001-mRNA-1
  [6] sp0000001-mRNA-1
  -------
  seqinfo: 4724 sequences from an unspecified genome; no seqlengths
> 
> grl <- reduce(split(GFF, elementMetadata(GFF)$gene_id))

Unfortunately it produce the following error:

Error in normSplitFactor(f, x) : 
  split factor has length 0 but 'NROW(x)' is > 0

My GFF file looks like this:

lcl|ScwjSwM_3729        maker   gene    9131    15536   .       -       .       ID=sp0000001;Name=sp0000001
lcl|ScwjSwM_3729        maker   mRNA    9131    15536   .       -       .       ID=sp0000001-mRNA-1;Parent=sp0000001;Name=sp0000001-mRNA-1;_AED=0.28;_eAED=0.28;_QI=0|0|0|0.14|1|1|7|0|1016
lcl|ScwjSwM_3729        maker   exon    15533   15536   .       -       .       ID=sp0000001-mRNA-1:exon:210;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    14631   14650   .       -       .       ID=sp0000001-mRNA-1:exon:209;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    12563   14608   .       -       .       ID=sp0000001-mRNA-1:exon:208;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    11160   11346   .       -       .       ID=sp0000001-mRNA-1:exon:207;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    10840   10985   .       -       .       ID=sp0000001-mRNA-1:exon:206;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    10109   10739   .       -       .       ID=sp0000001-mRNA-1:exon:205;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   exon    9131    9147    .       -       .       ID=sp0000001-mRNA-1:exon:204;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     15533   15536   .       -       0       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     14631   14650   .       -       2       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     12563   14608   .       -       0       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     11160   11346   .       -       0       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     10840   10985   .       -       2       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     10109   10739   .       -       0       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1
lcl|ScwjSwM_3729        maker   CDS     9131    9147    .       -       2       ID=sp0000001-mRNA-1:cds;Parent=sp0000001-mRNA-1

What did I miss?

Thank you in advance

GenomicRanges rtracklayer goseq • 1.6k views
ADD COMMENT
2
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

I guess we could make this more obvious but the problem is that there is no gene_id column.

ADD COMMENT
0
Entering edit mode

Thank you: `grl <- reduce(split(GFF, elementMetadata(GFF)$ID))`

ADD REPLY

Login before adding your answer.

Traffic: 620 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