Error in -create.label(meta = meta, label = "Sex", case = "F")
0
0
Entering edit mode
Cinque • 0
@abe06798
Last seen 9 months ago
Italy

I've the following code:

library(SIAMCAT)
library(phyloseq)
library(microbiome)

# Load my data
load("~/Data/PSM.RData")

# Same taxaonomic rank
pseq_genus <- phyloseq::tax_glom(psm, taxrank = "Genus")

# Log10 normalization
feat <- abundances(pseq_genus)
feat <- log10(feat + 1)

# My MetaData
meta <- pseq_genus@sam_data
meta <- data.frame(meta[,c("Sex", "AgeYrs", "Site", "Smoking", "BioProject", "size_MB")])
label.meta <- - create.label(meta=meta,
                             label="Sex", case="female") 

The error:

Label used as case:
   female
Label used as control:
   male
+ finished create.label.from.metadata in 0.001 s
Error in -create.label(meta = meta, label = "Sex", case = "female") : 
  invalid argument to unary operator

Here my datasets summary:

 > str(feat)
     num [1:134, 1:148] 3.37 0 0 2.22 0 ...
     - attr(*, "dimnames")=List of 2
      ..$ : chr [1:134] "OTU_001_Genus_Streptococcus" "OTU_002_Genus_Porphyromonas" "OTU_003_Genus_Prevotella_7" "OTU_004_Genus_Fusobacterium" ...
      ..$ : chr [1:148] "ERR494388" "ERR494389" "ERR494391" "ERR494392" ...
 > str(meta)
    'data.frame':   148 obs. of  6 variables:
     $ Sex       : Factor w/ 2 levels "female","male": 1 1 1 1 1 1 1 1 1 1 ...
     $ AgeYrs    : int  41 41 56 56 19 19 44 44 46 46 ...
     $ Site      : chr  "Subgingival" "Plaque" "Subgingival" "Plaque" ...
     $ Smoking   : chr  NA NA NA NA ...
     $ BioProject: chr  "PRJEB6047" "PRJEB6047" "PRJEB6047" "PRJEB6047" ...
     $ size_MB   : chr  "7" "19" "18" "9" ...

sessionInfo()

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] it_IT.UTF-8/it_IT.UTF-8/it_IT.UTF-8/C/it_IT.UTF-8/it_IT.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] microbiome_1.14.0 ggplot2_3.3.5     SIAMCAT_1.99.3    phyloseq_1.36.0   mlr3_0.13.3      

loaded via a namespace (and not attached):
  [1] nlme_3.1-157           matrixStats_0.61.0     bitops_1.0-7           progress_1.2.2         RColorBrewer_1.1-2    
  [6] bbotk_0.5.2            PRROC_1.3.1            GenomeInfoDb_1.28.4    numDeriv_2016.8-1.1    mlr3learners_0.5.2    
 [11] tools_4.1.0            backports_1.4.1        utf8_1.2.2             R6_2.5.1               vegan_2.5-7           
 [16] DBI_1.1.2              BiocGenerics_0.38.0    mgcv_1.8-39            colorspace_2.0-3       permute_0.9-7         
 [21] rhdf5filters_1.4.0     ade4_1.7-18            withr_2.5.0            mlr3misc_0.10.0        prettyunits_1.1.1     
 [26] tidyselect_1.1.2       gridExtra_2.3          compiler_4.1.0         glmnet_4.1-3           cli_3.2.0             
 [31] Biobase_2.52.0         lgr_0.4.3              scales_1.1.1           checkmate_2.0.0        palmerpenguins_0.1.0  
 [36] mlr3tuning_0.12.1      stringr_1.4.0          digest_0.6.29          minqa_1.2.4            paradox_0.8.0         
 [41] XVector_0.32.0         pkgconfig_2.0.3        parallelly_1.30.0      lme4_1.1-28            rlang_1.0.2           
 [46] rstudioapi_0.13        shape_1.4.6            generics_0.1.2         jsonlite_1.8.0         dplyr_1.0.8           
 [51] RCurl_1.98-1.6         magrittr_2.0.2         GenomeInfoDbData_1.2.6 biomformat_1.20.0      Matrix_1.4-1          
 [56] Rcpp_1.0.8.3           munsell_0.5.0          S4Vectors_0.30.2       Rhdf5lib_1.14.2        fansi_1.0.3           
 [61] ape_5.6-2              lifecycle_1.0.1        infotheo_1.2.0         pROC_1.18.0            stringi_1.7.6         
 [66] MASS_7.3-56            zlibbioc_1.38.0        Rtsne_0.15             rhdf5_2.36.0           plyr_1.8.7            
 [71] grid_4.1.0             LiblineaR_2.10-12      parallel_4.1.0         listenv_0.8.0          crayon_1.5.1          
 [76] lattice_0.20-45        Biostrings_2.60.2      splines_4.1.0          multtest_2.48.0        hms_1.1.1             
 [81] beanplot_1.2           pillar_1.7.0           igraph_1.2.11          uuid_1.0-4             boot_1.3-28           
 [86] reshape2_1.4.4         codetools_0.2-18       stats4_4.1.0           glue_1.6.2             data.table_1.14.2     
 [91] nloptr_2.0.0           vctrs_0.3.8            foreach_1.5.2          tidyr_1.2.0            gtable_0.3.0          
 [96] purrr_0.3.4            future_1.24.0          assertthat_0.2.1       gridBase_0.4-7         survival_3.3-1        
[101] tibble_3.1.6           lmerTest_3.1-3         iterators_1.0.14       IRanges_2.26.0         cluster_2.1.2         
[106] corrplot_0.92          globals_0.14.0         ellipsis_0.3.2        
SIAMCAT • 275 views
ADD COMMENT
2
Entering edit mode

On this line

label.meta <- - create.label(meta=meta,
                             label="Sex", case="female"

do you mean to have a minus symbol (-) in front of the call to create.label()?

ADD REPLY

Login before adding your answer.

Traffic: 228 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6