Skip to content
Snippets Groups Projects
Commit d8bafac2 authored by Etienne Rifa's avatar Etienne Rifa
Browse files

more tools + readme

parent 0e287d1d
No related branches found
No related tags found
No related merge requests found
flog.info('Plotting 2 ...')
pf2 <- plotErrors(errF, nominalQ=TRUE)
pr2 <- plotErrors(errR, nominalQ=TRUE)
print("plotOK")
ggsave(paste(out,'/err_plot_f.png',sep=''), plot=pf2)
ggsave(paste(out,'/err_plot_f.png',sep=''), plot=pr2)
flog.info('Done.')
}
setwd("~/Repository/LRF/00_erifa_bak/ranomaly_test")
amplicon = "16S"
path = "~/Repository/LRF/00_erifa_bak/ranomaly_test/reads"
out = "./dada2_out/"
......@@ -510,3 +501,12 @@ devtools::load_all("~/Repository/LRF/ranomaly")
? `assign_taxo
è
? assign_taxo
library(phyloseq)
dat(GlobalPatterns)
data(GlobalPatterns)
rank(GlobalPatterns)
ranknames(GlobalPatterns)
rank_names(GlobalPatterns)
library(ranomaly)
library(ranomaly)
setwd("/home/erifa/Repository/LRF/00_erifa_bak/ranomaly_test")
# Generated by roxygen2: do not edit by hand
export(ASVenn_fun)
export(aggregate_fun)
export(assign_taxo_fun)
export(bars_fun)
export(csv2phyloseq_fun)
export(dada2_fun)
export(decontam_fun)
export(deseq2_fun)
......@@ -14,8 +16,10 @@ export(generate_tree_fun)
export(idTaxa_assign)
export(metacoder_fun)
export(metagenomeseq_fun)
export(phy2cyto_fun)
export(phy2tsv_fun)
export(split_table_fun)
export(update_metadata_fun)
import(Biostrings)
import(DECIPHER)
import(DESeq2)
......@@ -27,6 +31,7 @@ import(digest)
import(futile.logger)
import(ggplot2)
import(ggpubr)
import(glue)
import(grid)
import(gridExtra)
import(metacoder)
......
#' ASVenn
#'
#'
#' @param dada_res Results of dada2_fun()
#' @param output Output directory
#' @param rank Taxonomic rank name, or 'ASV' for ASV level.
#' @param column1 Factor to test.
#' @param subset Subset sample, please provide as c(FACTOR,LEVEL).
#' @param lvls Vector list levels of factor to print in venn diagram (max. 5).
#' @param krona Krona of exclusive ASV or shared with informed level and others. Must be among levels of column1 argument.
#' @param shared shared [TRUE] or exclusive [FALSE] mode.
#'
#'
#' @return Export a venn diagram with corresponding tabulated file.
#'
#' @import glue
#' @export
ASVenn_fun <- function(data = data, output = "./ASVenn/", rank = "ASV",
column1 = NULL, subset = "", lvls = "", krona = "",
shared = TRUE){
invisible(flog.threshold(futile.logger::ERROR, name = "VennDiagramLogger"))
if(!dir.exists(output)){
dir.create(output, recursive=TRUE)
}
#Check phyloseq object named data
if(!any(ls()=="data")){
for(i in ls()){
fun <- paste("cLS <- class(",i,")")
eval(parse(text=fun))
# print(c(i,cLS))
if(cLS == "phyloseq"){
fun <- paste("data = ", i)
eval(parse(text=fun))
}
}
}
if (is.null(column1)){
print_help(opt_parser)
flog.info("You must provide a factor:")
print(names(sample_data(data)))
quit()
}
#Subset data
if(subset!=""){
flog.info('Subset phyloseq object ...')
args1 <- unlist(strsplit(subset,","))
fun <- paste("data <- subset_samples(data, ",args1[1]," %in% '",args1[2],"')",sep="")
eval(parse(text=fun))
TITRE=paste(column1, args1[1], args1[2], sep="-")
}else{
TITRE=paste(column1)
}
#Nombre d'espèce par matrice
flog.info('Parsing factor ...')
level1 <- na.omit(levels(as.factor(sample_data(data)[,column1]@.Data[[1]])) )
TFdata <- list()
TFtax <- list()
if(!is.null(refseq(data, errorIfNULL=FALSE))){
refseq1 <- as.data.frame(refseq(data)); names(refseq1)="seq"
}else{flog.info('No Tree ...')}
databak <- data
for(i in 1:length(level1)){
databak -> data
LOC=as.character(level1[i])
print(LOC)
fun <- paste("data <- subset_samples(data, ",column1," %in% '",LOC,"')",sep="")
eval(parse(text=fun))
if(rank=="ASV"){
print("ASV")
sp_data = data
sp_data <- prune_taxa(taxa_sums(sp_data) > 0, sp_data)
}else{
print(rank)
sp_data <- tax_glom(data, rank)
sp_data <- prune_taxa(taxa_sums(sp_data) > 0, sp_data)
cat(LOC,ntaxa(sp_data)," ", rank, " \n")
}
ttable <- sp_data@tax_table@.Data
otable <- as.data.frame(otu_table(sp_data))
# print(nrow(ttable))
if(!any(rownames(ttable) == rownames(otable))){flog.info("Different order in otu table and tax table");quit()}
TT = cbind(otable,ttable)
TFdata[[i]] <- TT
TFtax[[i]] <- cbind(row.names(TT), as.character(apply(TT[,colnames(ttable)], 1, paste, collapse=";") ) ) #c("Kingdom","Phylum","Class","Order","Family","Genus","Species")
row.names(TFtax[[i]]) = TFtax[[i]][,1]
# write.table(TT, paste(output,"/otu_table_sp_",LOC,".csv",sep=""), sep="\t", quote=FALSE, col.names=NA)
}
## Venn diag
flog.info('Defining unique taxa ...')
alltax <- do.call(rbind, TFtax)
alltax <- alltax[!duplicated(alltax[,1]),]
row.names(alltax)=alltax[,1]
flog.info('Plotting ...')
VENNFUN <- function(mode = 1){
if(mode==1){
venn.plot <- venn.diagram(TF, filename = NULL, col = "black",
fill = rainbow(length(TF)), alpha = 0.50,
cex = 1.5, cat.col = 1, lty = "blank",
cat.cex = 1.8, cat.fontface = "bold",
margin = 0.1, main=TITRE, main.cex=2.5,
fontfamily ="Arial",main.fontfamily="Arial",cat.fontfamily="Arial") #cat.dist = 0.09,
png(paste(output,'/',TITRE,'_venndiag.png',sep=''), width=20, height=20, units="cm", res=200)
grid.draw(venn.plot)
invisible(dev.off())
ov <- calculate.overlap(TF)
print(sapply(ov, length))
flog.info('Calculating lists ...')
uniqTax = TABf = unique(do.call(c,TF))
for (j in 1:length(TF)){
TABtest = TF[[j]]
TABtest_filt=rep(0, length(uniqTax))
for (i in 1:length(uniqTax)) {
featureI = uniqTax[i]
res=grep( paste('^',featureI,'$', sep="" ) , TABtest)
if(length(res)>0){TABtest_filt[i]=length(res)
}
}
TABf=cbind.data.frame( TABtest_filt, TABf )
names(TABf)[1] = names(TF)[j]
}
if(exists("refseq1")){
TABf <- cbind(TABf,alltax[as.character(TABf$TABf),2], refseq1[as.character(TABf$TABf),])
names(TABf) <- c(rev(names(TF)), "ASV", "taxonomy", "seq")
}else{
TABf <- cbind(TABf,alltax[as.character(TABf$TABf),2])
names(TABf) <- c(rev(names(TF)), "ASV", "taxonomy")
}
write.table(TABf, paste(output,"/",TITRE,"_venn_table.csv",sep=""), sep="\t", quote=FALSE, row.names=FALSE)
} else if(mode == 2){
png(paste(output,'/',TITRE,'_venndiag.png',sep=''), width=20, height=20, units="cm", res=200)
venn.plot <- venn::venn(TF , zcol=rainbow(length(TF)))
#venn::venn(TF[c("LI","LA","EA","FI","TR","AI")] , zcol=rainbow(length(TF[c("LI","LA","EA","FI","TR","AI")])))
#venn::venn(TF[c("FI", "TR")] , zcol=rainbow(length(TF[c("FI", "TR")])))
dev.off()
ENVS = names(TF)
Tabf <- NULL; Tab1 <- NULL
for(i in ENVS){
tt = c(i, ENVS[ENVS != i])
print(tt)
yy = Reduce(setdiff, TF[tt])
print(length(yy))
Tab1 <- cbind(rep(i, length(yy)), alltax[yy,])
Tabf <- rbind(Tabf, Tab1)
}
yy <- Reduce(intersect, TF)
Core <- cbind(rep("core", length(yy)), alltax[yy,])
Tabf <- rbind(Core, Tabf)
write.table(Tabf, paste(output,"/",TITRE,"_venn_table.csv",sep=""), sep="\t", quote=FALSE, row.names=FALSE)
}
}
# Specific use to screen taxonomic composition of shared taxa...
if(krona != ""){
TF <- TFbak
flog.info('Krona ...')
env1 <- TF[[krona]]
others1 <- unique( unlist( TF[level1[level1!=krona]] ) )
TF2 <- list(env1, others1)
names(TF2) <- c(krona, "others")
#Venn 2
venn.plot <- venn.diagram(TF2, filename = NULL, col = "black",
fill = rainbow(length(TF2)), alpha = 0.50,
cex = 1.5, cat.col = 1, lty = "blank",
cat.cex = 1.8, cat.fontface = "bold",
margin = 0.1, main=TITRE, main.cex=2.5,
fontfamily ="Arial",main.fontfamily="Arial",cat.fontfamily="Arial") #cat.dist = 0.09,
venn_tab=paste(output,"/",TITRE,"_",krona, "_kronaVenn.png", sep="")
png(venn_tab, width=20, height=20, units="cm", res=200)
grid.draw(venn.plot)
invisible(dev.off())
#Krona
if(shared==TRUE){
L1 = intersect(env1, others1)
}else{
L1 = setdiff(env1, others1)
}
subtaxdata=prune_taxa(L1,data)
ttable <- as.data.frame(subtaxdata@tax_table@.Data)
fttable = cbind.data.frame(rep(1,nrow(ttable)),ttable)
fttable$ASV = row.names(fttable)
dir.create("00test")
flog.info('Write Krona table ...')
krona_tab=paste(output,"/",TITRE,"_",krona, "_krona.txt", sep="")
write.table(fttable, krona_tab, col.names=FALSE, row.names=FALSE, quote=FALSE, sep="\t")
flog.info('Generate Krona html ...')
output <- paste(output,"/",TITRE,"_",krona, "_krona.html", sep = "")
system(paste("ktImportText", krona_tab, "-o", output, sep = " "))
# browseURL(output)
}
TFbak <- TF <- sapply(TFtax, row.names)
names(TFbak) = names(TF) = level1
if(length(level1)>5){
flog.info('Too much levels (max. 5) ...')
if(lvls == ""){
flog.info('Selecting 5 first levels ...')
# TF <- TF[c(1:5)]
VENNFUN(mode=2)
}else{
flog.info(glue('Selecting {lvls} ...'))
LVLs <- unlist(strsplit(lvls,","))
TF <- TF[LVLs]
}
} else {
VENNFUN()
}
flog.info('Done ...')
}
#' Create Phyloseq object from external datas.
#'
#'
#' @param otutable Tabulated ASVtable file path.
#' @param taxtable Tabulated taxonomy table file path.
#' @param seq Tabulated sequence file path.
#' @param metadata Tabulated metadata file path.
#' @param output Output directory
#' @param returnval Boolean to return values in console or not.
#'
#' @return Return a taxonomy table with multiple ancestor checking and incongruence checking when 2 databases are used.
#'
#' @export
csv2phyloseq_fun <- function(otutable = NULL, taxtable = NULL, seq = NULL, metadata = NULL, output = "./csv2phyloseq/", returnval = TRUE){
flog.info("Input...")
flog.info("...OTUtable...")
otable <- read.table(otutable, sep="\t", h=TRUE)
row.names(otable)=otable[,1]
flog.info("...TAXtable...")
ttable <- as.matrix(read.table(taxtable, sep="\t", h=TRUE, stringsAsFactors=FALSE))
row.names(ttable)=ttable[,1]
flog.info("...Metadatas...")
mtable <- read.table(metadata, sep="\t", h=TRUE)
row.names(mtable)=mtable[,1]
flog.info("...Sequences...")
stable <- read.table(seq, sep="\t", h=TRUE)
sequences1 = DNAStringSet(stable[,-1])
names(sequences1)=stable[,1]
save.image("debug.rdata")
flog.info('Generating tree...')
sequences <- sequences1
# names(sequences) <- sapply(sequences,digest,algo='md5')
flog.info('Aligning sequences...')
alignment <- AlignSeqs(DNAStringSet(sequences),anchor=NA,processors=NULL)
flog.info('Creating distance matrices...')
phang.align <- phyDat(as(alignment, "matrix"), type="DNA")
dm <- dist.ml(phang.align)
flog.info('Neigbour joining...')
treeNJ <- NJ(dm) # Note, tip order != sequence order
fit = pml(treeNJ, data=phang.align)
flog.info('GTR...')
fitGTR <- update(fit, k=4, inv=0.2)
# fitGTR <- optim.pml(fitGTR, model="GTR", optInv=TRUE, optGamma=TRUE, rearrangement = "stochastic", control = pml.control(epsilon = 1e-08, maxit = 10,trace = 0))
# detach("package:phangorn", unload=TRUE)
flog.info('Done.')
tree <- fitGTR$tree
data <- phyloseq(otu_table(otable[,-1], taxa_are_rows=TRUE), sample_data(mtable), tax_table(ttable[,-1]), sequences1, tree) # phy_tree(tree),
if(!dir.exists(output)){
flog.info('Creating output directory...')
dir.create(output)
flog.info('Done.')
}
flog.info('Saving R objects.')
save(data, file=paste(output,'/phyloseq_object.Rdata',sep=''))
if(returnval){return(data)}
flog.info('Finish.')
}
#' Export files for cytoscape.
#'
#'
#' @param data output from decontam or generate_phyloseq
#' @param output Output directory
#' @param column1 Factor to test.
#' @param repl Replicates column.
#' @param verbose Verbose level. (1: quiet, 3: verbal)
#'
#' @return Export files ready to use with Cytoscape
#'
#' @references https://cytoscape.org/
#'
#' @export
phy2cyto_fun <- function(data = data, output = "./cytoscape/", column1 = NULL, repl = NULL, verbose = 1){
if(!dir.exists(output)){
dir.create(output, recursive=TRUE)
}
data1 <- data
otab = as.data.frame(otu_table(data1))
sdat <- sdata <- as.data.frame(as.matrix(sample_data(data1)))
fact <- levels(as.factor(sdata[,column1]))
# repl <- "temps"
if(is.null(repl)){
flog.info('No replicates, performing links ...')
#Test1 VUE globale sans tenir compte des réplicats
# Interaction table
sif_tab=NULL
for(env in fact ){
flog.debug(print(env))
eval(parse(text=glue("tt <- subset_samples(data1, {column1} %in% '{env}')") )) ###
flog.debug(print(nsamples(tt)))
#ASV present dans au moins 3 échantillons, autre filtre sur abondance?
tt2 = prune_taxa( apply(otu_table(tt), 1, function(x){length(which(x>0))>3}), tt)
flog.debug(print(ntaxa(tt2)))
#Effectif des asv dans la table < 20
otab2 <- as.data.frame(otu_table(tt2))
otab2[otab2<20] = 0
otu_table(tt2) = otu_table(otab2, taxa_are_rows=TRUE)
tt2 <- prune_taxa(taxa_sums(tt2) > 0, tt2)
tabf = cbind(taxa_names(tt2), rep(glue("type_{env}"), ntaxa(tt2)), rep(env, ntaxa(tt2)))
sif_tab = rbind(sif_tab, tabf)
}
flog.info('Output ...')
write.table(as.data.frame(sif_tab), glue("{output}/sif_tab1.tsv"), sep="\t", row.names=FALSE, col.names=TRUE, quote=FALSE)
# Node table
src = unique(sif_tab[,3])
trgt = sif_tab[,1]
freq = taxa_sums(data1) / sum(taxa_sums(data1))
node_table=cbind.data.frame(c(src, trgt), c(rep("source", length(src)), rep("cible", length(trgt))), c(rep(NA, length(src)), freq[trgt]) )
names(node_table)=c("names","attribute", "freq")
node_table[node_table$attribute=="source","freq"] = 0.75*max(na.omit(node_table$freq))
node_table$tax = "source"
node_table[node_table$attribute == "cible","tax"] = tax_table(data1)[as.character(node_table[node_table$attribute == "cible",1]),"Phylum"]
write.table(as.data.frame(node_table), glue("{output}/node_tab1.tsv"), sep="\t", row.names=FALSE, col.names=TRUE, quote=FALSE)
}else{
flog.info('Replicates, performing links ...')
sif_tab = NULL
for(asv in taxa_names(data1)){
# print(asv)
notu = otab[asv,]
nsamples = names(notu)[notu>20] #nombre d'occurence de l'otu
if(length(nsamples) == 1){flog.debug(print(asv))}
sdat2 = sdat[nsamples,]
rep1 = table(as.character(sdat[nsamples,repl]))
reps = names(rep1) #[which(rep1>1)]
# if(max(rep1[which(rep1>1)]) == 1){print(asv)}
# si aucun partage 1 seul environnement
if(length(rep1)==1){
if(rep1==1){
flog.debug(glue("{asv} exclusif 1 seul réplicat 1 env"))
src <- as.character(unique(sdat2[,column1]))
LINKS = c(asv, glue("type_{src}"), src)
}else{
rep=names(rep1)
sdat3 = sdat2[sdat2$exploit_saison==rep,]
srcs = as.character(unique(sdat3[,column1]))
LINKS = cbind(rep(asv, length(srcs)), glue("type_{srcs}"), srcs)
}
} else{
#sinon partage et création d'un lien pour chaque environnement source.
LINKS = NULL
for(rep in reps){
sdat3 = sdat2[sdat2[,repl]==rep,]
srcs = as.character(unique(sdat3[,column1]))
# Lien seulement si l'asv présent dans même sample à 2 environnements ou plus
if(length(srcs)>1){
link = cbind(rep(asv, length(srcs)), glue("type_{srcs}"), srcs)
# print(glue("{rep} {srcs} envs"))
# print(link)
LINKS = rbind(LINKS, link)
}
}
}
sif_tab = rbind(sif_tab, LINKS)
}
save.image("debug.rdata")
flog.info('Output ...')
# LINK table output
#Compte le nombre d'occurence de chaque lien (environnement - ASV)
tt=apply(sif_tab, 1, paste, collapse="-")
# Unique + counts de chaque lien
sif_tabF = cbind(unique(sif_tab), table(tt), names(table(tt)) )
colnames(sif_tabF) = c("asv", "type", "srcs", "nb_lien", "rownames")
length(unique(sif_tabF[,1]))
length(taxa_names(data1))
sif_tabF <- as.data.frame(sif_tabF)
# Metriques links
#nombres de liens pour chaque OTU
table(sif_tabF[,"asv"])
table(sif_tabF[,"srcs"])
write.table(as.data.frame(sif_tabF), glue("{output}/sif_tab2.tsv"), sep="\t", row.names=FALSE, col.names=TRUE, quote=FALSE)
# Node table output
src = unique(sif_tabF[,3])
trgt = sif_tabF[,1]
freq = taxa_sums(data1) / sum(taxa_sums(data1))
# Taille des noeud en fonction de la frequence, noeud "groupe" 0.75 de la freq max.
node_table=cbind.data.frame(c(src, trgt), c(rep("source", length(src)), rep("cible", length(trgt))), c(rep(NA, length(src)), freq[trgt]) )
names(node_table)=c("names","attribute", "freq")
node_table[node_table$attribute=="source","freq"] = 0.75*max(na.omit(node_table$freq))
node_table$tax = "source"
node_table[node_table$attribute == "cible","tax"] = tax_table(data1)[as.character(node_table[node_table$attribute == "cible",1]),"Phylum"]
write.table(as.data.frame(node_table), glue("{output}/node_tab2.tsv"), sep="\t", row.names=FALSE, col.names=TRUE, quote=FALSE)
}
}
......@@ -21,19 +21,6 @@ phy2tsv_fun <- function(data = data, output = "./tsv_table/", rank = "ASV"){
dir.create(output, recursive=TRUE)
}
#Check phyloseq object named data
flog.info('Check phyloseq object ...')
if(!any(ls()=="data")){
for(i in ls()){
fun <- paste("cLS <- class(",i,")")
eval(parse(text=fun))
# print(c(i,cLS))
if(cLS == "phyloseq"){
fun <- paste("data = ", i)
eval(parse(text=fun))
}
}
}
flog.info('Generating table ...')
stable <- as.data.frame(sample_data(data))
......
#' Update metadata
#'
#'
#' @param data output from decontam or generate_phyloseq
#' @param metadata Tabulated metadata file path.
#' @param output Output directory
#' @param returnval Boolean to return values in console or not.
#'
#' @return Return a phyloseq object with updated metadata.
#'
#' @export
update_metadata_fun <- function(data = data, output = "./updated_physeq/", metadata = NULL, returnval = TRUE){
if (is.null(metadata)){
print_help(opt_parser)
stop("You must provide metadata file path.", call.=FALSE)
} else{
flog.info("Loading sample metadata..")
sampledata <- read.table(metadata, sep="\t",header=TRUE)
rownames(sampledata) <- sampledata$sample.id
sample.metadata <- sample_data(sampledata)
flog.info('Done.')
}
if(!dir.exists(output)){
flog.info('Creating output directory...')
dir.create(output)
flog.info('Done.')
}
print(sample.metadata)
sample_data(data) <- sample.metadata
save(data, file=paste(output,'/robjects.Rdata',sep=''))
if(returnval){data}
}
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rANOMALY
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
rANOMALY is the R Package of the first version of ANOMALY (https://forgemia.inra.fr/umrf/anomaly)
## Installation
You can install the development version of rANOMALY from this repository with:
``` r
devtools::install_git("https://forgemia.inra.fr/umrf/ranomaly")
```
<!-- README.md is generated from README.Rmd. Please edit that file -->
# rANOMALY
<!-- badges: start -->
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
rANOMALY is the R Package of the first version of ANOMALY
(<https://forgemia.inra.fr/umrf/anomaly>)
## Installation
You can install the development version of rANOMALY from this repository
with:
``` r
devtools::install_git("https://forgemia.inra.fr/umrf/ranomaly")
```
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ASVenn_fun.R
\name{ASVenn_fun}
\alias{ASVenn_fun}
\title{ASVenn}
\usage{
ASVenn_fun(
data = data,
output = "./ASVenn/",
rank = "ASV",
column1 = NULL,
subset = "",
lvls = "",
krona = "",
shared = TRUE
)
}
\arguments{
\item{output}{Output directory}
\item{rank}{Taxonomic rank name, or 'ASV' for ASV level.}
\item{column1}{Factor to test.}
\item{subset}{Subset sample, please provide as c(FACTOR,LEVEL).}
\item{lvls}{Vector list levels of factor to print in venn diagram (max. 5).}
\item{krona}{Krona of exclusive ASV or shared with informed level and others. Must be among levels of column1 argument.}
\item{shared}{shared [TRUE] or exclusive [FALSE] mode.}
\item{dada_res}{Results of dada2_fun()}
}
\value{
Export a venn diagram with corresponding tabulated file.
}
\description{
ASVenn
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/csv2phyloseq_fun.R
\name{csv2phyloseq_fun}
\alias{csv2phyloseq_fun}
\title{Create Phyloseq object from external datas.}
\usage{
csv2phyloseq_fun(
otutable = NULL,
taxtable = NULL,
seq = NULL,
metadata = NULL,
output = "./csv2phyloseq/",
returnval = TRUE
)
}
\arguments{
\item{otutable}{Tabulated ASVtable file path.}
\item{taxtable}{Tabulated taxonomy table file path.}
\item{seq}{Tabulated sequence file path.}
\item{metadata}{Tabulated metadata file path.}
\item{output}{Output directory}
\item{returnval}{Boolean to return values in console or not.}
}
\value{
Return a taxonomy table with multiple ancestor checking and incongruence checking when 2 databases are used.
}
\description{
Create Phyloseq object from external datas.
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/phy2cyto_fun.R
\name{phy2cyto_fun}
\alias{phy2cyto_fun}
\title{Export files for cytoscape.}
\usage{
phy2cyto_fun(
data = data,
output = "./cytoscape/",
column1 = NULL,
repl = NULL,
verbose = 1
)
}
\arguments{
\item{data}{output from decontam or generate_phyloseq}
\item{output}{Output directory}
\item{column1}{Factor to test.}
\item{repl}{Replicates column.}
\item{verbose}{Verbose level. (1: quiet, 3: verbal)}
}
\value{
Export files ready to use with Cytoscape
}
\description{
Export files for cytoscape.
}
\references{
https://cytoscape.org/
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update_metadata_fun.R
\name{update_metadata_fun}
\alias{update_metadata_fun}
\title{Update metadata}
\usage{
update_metadata_fun(
data = data,
output = "./updated_physeq/",
metadata = NULL,
returnval = TRUE
)
}
\arguments{
\item{data}{output from decontam or generate_phyloseq}
\item{output}{Output directory}
\item{metadata}{Tabulated metadata file path.}
\item{returnval}{Boolean to return values in console or not.}
}
\value{
Return a phyloseq object with updated metadata.
}
\description{
Update metadata
}
......@@ -3,7 +3,7 @@
#system.file("reads", "", package="ranomaly") # Reads folder
#system.file("", "sample-metadata.csv", package="ranomaly") # metadata
#setwd("")
setwd("/home/erifa/Repository/LRF/00_erifa_bak/ranomaly_test")
dada_res = dada2_fun(path=system.file("reads", "", package="ranomaly"), compress=TRUE, plot=TRUE)
......@@ -43,3 +43,17 @@ TABF = aggregate_fun(data = data, metacoder = "./metacoder/metacoder_temps_lot_G
column1 = "temps_lot", column2 = NULL, verbose = 1, rank = "Genus", comp = "T6_lot1~T6_lot3,T9_lot1~T9_lot3")
head(TABF)
#other TOOLS
ASVenn_fun(data = data, output = "./ASVenn/", rank = "ASV",
column1 = "temps", subset = "", lvls = "", krona = "",
shared = TRUE)
csv2phyloseq_fun(otutable = "00_csv2phyloseqtest/opticum_fro_otutable.csv", taxtable = "00_csv2phyloseqtest/opticum_fro_taxo.csv",
seq = "00_csv2phyloseqtest/opticum_fro_seq.csv", metadata = "00_csv2phyloseqtest/opticum_fro_metadata.csv", output = "./00_csv2phyloseqtest/csv2phyloseq/")
update_metadata_fun(data = data, output = "./updated_physeq/", metadata = "./sample-metadata_up1.csv", )
phy2cyto_fun(data = data, output = "./cytoscape/", column1 = "Producteur_Lait", repl = NULL, verbose = 1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment