Commit a8b44692 authored by Sebastien Theil's avatar Sebastien Theil
Browse files

Merge branch 'master' of forgemia.inra.fr:umrf/ranomaly

parents 7e4f6567 7c338e31
Pipeline #27839 passed with stage
in 12 seconds
......@@ -78,6 +78,21 @@ ASVenn_fun <- function(data = data, output = "./ASVenn/", rank = "ASV",
}
}
if(length(lvls)==0){
flog.error('You must provide levels...')
stop()
} else if(length(lvls)>5){
flog.error('Venn diagram is limited to 5 levels')
stop()
} else{
if(!all(lvls %in% na.omit(levels(as.factor(sample_data(data)[,column1]@.Data[[1]])) ))){
flog.error('Your levels are not present in metadata...')
stop()
}
}
#Nombre d'espèce par matrice
flog.info('Parsing factor ...')
level1 <- na.omit(levels(as.factor(sample_data(data)[,column1]@.Data[[1]])) )
......@@ -178,15 +193,7 @@ ASVenn_fun <- function(data = data, output = "./ASVenn/", rank = "ASV",
TFbak <- TF <- sapply(TFtax, row.names, simplify = FALSE)
print(str(lvls))
print(str(TFbak))
# colnames(TFbak) = colnames(TF) = level1
names(TFbak) = names(TF) = lvls
# print(names(TFbak))
# print(TFbak)
# stop()
# print(TF)
names(TFbak) = names(TF) = level1
# print( length(unique(unlist(TF))) )
if(length(lvls)>5){
......
......@@ -19,6 +19,7 @@
#' @param trim_r Trim right size.
#' @param returnval Boolean to return values in console or not.
#' @param paired Boolean for Illumina Paired End Reads.
#' @param orient_torrent Forward primer sequence to orient all reads to same strand.
#'
#' @return Return raw otu table in phyloseq object and export it in an Rdata file.
#'
......@@ -37,7 +38,8 @@
dada2_fun <- function(amplicon = "16S", path = "", outpath = "./dada2_out/", f_trunclen = 240, r_trunclen = 240, dadapool = "pseudo",
f_primer = "GCATCGATGAAGAACGCAGC", r_primer = "TCCTCCGCTTWTTGWTWTGC", plot = FALSE, compress = FALSE, verbose = 1,
torrent_single = FALSE,returnval = TRUE, paired = TRUE, trim_l=15, trim_r=0){
torrent_single = FALSE,returnval = TRUE, paired = TRUE, trim_l=15, trim_r=0, orient_torrent = NULL){
if(torrent_single == TRUE & is.null(orient_torrent)){stop("Need forward primer to orient TORRENT reads...")}
if(verbose == 3){
invisible(flog.threshold(DEBUG))
......@@ -335,9 +337,13 @@ dada2_fun <- function(amplicon = "16S", path = "", outpath = "./dada2_out/", f_t
filtFs <- file.path(path, "filtered", paste0(sample.names, "_filt.fastq"))
}
out <- filterAndTrim(fwd = fnFs, filt = filtFs, maxN = 0, multithread = TRUE, verbose=TRUE, rm.phix = TRUE,
, maxEE = 5 , minLen = 100, compress=compress, trimLeft=trim_l, trimRight=trim_r )
if(torrent_single == TRUE){
out <- filterAndTrim(fwd = fnFs, filt = filtFs, maxN = 0, multithread = TRUE, verbose=TRUE, rm.phix = TRUE,
, maxEE = 5 , minLen = 100, compress=compress, trimLeft=trim_l, trimRight=trim_r, orient.fwd = orient_torrent)
}else{
out <- filterAndTrim(fwd = fnFs, filt = filtFs, maxN = 0, multithread = TRUE, verbose=TRUE, rm.phix = TRUE,
, maxEE = 5 , minLen = 100, compress=compress, trimLeft=trim_l, trimRight=trim_r )
}
row.names(out) = sample.names
flog.info('Learning error model...')
......
......@@ -189,6 +189,7 @@ decontam_fun <- function(data = data, domain = "Bacteria", output = "./decontam_
} else {
flog.info('Decontam step skipped or too few control samples (less than 3)...')
taxToDump0 = NULL
skip=TRUE
}
}else{taxToDump0 = NULL} #-k skip all decontam
......@@ -285,7 +286,7 @@ decontam_fun <- function(data = data, domain = "Bacteria", output = "./decontam_
}
data <- prune_samples(sample_sums(data) > number, data)
flog.info('Done.')
flog.info(paste("AFTER FILTERING: ",nsamples(data), "samples and", ntaxa(data),"ASVs in otu table") )
##TAXA to remove manually
......@@ -305,12 +306,13 @@ decontam_fun <- function(data = data, domain = "Bacteria", output = "./decontam_
}
##Remove Control samples for next analysis
if(column != ""){
if(column != "" && skip==FALSE){
flog.info('Subsetting controls samples.')
fun <- paste("data <- subset_samples(data, ",column," %in% '",spl_identifier,"')",sep="")
eval(parse(text=fun))
}
flog.info(paste("AFTER FILTERING: ",nsamples(data), "samples and", ntaxa(data),"ASVs in otu table") )
flog.info('Writing raw tables.')
write.table(cbind(otu_table(data),"Consensus Lineage" = apply(tax_table(data), 1, paste, collapse = ";"), "sequences"=as.data.frame(refseq(data)) ), paste(output,"/raw_otu-table.csv",sep=''), sep="\t", row.names=TRUE, col.names=NA, quote=FALSE)
......
......@@ -76,11 +76,6 @@ diversity_alpha_fun <- function(data = data, output = "./plot_div_alpha/", colum
dir.create(output, recursive=TRUE)
}
if(verbose == 3){
invisible(flog.threshold(DEBUG))
} else {
invisible(flog.threshold(INFO))
}
if(column1 == ""){
flog.error('You need to provide at least one column.')
......
......@@ -7,7 +7,7 @@
#' @param asv_names sequences IDs in same order.
#' @param confidence Bootstrap threshold 0...100
#'
#' @return return taxonomic assignment of given sequences.
#' @return return taxonomic assignment of given sequences.
#' @import futile.logger
#' @import DECIPHER
......@@ -17,7 +17,7 @@
idTaxa_assign = function(db_file, dna, asv_names, confidence){
flog.info(paste('Using database ',db_file,sep=''))
toto <- load(db_file)
ids <- IdTaxa(dna, trainingSet, strand="top", processors=NULL, verbose=TRUE)
ids <- IdTaxa(dna, trainingSet, strand="both", processors=NULL, verbose=TRUE)
names(ids) <- asv_names
flog.info("Confidence filtering...")
IDCONF = as.numeric(confidence)
......
......@@ -52,3 +52,11 @@ Callahan, Benjamin J., Paul J. McMurdie, Michael J. Rosen, Andrew W. Han, Amy Jo
McMurdie, Paul J., et Susan Holmes. « Phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data ». PLOS ONE 8, nᵒ 4 (22 avril 2013): e61217. https://doi.org/10.1371/journal.pone.0061217.
Murali, Adithya, Aniruddha Bhargava, et Erik S. Wright. « IDTAXA: a novel approach for accurate taxonomic classification of microbiome sequences ». Microbiome 6, nᵒ 1 (9 août 2018): 140. https://doi.org/10.1186/s40168-018-0521-5.
## Licence
![etalab](inst/misc/etalab5.png "etalab") [ETALAB](https://www.etalab.gouv.fr/wp-content/uploads/2018/11/open-licence.pdf)
GPL 3.0
## Copyright
2021 INRA
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