ggcoverage icon indicating copy to clipboard operation
ggcoverage copied to clipboard

Error in stop_if_wrong_length("'seqnames'", ans_len) : 'seqnames' must have the length of the object to construct (1) or length 1

Open sopenaml opened this issue 11 months ago • 4 comments

Hi,

I've encountered the same ERROR than in here when using geom_transcript however geom_gene works, so I'm very confused about it. I would be very grateful if you could help. Below is my GTF and my track_df in case that helps. I'm running ggcoverage_1.4.1 in R-4.3.2.

GRanges object with 2737559 ranges and 22 metadata columns:
            seqnames      ranges strand |   source       type     score
               <Rle>   <IRanges>  <Rle> | <factor>   <factor> <numeric>
        [1]        1 11869-14409      + |   havana gene              NA
        [2]        1 11869-14409      + |   havana transcript        NA
        [3]        1 11869-12227      + |   havana exon              NA
        [4]        1 12010-13670      + |   havana transcript        NA
        [5]        1 12010-12057      + |   havana exon              NA
        ...      ...         ...    ... .      ...        ...       ...
  [2737555]       MT 15888-15953      + |  ensembl transcript        NA
  [2737556]       MT 15888-15953      + |  ensembl exon              NA
  [2737557]       MT 15956-16023      - |  insdc   gene              NA
  [2737558]       MT 15956-16023      - |  ensembl transcript        NA
  [2737559]       MT 15956-16023      - |  ensembl exon              NA

and this is my track_df

  seqnames    start      end width strand score           Type        Group
1        1 35184587 35184588     2      *    53 ctrl1_ipsc_HMW ipscCtrl_HMW
2        1 35184585 35184586     2      *    55 ctrl1_ipsc_HMW ipscCtrl_HMW
3        1 35184578 35184581     4      *    40 ctrl1_ipsc_HMW ipscCtrl_HMW
4        1 35184582 35184582     1      *    42 ctrl1_ipsc_HMW ipscCtrl_HMW
5        1 35184583 35184583     1      *    45 ctrl1_ipsc_HMW ipscCtrl_HMW
6        1 35184584 35184584     1      *    47 ctrl1_ipsc_HMW ipscCtrl_HMW

Thank you very much,

Miriam

sopenaml avatar Jan 29 '25 16:01 sopenaml

Dear @sopenaml, I will take a look at this as soon as I find time.

m-jahn avatar Jan 31 '25 14:01 m-jahn

What is the code you have executed to get this error?

m-jahn avatar Jan 31 '25 16:01 m-jahn

have you found a solution, is this still an issue?

m-jahn avatar Feb 18 '25 15:02 m-jahn

It's still an issue. I have not had the chance to get back to this. The problematic code is:

  data = track_df,
  plot.type = "facet",
  facet.key = "Type",
  group.key = "Group",
  range.position = "out"
) +
   geom_transcript(gtf.gr = gtf_gr, label.vjust = 1.5)

As mentioned in my initial question the following works:

ggcoverage(
  data = track_df,
  plot.type = "facet",
  facet.key = "Type",
  group.key = "Group",
  range.position = "out"
) +
   geom_gene(gtf.gr = gtf_gr, label.vjust = 1.5)

I just wanted to show the transcript annotation under my plot. Thank you for your help!

sopenaml avatar Feb 26 '25 16:02 sopenaml