Gviz: Help figuring out `arguments imply differing number of rows: 0, 1` error
2
2
Entering edit mode
stianlagstad ▴ 90
@stianlagstad-9723
Last seen 4.1 years ago

Hi,

I'm running into an error that I haven't been able to get around. Here's the code needed to reproduce it (the data is available here):

source("https://bioconductor.org/biocLite.R")
biocLite("chimeraviz")

library(chimeraviz)

fc <- importFusioncatcher(filename = 'SRR1559032_out/final-list_candidate-fusion-genes.GRCh37.txt', "hg19", 100)

# Load the results file into a list of fusion objects
fusion <- getFusionById(fc, id = '44')
fusion

# read fastq files with reads for that fusion
fastq1 <- 'SRR1559032_fusion_R1.fq'
fastq2 <- 'SRR1559032_fusion_R2.fq'

# extract the fusion junction sequence
referenceFilename <- "reference.fa"
writeFusionReference(fusion = fusion, filename = referenceFilename)

# map fusion reads to the fusion junction sequence
# align the reads you have against the fusion junction sequence
source(system.file(
  "scripts",
  "rsubread.R",
  package="chimeraviz"))

# create an index for our reference sequence, the fusion junction seq
rsubreadIndex(referenceFasta = referenceFilename)

# align the reads against the reference
# this will create fusionAlignment.bam file
rsubreadAlign(
  referenceName = referenceFilename,
  fastq1 = fastq1,
  fastq2 = fastq2,
  outputBamFilename = "fusionAlignment")

bamfile <- 'fusionAlignment.bam'

# Create Biostrings::DNAStringSet of fusion sequence
fusionSequence <- Biostrings::DNAStringSet(
  x = c(fusion@geneA@junctionSequence,
        fusion@geneB@junctionSequence))
names(fusionSequence) <- "chrNA"

fusionReadsAlignment <- Gviz::AlignmentsTrack(
  bamfile,
  isPaired = TRUE,
  # Setting chromosome to chrNA because this is a fusion sequence not found in
  # any reference genome.
  chromosome = "chrNA",
  name="Fusion Reads",
  genome = fusion@genomeVersion)
# This call leads to the error:
Gviz::plotTracks(
  fusionReadsAlignment,
  chromosome = "chrNA",
  from = 1,
  to = nchar(fusionSequence))
# Error in data.frame(x1 = start(pairGaps) - 1, y1 = gy, x2 = end(pairGaps) +  :arguments imply differing number of rows: 0, 1

# Note that if I set isPaired to FALSE instead, then the plot works (but this is not what we want to do)
fusionReadsAlignment2 <- Gviz::AlignmentsTrack(
  bamfile,
  isPaired = FALSE,
  # Setting chromosome to chrNA because this is a fusion sequence not found in
  # any reference genome.
  chromosome = "chrNA",
  name="Fusion Reads",
  genome = fusion@genomeVersion)
Gviz::plotTracks(
  fusionReadsAlignment2,
  chromosome = "chrNA",
  from = 1,
  to = nchar(fusionSequence))

Is there something wrong with the input data there, or is there something going wrong in gviz?

gviz • 2.3k views
ADD COMMENT
1
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.6 years ago
Switzerland

Looks a lot like a bug to me. 

data.frame(x1 = start(pairGaps) - 1, y1 = gy, x2 = end(pairGaps) +

       1, y2 = gy, col = .dpOrDefault(GdObject, c("col.mates", "col"),

       .DEFAULT_BRIGHT_SHADED_COL), lwd = .dpOrDefault(GdObject,

       c("lwd.mates", "lwd"), 1), lty = .dpOrDefault(GdObject, c("lty.mates",

       "lty"), 1), alpha = .alpha(GdObject, "mates"), stringsAsFactors = FALSE)

The pairGaps GRanges is empty, thus the data.frame constructor chokes. Should be a simple as checking for content in pairGaps. I haven't migrated Gviz to GitHub yet, and the Subversion access does not seem to work anymore. Will need to set these things up first before being able to address the issue.

Florian

ADD COMMENT
0
Entering edit mode

Thank you! :)

ADD REPLY
1
Entering edit mode
Robert Ivanek ▴ 730
@robert-ivanek-5892
Last seen 4 months ago
Switzerland

I fixed that in Bioc version 3.6 and 3.7. The new version of Gviz in both bioc branches should be available in next days. 

Thanks for reporting it.

Robert

 

ADD COMMENT
0
Entering edit mode

Thank you! :)

ADD REPLY

Login before adding your answer.

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