can't run "spCCA" package on my computer

Hi all,

There's a package called "spCCA" on https://msbi.ipb-halle.de/msbi/spCCA/.
I need to run "getCCA3" function in it. My advisor ran it successfully. (It took a day to get the result.) But on my computer, with the same code, it took 1 minute and showed null results. I tried different computers, with Windows and macOS, and got the same. Does anyone know the possible reason for this?

Hi, and welcome!

A question like this is almost impossible to address without a reproducible example, called a reprex extremely difficult to answer, especially with a package that is only available in source code.

Also, we know nothing about your advisor's system configuration and the configurations of the systems that you've used. I'll try to compile the code, and I'll come back if I'm successful.

1 Like

My data sets are OTUs(operational taxonomic units) and METs(metabolites). Sample size is 137. OTU is a 137 by 175 matrix. MET is a 137 by 731 matrix. Z is a 137 by 3 catagorical 0-1 matrix. They are scaled and without NAs.
Following is part of my data and the result.

install.packages("spCCA")
library("spCCA")

> scX[1:5,1:8]

      Otu001    Otu002     Otu003     Otu004     Otu005     Otu006     Otu007     Otu008
24 -1.127860 -1.155401 -0.8479404 -0.7722523 -0.9398251 -1.0367999 -0.3869777 -0.7955252
68 -1.101447 -1.103471 -0.8334032 -0.7696575 -0.8626867 -0.9723455 -0.3765279 -0.7888179
50 -1.079016 -1.114280 -0.8401778 -0.7722523 -0.8712576 -1.0287908 -0.3689466 -0.7955252
52 -1.092873 -1.106604 -0.8238058 -0.7696575 -0.9181457 -1.0123911 -0.3414903 -0.7955252
32 -1.077791 -1.093289 -0.8156903 -0.7592782 -0.9015080 -0.9750152 -0.3869777 -0.7821106


> newscY[1:5,1:10]

            [,1]        [,2]       [,3]       [,4]       [,5]       [,6]       [,7]       [,8]       [,9]
[1,] -0.25689597 -0.06583109 -0.3033692 -0.3399333 -0.7319339 -0.9358452 -0.2598252 -0.5081042  0.3327363
[2,]  1.23534007  0.05640615 -0.1568638 -0.7552671 -0.5885719 -0.7014474 -1.2953496  1.0138803 -0.3383102
[3,]  0.04242789 -0.93063372 -0.5611901 -0.7552671 -0.1826920 -0.9036287 -0.8488069 -0.1787369 -0.9554043
[4,] -1.05511977 -0.93063372 -0.1299876 -0.7552671  0.9990045 -0.9358452  1.7862043 -0.3545300 -0.9554043
[5,]  0.93774108  1.68284446  0.2460916  0.5018554 -0.1561209  1.0407578  0.9984070  0.3147964  1.3159508
          [,10]
[1,]  2.4942030
[2,]  0.8819917
[3,] -0.4450216
[4,] -0.8208717
[5,]  3.1181910

> scZ[1:5,]

     numdiabetes oralhealthvar1 oralhealthvar2
[1,]  -1.0640955     -0.6968215     -0.7317029
[2,]   0.9329057     -0.6968215      1.3566992
[3,]  -1.0640955     -0.6968215     -0.7317029
[4,]  -1.0640955     -0.6968215     -0.7317029
[5,]  -1.0640955      1.4246128     -0.7317029

> getCCA3(scX[1:5,1:8], newscY[1:5,1:10], scZ[1:5,])

$cc3.weight.x
      
Otu001
Otu002
Otu003
Otu004
Otu005
Otu006
Otu007
Otu008

$cc3.weight.y
     
 [1,]
 [2,]
 [3,]
 [4,]
 [5,]
 [6,]
 [7,]
 [8,]
 [9,]
[10,]

$cc3.weight.z
              
numdiabetes   
oralhealthvar1
oralhealthvar2

$cc3.CV.x
  
24
68
50
52
32

$cc3.CV.y
  
24
68
50
52
32

$cc3.CV.z
  
24
68
50
52
32

$corr
NULL

$lambda
    
[1,]
[2,]
[3,]

$num.CV
[1] 10
1 Like

Thanks, but I need more help. :grinning:

I am not a bioscientist. While I can assemble the functions in the spCCA source files, I don't know how to construct scX. I've looked at other OTUs, but can't map them to yours.

Can you run the getCCA3 function successfully? Or did you get the same null result as mine?

No, I can't because I don't have any suitable data to run it on, and I can't create one, because I can't find any examples of its structure.

Do you mind running the following code and see if it works? I use the data above.

install.packages("reshape")
library("reshape")
library("spCCA")

a=melt(scX[1:5,1:8])[,3]
b=as.matrix(a)
otu=matrix(b, nrow = 5)    #scX[1:5,1:8]

c=melt(newscY[1:5,1:10])[,3]
d=as.matrix(c)
met=matrix(d,nrow=5)    #newscY[1:5,1:10]

e=melt(scZ[1:5,])[,3]
f=as.matrix(e)
zz=matrix(f,nrow=5)   #scZ[1:5,]

getCCA3(otu,met,zz)

Sorry to be obtuse. I need 'scX` or some object that looks like it to try that.

Here is the new code.

library("spCCA")

a=c(-0.3200379, -0.7138482, -0.8628071, -0.3220143, -0.7079053, -0.9425601, -0.5555740, -0.6663740
    ,-0.3187421, -0.6880427, -0.8462656, -0.3896728, -0.6960597, -0.8978755, -0.6301385, -0.6601400
    ,-0.3155027, -0.6688058, -0.8533548, -0.3591386, -0.6960597, -0.9299319, -0.5860085, -0.6705301
    ,-0.3232774, -0.7035260, -0.8423271, -0.3876957, -0.6207557, -0.9066182, -0.6057909, -0.6466329
    ,-0.3009251, -0.7082179, -0.8407517, -0.3433223, -0.5564513, -0.8852473, -0.4992702, -0.6393599)
otu=matrix(as.matrix(a),ncol=8,byrow = T)

b=c(-0.25689597, -0.06583109, -0.3033692, -0.3399333, -0.7319339, -0.9358452, -0.2598252, -0.5081042,  0.3327363
    ,1.23534007,  0.05640615, -0.1568638, -0.7552671, -0.5885719, -0.7014474, -1.2953496,  1.0138803, -0.3383102
    ,0.04242789, -0.93063372, -0.5611901, -0.7552671, -0.1826920, -0.9036287, -0.8488069, -0.1787369, -0.9554043
    ,-1.05511977, -0.93063372, -0.1299876, -0.7552671,  0.9990045, -0.9358452,  1.7862043, -0.3545300, -0.9554043
    ,0.93774108,  1.68284446,  0.2460916,  0.5018554, -0.1561209,  1.0407578,  0.9984070,  0.3147964,  1.3159508
    ,2.4942030    ,0.8819917    ,-0.4450216    ,-0.8208717    ,3.1181910)
met=matrix(as.matrix(b),nrow=5,byrow = T)

c=c( -1.0640955  ,  -0.6968215 ,    -0.7317029
     ,   0.9329057  ,   -0.6968215   ,   1.3566992
     , -1.0640955  ,   -0.6968215  ,   -0.7317029
     ,-1.0640955  ,   -0.6968215  ,   -0.7317029
     ,-1.0640955  ,    1.4246128  ,   -0.7317029)
zz=matrix(as.matrix(c),nrow=5,byrow = T)

getCCA3(otu,met,zz)

My output is blank still.

$`cc3.weight.x`
    
[1,]
[2,]
[3,]
[4,]
[5,]
[6,]
[7,]
[8,]

$cc3.weight.y
     
 [1,]
 [2,]
 [3,]
 [4,]
 [5,]
 [6,]
 [7,]
 [8,]
 [9,]
[10,]

$cc3.weight.z
    
[1,]
[2,]
[3,]

$cc3.CV.x
    
[1,]
[2,]
[3,]
[4,]
[5,]

$cc3.CV.y
    
[1,]
[2,]
[3,]
[4,]
[5,]

$cc3.CV.z
    
[1,]
[2,]
[3,]
[4,]
[5,]

$corr
NULL

$lambda
    
[1,]
[2,]
[3,]

$num.CV
[1] 10
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.