Commit a7e1dbde authored by Erwan DELAGE's avatar Erwan DELAGE
Browse files

Ajout d'ADONIS (PERMANOVA à plusieurs facteurs)

parent 9b6303c6
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"global": {
"global": {
"type": "object",
"properties": {
"manifest": { "type": "string" },
"context" : { "type": "string" },
"denoiser": { "type": "string", "enum": ["dada2", "deblur"] },
"outdir" : { "type": "string" },
"parallel-samples" : { "type": "boolean" },
"nbthreads" : {"type": "integer", "minimum" : 1}
"manifest": {
"type": "string"
},
"context": {
"type": "string"
},
"denoiser": {
"type": "string",
"enum": [
"dada2",
"deblur"
]
},
"outdir": {
"type": "string"
},
"parallel-samples": {
"type": "boolean"
},
"nbthreads": {
"type": "integer",
"minimum": 1
}
}
},
"import": {
"type": "object",
"properties": {
"type": { "type": "string" },
"input-format" : { "type": "string" }
"type": {
"type": "string"
},
"input-format": {
"type": "string"
}
}
},
"dada2": {
"type": "object",
"properties": {
"p-trunc-len-f" : { "type": "integer", "minimum": 0 },
"p-trunc-len-r" : { "type": "integer", "minimum": 0 }
"p-trunc-len-f": {
"type": "integer",
"minimum": 0
},
"p-trunc-len-r": {
"type": "integer",
"minimum": 0
}
}
},
"deblur": {
"type": "object",
"properties": {
"p-trim-length" : { "type": "integer", "minimum": 0 },
"i-reference-seqs" : { "type": "string" }
"p-trim-length": {
"type": "integer",
"minimum": 0
},
"i-reference-seqs": {
"type": "string"
}
},
"required": ["p-trim-length"]
"required": [
"p-trim-length"
]
},
"diversity": {
"type": "object",
"properties": {
"p-sampling-depth" : { "type": "integer", "minimum": 0 }
"p-sampling-depth": {
"type": "integer",
"minimum": 0
}
},
"required": ["p-sampling-depth"]
"required": [
"p-sampling-depth"
]
},
"beta_group_significance": {
"beta_group_significance": {
"type": "object",
"properties": {
"m-metadata-column" : { "type": "string" }
"m-metadata-column": {
"type": "string"
}
},
"required": ["m-metadata-column"]
"required": [
"m-metadata-column"
]
},
"adonis": {
"type": "object",
"properties": {
"p-formula": {
"type": "string"
}
},
"required": [
"p-formula"
]
},
"alpha-rarefaction": {
"type": "object",
"properties": {
"p-max-depth" : { "type": "integer", "minimum": 0 }
"p-max-depth": {
"type": "integer",
"minimum": 0
}
},
"required": ["p-max-depth"]
"required": [
"p-max-depth"
]
},
"taxonomy": {
"type": "object",
"properties": {
"classifier" : { "type": "string" }
"classifier": {
"type": "string"
}
},
"required": ["classifier"]
"required": [
"classifier"
]
},
"phylogeny" : {
"type" : "object"
"phylogeny": {
"type": "object"
},
"cutadapt" : {
"type" : "object"
"cutadapt": {
"type": "object"
},
"fastqc" : {
"type" : "object"
"fastqc": {
"type": "object"
},
"quality-filter" : {
"type" : "object"
"quality-filter": {
"type": "object"
},
"ancom": {
"type": "object",
"properties": {
"m-metadata-column" : { "type": "string" }
"m-metadata-column": {
"type": "string"
}
},
"required": ["m-metadata-column"]
"required": [
"m-metadata-column"
]
},
"deseq2": {
"type": "object",
"properties": {
"condition" : { "type": "string" }
"condition": {
"type": "string"
}
},
"required": ["condition"]
"required": [
"condition"
]
}
},
"required": ["global"],
"required": [
"global"
],
"additionalProperties": false
}
}
\ No newline at end of file
......@@ -191,6 +191,12 @@ def check_config():
# JSON validator has already checked for that
pass
# Qiime2 authors recommend to write adonis formula between quotes to "avoid unpleaseant surprises"
try :
config["adonis"]["p-formula"] = "\"" + config["adonis"]["p-formula"] + "\""
except KeyError :
pass
def check_manifest():
"""
......@@ -483,7 +489,7 @@ def getInput(tool, given_file=""):
else:
return getOutput("merge_denoiser_results", "table.qza") if config["global"]["parallel-samples"] else getOutput("denoiser", given_file)
if tool == "alpha_group_significance" or tool == "beta_group_significance":
if tool == "alpha_group_significance" or tool == "beta_group_significance" or tool == "adonis":
return getOutput("diversity", given_file)
if tool == "alpha_rarefaction":
......@@ -612,6 +618,9 @@ def format_all_rule():
if "beta_group_significance" in config.keys():
all_input.append(getOutput("beta_group_significance", "bray_curtis_distance_matrix/index.html"))
if "adonis" in config.keys():
all_input.append(getOutput("adonis", "bray_curtis_distance_matrix/index.html"))
if "taxonomy" in config.keys():
all_input.append(getOutput("taxonomy", "barplot/index.html"))
all_input.append(getOutput("summarize_table", "plots/prevalence_abundance.html"))
......@@ -1020,7 +1029,7 @@ if "denoiser" in config["global"]:
getOutput("beta_group_significance", "weighted_unifrac_distance_matrix/index.html"),
getOutput("beta_group_significance", "jaccard_distance_matrix/index.html"),
getOutput("beta_group_significance", "bray_curtis_distance_matrix/index.html")
params: options = getOptions("beta_group_significance"),
params: options = getOptions("beta_group_significance")
conda: qiime2_yml
shell: """
qiime diversity beta-group-significance --i-distance-matrix {input.uw_unifrac} --m-metadata-file {input.metadata} {params.options} --o-visualization {output[0]}
......@@ -1033,6 +1042,33 @@ if "denoiser" in config["global"]:
qiime tools export --input-path {output[3]} --output-path `dirname {output[7]}`
"""
rule adonis:
input: uw_unifrac = getInput("adonis", "unweighted_unifrac_distance_matrix.qza"),
w_unifrac = getInput("adonis", "weighted_unifrac_distance_matrix.qza"),
jaccard = getInput("adonis", "jaccard_distance_matrix.qza"),
bray_curtis = getInput("adonis", "bray_curtis_distance_matrix.qza"),
metadata = config["global"]["context"]
output: getOutput("adonis", "unweighted_unifrac_distance_matrix.qzv"),
getOutput("adonis", "weighted_unifrac_distance_matrix.qzv"),
getOutput("adonis", "jaccard_distance_matrix.qzv"),
getOutput("adonis", "bray_curtis_distance_matrix.qzv"),
getOutput("adonis", "unweighted_unifrac_distance_matrix/index.html"),
getOutput("adonis", "weighted_unifrac_distance_matrix/index.html"),
getOutput("adonis", "jaccard_distance_matrix/index.html"),
getOutput("adonis", "bray_curtis_distance_matrix/index.html")
params: options = getOptions("adonis")
conda: qiime2_yml
shell: """
qiime diversity adonis --i-distance-matrix {input.uw_unifrac} --m-metadata-file {input.metadata} {params.options} --o-visualization {output[0]}
qiime diversity adonis --i-distance-matrix {input.w_unifrac} --m-metadata-file {input.metadata} {params.options} --o-visualization {output[1]}
qiime diversity adonis --i-distance-matrix {input.jaccard} --m-metadata-file {input.metadata} {params.options} --o-visualization {output[2]}
qiime diversity adonis --i-distance-matrix {input.bray_curtis} --m-metadata-file {input.metadata} {params.options} --o-visualization {output[3]}
qiime tools export --input-path {output[0]} --output-path `dirname {output[4]}`
qiime tools export --input-path {output[1]} --output-path `dirname {output[5]}`
qiime tools export --input-path {output[2]} --output-path `dirname {output[6]}`
qiime tools export --input-path {output[3]} --output-path `dirname {output[7]}`
"""
# Write the alpha rarefaction max depth parameter into a file
rule prepare_alpha_rarefaction:
input: getInput("alpha_rarefaction", "abundance_table.tsv")
......
{
"global" : {
"manifest" : "test/manifest.csv",
"context" : "test/context.tsv",
"outdir" : "out_dada2",
"parallel-samples" : false,
"nbthreads" : 2
"global": {
"manifest": "test/manifest.csv",
"context": "test/context.tsv",
"outdir": "out_dada2",
"parallel-samples": false,
"nbthreads": 2
},
"dada2" : {
"p-trunc-len-f" : 245,
"p-trunc-len-r" : 142
"dada2": {
"p-trunc-len-f": 245,
"p-trunc-len-r": 142
},
"diversity" : {
"p-sampling-depth" : 2338
"diversity": {
"p-sampling-depth": 2338
},
"beta_group_significance" : {
"m-metadata-column" : "time"
"beta_group_significance": {
"m-metadata-column": "time"
},
"ancom" : {
"m-metadata-column" : "time"
"adonis": {
"p-formula": "time"
},
"deseq2" : {
"condition" : "time",
"filtering" : {
"type" : "prevalence",
"threshold" : 5
"ancom": {
"m-metadata-column": "time"
},
"deseq2": {
"condition": "time",
"filtering": {
"type": "prevalence",
"threshold": 5
}
}
}
}
\ No newline at end of file
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