Skip to content

subscript out of bounds for fastAutoSmCCNet #2

@aliibarry

Description

@aliibarry

Hi,

I can run fastAutoSmCCNet on the example data, but haven't managed to run it on any other matrices (real or random). Same error each time, which I haven't been able to trace back. Any insights would be much appreciated.

Reprex with random matrixes:

n_rows <- 7756
n_cols <- 10 #trialled a few values here, all errored

# Generate random data for both matrices
data1 <- matrix(runif(n_rows * n_cols, min = 0, max = 200), nrow = n_rows, ncol = n_cols)
data2 <- matrix(runif(n_rows * n_cols, min = 0, max = 20), nrow = n_rows, ncol = n_cols)

row_names <- paste0("GEN", seq_len(n_rows))
col_names <- paste0("samp_", seq_len(n_cols))

dimnames(data1) <- list(row_names, col_names)
dimnames(data2) <- list(row_names, col_names)

X <- list(data1, data2)
str(X)

List of 2
$ : num [1:7756, 1:10] 188.09 9.11 105.62 178.48 110.29 ...
..- attr(, "dimnames")=List of 2
.. ..$ : chr [1:7756] "GEN1" "GEN2" "GEN3" "GEN4" ...
.. ..$ : chr [1:10] "samp_1" "samp_2" "samp_3" "samp_4" ...
$ : num [1:7756, 1:10] 12.67 10.42 18.5 5.52 7.38 ...
..- attr(
, "dimnames")=List of 2
.. ..$ : chr [1:7756] "GEN1" "GEN2" "GEN3" "GEN4" ...
.. ..$ : chr [1:10] "samp_1" "samp_2" "samp_3" "samp_4" ...

#mimic structure for Y
values <- sample(c(0, 1), size = n_cols, replace = TRUE)
Y <- matrix(values, nrow = n_cols, ncol = 1)
colnames(Y) <- "Pheno"
rownames(Y) <- paste0("Samp_", seq_len(n_cols))
result <- fastAutoSmCCNet(X = X, Y = Y,
                           preprocess = TRUE,
                           Kfold = 4, 
                           subSampNum = 80,
                           DataType = c('rna', 'protein'),
                           CutHeight = 1 - 0.1^10,
                           saving_dir = getwd(),
                           EvalMethod = 'auc',
                           min_size = 4,
                           summarization = 'NetSHy',
                           BetweenShrinkage = 5,
                           ncomp_pls = 3)

Resulting output, tried from n_cols 5 to 400 to see if it was a sample issue

**********************************
* Welcome to Automated SmCCNet! *
**********************************


--------------------------------------------------
>> Starting data preprocessing...
--------------------------------------------------

This project uses multiomics CCA 

--------------------------------------------------
>> Now determining the scaling factor for multi-omics analysis...
--------------------------------------------------


The scaling factor selection is:  

rna-protein: 0.00534874045183213 
rna-Phenotype: 1 
protein-Phenotype: 1 

--------------------------------------------------
>> Determining the best penalty selection through cross-validation...
--------------------------------------------------

Error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `Y[foldIdx[[x]], ]`:
! subscript out of bounds
Run `rlang::last_trace()` to see where the error occurred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions