LuChenLab / SCAPE

Single Cell Alternative Polyadenylation using Expectation-maximization
MIT License
7 stars 2 forks source link

Annotation.R strand(x) may have length >1 when a transcript has multiple exons. #8

Open pratibhajagannatha opened 1 year ago

pratibhajagannatha commented 1 year ago

Hi all,

I was using the Annotation.R script for running AnnotationSite as shown on the differential APA tutorial and ran into an error when creating an Rds file for the annotation (gtf). I tried it with the gtf provided in the tutorial and my own. I believe the issue is with line 74 (the following function):

x <- lapply(exons_grl, function(x) {
      exonrank <- length(x$exon_rank)
      if (as.character(strand(x)) == "+") {
        x[exonrank]
      } else{
        x[1]
      }

When a transcript has multiple exons, if (as.character(strand(x)) == "+") causes an error. When a transcript has multiple exons, as.character(strand(x)) has length >1 and is cannot be compared with "+." I solved the issue by replacing as.character(strand(x)) with as.character(unique(strand(x))). For reference, I am using the following versions of packages:

GenomicRanges 1.50.0 GenomicFeatures 1.50.2 annotate 1.24.0 GenomicAlignments 1.34.0

zhou-ran commented 1 year ago

Hi,

Thanks for your debug, we will update a new version for this.

Ran