@@ -329,7 +329,11 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
329
329
cat(" --------------------------------------------------\n " )
330
330
cat(" \n " )
331
331
AllComb <- utils :: combn(length(X ), 2 )
332
+ DataTypePheno <- c(DataType , ' Phenotype' )
332
333
ScalingFactor <- rep(0 , ncol(AllComb ))
334
+ names(ScalingFactor ) <- apply(AllComb ,2 , function (x ){
335
+ paste0(DataTypePheno [x [1 ]],' -' ,DataTypePheno [x [2 ]])
336
+ })
333
337
for (i in 1 : ncol(AllComb ))
334
338
{
335
339
# define the pair of matrices
@@ -353,6 +357,10 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
353
357
CombPheno <- utils :: combn(length(X ) + 1 ,2 )
354
358
NonPhenoIndex <- apply(CombPheno , 2 , function (x ){x [2 ] != (length(X ) + 1 )})
355
359
ScalingFactorTemp <- rep(1 , ncol(CombPheno ))
360
+ DataTypePheno <- c(DataType , ' Phenotype' )
361
+ names(ScalingFactorTemp ) <- apply(CombPheno ,2 , function (x ){
362
+ paste0(DataTypePheno [x [1 ]],' -' ,DataTypePheno [x [2 ]])
363
+ })
356
364
ScalingFactorTemp [NonPhenoIndex ] <- ScalingFactor
357
365
ScalingFactor <- ScalingFactorTemp
358
366
# if multi-omics PLS is used
@@ -362,7 +370,12 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
362
370
}
363
371
364
372
cat(" \n " )
365
- cat(' The scaling factor selection is: ' , ScalingFactor , ' \n ' )
373
+ cat(' The scaling factor selection is: ' , ' \n ' )
374
+ cat(" \n " )
375
+ for (i in 1 : length(ScalingFactor ))
376
+ {
377
+ cat(paste0(names(ScalingFactor )[i ]," : " , ScalingFactor [i ]), ' \n ' )
378
+ }
366
379
367
380
} else {
368
381
cat(' single omics analysis, skip scaling factor.' , ' \n ' )
@@ -642,7 +655,7 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
642
655
cat(paste0(' \n ' ))
643
656
for (xx in 1 : length(BestPen ))
644
657
{
645
- cat(paste0(' The best penalty term for omics ' , xx , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
658
+ cat(paste0(' The best penalty term for ' , DataType [ xx ] , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
646
659
}
647
660
cat(paste0(' with testing ' , EvalMethod ,' score = ' , round(AggregatedCVResult $ TestMetric [which.max(AggregatedCVResult $ TestMetric )],3 )), ' \n ' )
648
661
cat(' Now running single-omics PLS with best penalty term on the complete dataset.' , ' \n ' )
@@ -702,7 +715,7 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
702
715
cat(paste0(' \n ' ))
703
716
for (xx in 1 : length(BestPen ))
704
717
{
705
- cat(paste0(' The best penalty term for omics ' , xx , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
718
+ cat(paste0(' The best penalty term for ' , DataType [ xx ] , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
706
719
}
707
720
cat(paste0(' with testing canonical correlation = ' , round(AggregatedCVResult $ RhoTest [which.min(EvalMetric )],3 ),
708
721
' , and prediction error = ' , round(AggregatedCVResult $ DeltaCor [which.min(EvalMetric )],3 )), ' \n ' )
@@ -880,7 +893,7 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
880
893
cat(' \n ' )
881
894
for (xx in 1 : length(X ))
882
895
{
883
- cat(paste0(' The best penalty term for omics ' , xx , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
896
+ cat(paste0(' The best penalty term for ' , DataType [ xx ] , ' after ' , Kfold ,' -fold cross-validation is: ' , BestPen [xx ]), ' \n ' )
884
897
}
885
898
cat(paste0(' and the best penalty term on classifier is: ' , BestPen [length(X ) + 1 ], ' \n ' ))
886
899
cat(paste0(' with testing ' , EvalMethod ,' score = ' , round(AggregatedCVResult $ TestMetric [which.max(AggregatedCVResult $ TestMetric )],3 )), ' \n ' )
@@ -1018,7 +1031,7 @@ fastAutoSmCCNet <- function(X, Y, AdjustedCovar = NULL, preprocess = FALSE, Kfol
1018
1031
cat(" \n " )
1019
1032
cat(" 3. To prevent overwriting result files across projects, rename the result file after each run.\n " )
1020
1033
cat(" \n " )
1021
- cat(" 4. Subnetwork visualization can be done through shinyApp or cytoscape, please refer to network visualization section in multi-omics or single-omics vignette for more detail.\n " )
1034
+ cat(" 4. Subnetwork visualization can be done through shinyApp or cytoscape. Please refer to the network visualization section in the multi-omics or single-omics vignette for more detail. For the Shiny app, visit: https://smccnet.shinyapps.io/smccnetnetwork/ \n " )
1022
1035
cat(" \n " )
1023
1036
cat(" ************************************\n " )
1024
1037
return (list (AdjacencyMatrix = Abar , Data = X , ClusteringModules = OmicsModule , CVResult = AggregatedCVResult ))
0 commit comments