Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
657 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#! /usr/bin/env python3 | ||
""" | ||
Create a simple before and after report from scrubbing | ||
""" | ||
PROGRAM = "scrubber-summary" | ||
VERSION = "3.0.1" | ||
import json | ||
import sys | ||
|
||
def read_json(json_file): | ||
json_data = None | ||
with open(json_file, 'rt') as json_fh: | ||
json_data = json.load(json_fh) | ||
return json_data | ||
|
||
if __name__ == '__main__': | ||
import argparse as ap | ||
|
||
parser = ap.ArgumentParser( | ||
prog=PROGRAM, | ||
conflict_handler='resolve', | ||
description=( | ||
f'{PROGRAM} (v{VERSION}) - Create a simple before and after report from scrubbing' | ||
) | ||
) | ||
parser.add_argument('sample', metavar="SAMPLE", type=str, | ||
help='the name of the sample') | ||
parser.add_argument('original', metavar="ORIGINAL", type=str, | ||
help='A summary of the original FASTQs in JSON format') | ||
parser.add_argument('scrubbed', metavar="SCRUBBED", type=str, | ||
help='A summary of the scrubbed FASTQs in JSON format') | ||
parser.add_argument('--version', action='version', | ||
version=f'{PROGRAM} {VERSION}') | ||
|
||
if len(sys.argv) == 1: | ||
parser.print_help() | ||
sys.exit(0) | ||
|
||
args = parser.parse_args() | ||
|
||
original_json = read_json(args.original) | ||
scrubbed_json = read_json(args.scrubbed) | ||
|
||
# Summary | ||
cols = [ | ||
'sample', | ||
'original_read_total', | ||
'scrubbed_read_total', | ||
'host_read_total', | ||
] | ||
results = [ | ||
args.sample, | ||
str(original_json['qc_stats']['read_total']), | ||
str(scrubbed_json['qc_stats']['read_total']), | ||
str(original_json['qc_stats']['read_total'] - scrubbed_json['qc_stats']['read_total']), | ||
] | ||
|
||
print('\t'.join(cols)) | ||
print('\t'.join(results)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Import generic module functions | ||
include { get_resources; initOptions; saveFiles } from '../../../../lib/nf/functions' | ||
RESOURCES = get_resources(workflow.profile, params.max_memory, params.max_cpus) | ||
options = initOptions(params.containsKey("options") ? params.options : [:], 'custom_wget') | ||
options.btype = options.btype ?: "comparative" | ||
conda_tools = "bioconda::gnu-wget=1.18" | ||
conda_name = conda_tools.replace("=", "-").replace(":", "-").replace(" ", "-") | ||
conda_env = file("${params.condadir}/${conda_name}").exists() ? "${params.condadir}/${conda_name}" : conda_tools | ||
|
||
process CUSTOM_WGET { | ||
label 'process_low' | ||
storeDir params.datasets_cache | ||
publishDir params.datasets_cache | ||
|
||
conda (params.enable_conda ? conda_env : null) | ||
container "${ workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/gnu-wget:1.18--h36e9172_9' : | ||
'quay.io/biocontainers/gnu-wget:1.18--h36e9172_9' }" | ||
|
||
output: | ||
path "${options.args2}", emit: download | ||
path "*.{log,err}" , emit: logs, optional: true | ||
path ".command.*" , emit: nf_logs | ||
path "versions.yml" ,emit: versions | ||
|
||
script: | ||
""" | ||
wget $options.args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
wget: \$(echo \$( wget --version 2>&1) | sed "s/GNU Wget //;s/ .*//;" ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: custom_wget | ||
description: Custom module used to download files using wget | ||
keywords: | ||
- wget | ||
- custom | ||
- version | ||
tools: | ||
- custom: | ||
description: Custom module used to download files using wget | ||
homepage: https://github.com/nf-core/tools | ||
documentation: https://github.com/nf-core/tools | ||
|
||
output: | ||
- download: | ||
type: file | ||
description: Downloaded file from input URL | ||
pattern: "*" | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@rpetit3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema", | ||
"$id": "https://raw.githubusercontent.com/bactopia/bactopia/master/modules/nf-core/kraken2/params.json", | ||
"title": "Kraken2 Module", | ||
"description": "A module for taxonomic classification of sequence reads", | ||
"type": "object", | ||
"definitions": { | ||
"kraken2_parameters": { | ||
"title": "Scrubber (Kraken2) Parameters", | ||
"type": "object", | ||
"description": "", | ||
"default": "", | ||
"fa_icon": "fas fa-exclamation-circle", | ||
"properties": { | ||
"quick_mode": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Quick operation (use first hit or hits)", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"confidence": { | ||
"type": "number", | ||
"default": 0.0, | ||
"description": "Confidence score threshold between 0 and 1", | ||
"fa_icon": "fas fa-expand-arrows-alt" | ||
}, | ||
"minimum_base_quality": { | ||
"type": "integer", | ||
"default": 0, | ||
"description": "Minimum base quality used in classification", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"use_mpa_style": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Format report output like Kraken 1's kraken-mpa-report", | ||
"fa_icon": "fas fa-expand-arrows-alt" | ||
}, | ||
"report_zero_counts": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Report counts for ALL taxa, even if counts are zero", | ||
"fa_icon": "fas fa-expand-arrows-alt" | ||
}, | ||
"report_minimizer_data": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Include minimizer and distinct minimizer count information in report", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"use_names": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Print scientific names instead of just taxids", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"memory_mapping": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Avoid loading database into RAM", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"minimum_hit_groups": { | ||
"type": "integer", | ||
"default": 2, | ||
"description": "Minimum number of hit groups needed to make a call", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
}, | ||
"remove_filtered_reads": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Discard the classified and unclassified FASTQs prduced by Kraken2", | ||
"fa_icon": "fas fa-expand-arrows-alt", | ||
"hidden": true | ||
} | ||
} | ||
} | ||
}, | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/kraken2_parameters" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.