Number of blocks for circosPlot

Issue #69 resolved
Former user created an issue

Hello,

While I was making a 2-blocks analysis, I tried to use the circosPlot function but I kept getting :

Error in `*tmp*`[[i]] : subscript out of bounds

So I decided to look in the function code and found out that circosPlot was only available for analysis with 3+ blocks. However, the function is not checking this condition correctly because the error wasn't raised with my 2-block analysis. My guess would be that it needs to be :

  if (length(object$X) <= 2) 
    stop("This function is only available when there are more than 3 blocks")

instead of

  if (length(object$X) <= 1) 
    stop("This function is only available when there are more than 3 blocks")

Thanks for the awesome package and have a nice day.

Comments (7)

  1. Florian Rohart

    Hi there Anonymous,

    Sorry for the delay. I first changed the code according to your comment as it seemed fair, but later realised that I probably should not have.

    The circosPlot function is indeed only available for a block.splsda object with more 3 blocks (at least 2 blocks in object$X and an outcome in object$Y). If you have less than 2 blocks in object$X, then it means that you probably could have used a plsda approach. CircosPlot is -so far- not available for plsda approach as the graph would only show links between variables of the same dataset. It is however something we can develop if that would interest you.

    If I'm wrong on your analysis, and you do have 2 blocks in object$X and an outcome in object$Y, then it means the error is coming from somewhere else in the code and I will be happy to follow up with you on that.

    Thank you for using mixOmics and for creating this issue :)

    Florian

  2. Merwann Selmani

    Hi Florian, Thanks for your quick answer.

    I am actually in the case where I have two datasets in object$X and an outcome in object$Y, here's what I get when debugging :

    bug.PNG

    (I'm exactly in a case like on this paper with a transcriptomics and a proteomics dataset and a categorical outcome)

    The code breaks on this loop :

      for (i in 1:length(cord)) {
        for (j in 1:length(cord)) {
          simMatList[[i]][[j]] = cord[[i]] %*% t(cord[[j]])
        }
      }
    

    length(cord) is 160 in my case and simMatList is a List of length 2 so when i goes to 3 in the loop it throws a "subscript out of bounds error"

    When using 4 datasets, length(cord) is 4 and everything works.

    I hope I provided you with enough information.

    Merwann

  3. Florian Rohart

    Hi Merwann,

    Do you have any NA is your data, object$loadings or object$variates ? I'm asking because 'cord' should indeed be a list of length 2 (your number of blocks), so something must be happening when calculating 'cord', but I don't really see what..

    Feel free to send us an email at mixomics(at)math.univ-toulouse.fr for easier follow up (and you can also provide us with a bit of your data that lead to this bug, it will stay confidential and will only be used for debugging)

  4. Merwann Selmani

    Hi,

    No NAs in my data, object$loadings, or object$variates. 'cord' is a matrix of size (80,2) even though the arguments to the mapply function are all (large) lists of 2. The only reason I see mapply returning something that's not a list is the 'SIMPLIFY' argument that is set to TRUE by default and actually when setting 'SIMPLIFY' to FALSE in my case mapply gives me a list of length 2. So I modified the circosPlot function and now it works with two blocks (in my case at least) and still works with more.

    I don't know if this is the "right" answer but it worked and I will happily continue by email if you think it's still necessary.

    Merwann

  5. Florian Rohart

    Hi Merwann,

    Happy to see you figured out a fix :) However, if you don't mind I'd like to understand more what was wrong. Would you be ok sending me just a part of your data that makes the code break?

    Otherwise I'll add your modification in and test that it's not breaking anything else :)

    Thank you

  6. Log in to comment