Commit 44790f29 authored by Konrad Zych's avatar Konrad Zych

syncing with the Bioconductor repo

parent 4551f144
......@@ -2,7 +2,7 @@ Package: SIAMCAT
Type: Package
Title: Statistical Inference of Associations between Microbial
Communities And host phenoTypes
Version: 1.2.0
Version: 1.5.0
Authors@R: c(person("Konrad", "Zych", role = c("aut", "cre"),
email = "konrad.zych@embl.de",
comment = c(ORCID = "0000-0001-7426-0516")),
......@@ -52,14 +52,14 @@ Imports:
stringr,
utils,
infotheo,
corrplot,
progress
progress,
corrplot
License: GPL-3
LazyData: true
RoxygenNote: 6.1.0
biocViews: Metagenomics, Classification, Microbiome, Sequencing, Preprocessing,
Clustering, FeatureExtraction, GeneticVariability, MultipleComparison,
Regression
biocViews: ImmunoOncology, Metagenomics, Classification, Microbiome,
Sequencing, Preprocessing, Clustering, FeatureExtraction,
GeneticVariability, MultipleComparison,Regression
Suggests:
BiocStyle,
optparse,
......
......@@ -117,7 +117,7 @@ add.meta.pred <- function(siamcat, pred.names, std.meta = TRUE,
m <- unlist(meta(siamcat)[, idx])
# check if the meta-variable is a factor or numeric
if (class(m) == 'factor'){
if (is.factor(m)){
warning(paste0('WARNING: meta-variable ', p,' is a factor and',
' not numeric...\n The values will be converted to numerical',
' values with "as.numeric()"\n'))
......
......@@ -656,7 +656,7 @@ check.color.scheme <- function(color.scheme, label, verbose = 1) {
length(unique(label$label)))
if (length(color.scheme) == 1 &&
class(color.scheme) == 'character') {
is.character(color.scheme)) {
if (n.classes == 2) {
# if color scheme and binary label, make colors as before
if (!color.scheme %in% row.names(brewer.pal.info)) {
......
......@@ -469,7 +469,7 @@ factorize.bmi <- function(bmi) {
# ranges taken from CDC
# https://www.cdc.gov/healthyweight/assessing/bmi/adult_bmi/index.html
if (class(bmi) != 'matrix') bmi <- as.matrix(bmi)
if (!is.matrix(bmi)) bmi <- as.matrix(bmi)
temp <- vapply(bmi, FUN=function(x) {
if (is.na(x)) {return(as.character(NA))}
else if (x < 18.5) {return("Underweight")}
......
......@@ -145,7 +145,7 @@ create.data.split <- function(siamcat, num.folds = 2, num.resample = 1,
if (!is.null(inseparable)) {
if (is.numeric(inseparable) && length(inseparable) == 1) {
stopifnot(inseparable <= ncol(meta(siamcat)))
} else if (class(inseparable) == "character" &&
} else if (is.character(inseparable) &&
length(inseparable == 1)) {
stopifnot(inseparable %in% colnames(meta(siamcat)))
} else {
......
......@@ -84,10 +84,10 @@ create.label <- function(label, case, meta=NULL, control = NULL,
if (!is.null(meta) & length(label) == 1){
if (!label %in% colnames(meta))
stop("ERROR: Column ", label, " not found in the metadata\n")
if (class(meta) == 'sample_data'){
if (is(meta,'sample_data')){
label.vec <- vapply(meta[, label], as.character,
FUN.VALUE = character(nrow(meta)))
} else if (class(meta) == 'data.frame'){
} else if (is.data.frame(meta)){
label.vec <- vapply(meta[, label], as.character,
FUN.VALUE = character(1))
} else {
......
......@@ -142,7 +142,7 @@ model.evaluation.plot <- function(..., fn.plot=NULL, colours = NULL,
} else if (length(args) == 1) {
# checks
if (!all(class(args[[1]]) == 'siamcat'))
if (!all(is(args[[1]], 'siamcat')))
stop('Please supply a SIAMCAT object. Exiting...')
if(is.null(eval_data(args[[1]]))){
stop('SIAMCAT object has no evaluation data. Exiting...')
......
......@@ -234,17 +234,17 @@ check.data.split <- function(object){
}
# check that num.resample and num.folds are numbers
if (length(object$num.resample) != 1 |
class(object$num.resample) != 'numeric'){
!is.numeric(object$num.resample)){
msg <- 'num.resample should be numeric and of length 1!'
errors <- c(errors, msg)
}
if (length(object$num.folds) != 1 |
class(object$num.folds) != 'numeric'){
!is.numeric(object$num.folds)){
msg <- 'num.folds should be numeric and of length 1!'
errors <- c(errors, msg)
}
# check that training.folds is a list (of the right length)
if (class(object$training.folds) != 'list'){
if (!is.list(object$training.folds)){
msg <- 'training.folds should be a list!'
errors <- c(errors, msg)
}
......@@ -258,7 +258,7 @@ check.data.split <- function(object){
errors <- c(errors, msg)
}
# same for test.folds
if (class(object$test.folds) != 'list'){
if (!is.list(object$test.folds)){
msg <- 'test.folds should be a list!'
errors <- c(errors, msg)
}
......@@ -340,12 +340,12 @@ check.eval.data <- function(object){
errors <- c(errors, msg)
}
# check roc
if (class(object$roc) != 'roc'){
if (!is(object$roc,'roc')){
msg <- 'Entry for roc is not an object of class roc (from pROC)!'
errors <- c(errors, msg)
}
# check prc
if (class(object$prc) != 'list' |
if (!is.list(object$prc) |
!all(names(object$prc) ==c('recall', 'precision')) |
length(unique(vapply(object$prc, length, FUN.VALUE=numeric(1))))!=1){
msg <- paste0('No valid entry for prc ',
......@@ -353,7 +353,7 @@ check.eval.data <- function(object){
errors <- c(errors, msg)
}
# check ev
if (class(object$ev) != 'list' |
if (!is.list(object$ev) |
!all(names(object$ev) == c("tp", "tn", "fp", "fn", "thresholds"))){
msg <- 'Not a valid entry for ev (missing entries or no list)!'
errors <- c(errors, msg)
......
......@@ -118,7 +118,7 @@ siamcat <- function(..., feat=NULL, label=NULL, meta=NULL, phyloseq=NULL,
stop(paste0('Both features matrix and phyloseq object provided. ',
'Please provide only one of them!'))
}
if (class(phyloseq) != 'phyloseq'){
if (!is(phyloseq,'phyloseq')){
stop('Please provide an object of class phyloseq for SIAMCAT!')
}
feat <- otu_table(phyloseq)
......@@ -258,13 +258,13 @@ validate.features <- function(feat){
stop('SIAMCAT needs features!!! Exiting...')
}
# check class of feature input
if (class(feat) == 'otu_table'){
if (is(feat,'otu_table')){
# can either be an otu_table (only check that taxa_are_rows == TRUE)
if (!taxa_are_rows(feat)){
feat <- otu_table(t(feat@.Data), taxa_are_rows=TRUE)
}
return(feat)
} else if (class(feat) == 'matrix'){
} else if (is(feat, 'matrix')){
# or a matrix (then check if it is numeric or not)
# and convert to otu_table
if (any(!is.numeric(feat))){
......@@ -273,7 +273,7 @@ validate.features <- function(feat){
}
feat <- otu_table(feat, taxa_are_rows=TRUE)
return(feat)
} else if (class(feat) == 'data.frame'){
} else if (is.data.frame(feat)){
# or a dataframe (then do the same as above)
if (any(!is.numeric(unlist(feat)))){
stop(paste0('SIAMCAT expects numerical features!.\n',
......@@ -295,7 +295,7 @@ validate.label <- function(label, feat, meta, case, verbose){
label <- list(label = rep(-1, ncol(feat)),
info=c('TEST'=-1), type="TEST")
names(label$label) <- colnames(feat)
} else if (class(label) == "list"){
} else if (is.list(label)){
label <- label
} else if (is.character(label) & length(label) == 1){
if(is.null(meta)) stop('Metadata needed to generate label! Exiting...')
......@@ -321,10 +321,10 @@ validate.metadata <- function(meta){
if (is.null(meta)){
return(NULL)
}
if (class(meta) == 'sample_data'){
if (is(meta, 'sample_data')){
return(meta)
}
if (class(meta) == 'data.frame'){
if (is.data.frame(meta)){
meta <- sample_data(meta)
return(meta)
}
......
......@@ -32,19 +32,20 @@ of intense research. For this, robust statistical modeling and biomarker
extraction toolkits are crucially needed!
}
\author{
\strong{Maintainer}: Konrad Zych \email{konrad.zych@embl.de} (0000-0001-7426-0516)
\strong{Maintainer}: Konrad Zych
\email{konrad.zych@embl.de} (0000-0001-7426-0516)
Authors:
\itemize{
\item Jakob Wirbel \email{jakob.wirbel@embl.de} (0000-0002-4073-3562)
\item Georg Zeller \email{zeller@embl.de} (0000-0003-1429-7485)
\item Jakob Wirbel \email{jakob.wirbel@embl.de} (0000-0002-4073-3562)
\item Georg Zeller \email{zeller@embl.de} (0000-0003-1429-7485)
}
Other contributors:
\itemize{
\item Morgan Essex \email{morgan.essex@embl.de} [contributor]
\item Nicolai Karcher [contributor]
\item Kersten Breuer [contributor]
\item Morgan Essex \email{morgan.essex@embl.de} [contributor]
\item Nicolai Karcher [contributor]
\item Kersten Breuer [contributor]
}
}
vignettes/associations_plot.png

1.36 MB | W: | H:

vignettes/associations_plot.png

268 KB | W: | H:

vignettes/associations_plot.png
vignettes/associations_plot.png
vignettes/associations_plot.png
vignettes/associations_plot.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment