stianlagstad / chimeraviz

chimeraviz is an R package that automates the creation of chimeric RNA visualizations.
37 stars 14 forks source link

plotFusionReads fails if junctionSequence is empty #17

Closed plijnzaad closed 6 years ago

plijnzaad commented 6 years ago

I had hoped that the plotFusionReads would infer the junction sequence, but in my case fusion@gene{A,B}@junctionSequence was never set (using STAR-fusion, I guess I'll have to run it with Trinity first). If would be nice if function is.nucleotideAmount.valid would return immediately (with an clear message) if fusionJunctionSequenceLength has length zero (in most cases that would be because they weren't loaded. Below is code that implements this.

BTW, is there a way to issue pull requests? I see that the code has moved to Bioconductor, but that is not (as far as I can see ) on a platform that can deal with pull requests.

is.nucleotideAmount.valid <- function(argument_checker, nucleotideAmount, fusion) {

  fusionJunctionSequenceLength <-
    length(fusion@geneA@junctionSequence) +
    length(fusion@geneB@junctionSequence)

  if (fusionJunctionSequenceLength == 0 ) {
      ArgumentCheck::addError(
      msg = "length of junction sequence is 0, have they been determined?",
      argcheck = argument_checker
      )
  }

  if (class(nucleotideAmount) != "numeric" ||
      nucleotideAmount <= 0 ||
      nucleotideAmount > fusionJunctionSequenceLength) {
    ArgumentCheck::addError(
      msg = paste0("'nucleotideAmount' must be a numeric larger > 0  ",
                   "and <= fusion junction sequence length."),
      argcheck = argument_checker
    )
  }

  argument_checker
}
stianlagstad commented 6 years ago

Thank you again, @plijnzaad! I can give dealing with multiple origins another chance so that you can create pull requests here. I'll update here when I've figured it out or given it up again.. :)

stianlagstad commented 6 years ago

That should do it! Now the code is here on Github again, and you can create a pull request :)