Temp up
This commit is contained in:
parent
c66a48525f
commit
07b9edcb99
@ -149,13 +149,12 @@ def xam_ingress(Map arguments)
|
||||
|
||||
def input = get_valid_inputs(margs, xam_extensions)
|
||||
|
||||
// check BAM headers to see if any samples are uBAM
|
||||
ch_result = input.dirs
|
||||
| map { meta, path -> [meta, get_target_files_in_dir(path, xam_extensions)] }
|
||||
| mix(input.files)
|
||||
|
||||
ch_is_unaligned = ch_result
|
||||
| checkBamHeaders
|
||||
| map { meta, is_unaligned_env, mixed_headers_env ->
|
||||
| map { meta, paths, is_unaligned_env, mixed_headers_env ->
|
||||
// convert the env. variables from strings ('0' or '1') into bools
|
||||
boolean is_unaligned = is_unaligned_env as int as boolean
|
||||
boolean mixed_headers = mixed_headers_env as int as boolean
|
||||
@ -163,14 +162,11 @@ def xam_ingress(Map arguments)
|
||||
if (mixed_headers) {
|
||||
error "Found mixed headers in (u)BAM files of sample '${meta.alias}'."
|
||||
}
|
||||
[meta, is_unaligned]
|
||||
// add `is_unaligned` to the metamap (note the use of `+` to create a copy of
|
||||
// `meta` to avoid modifying every item in the channel;
|
||||
// https://github.com/nextflow-io/nextflow/issues/2660)
|
||||
[meta + [is_unaligned: is_unaligned], paths]
|
||||
}
|
||||
|
||||
ch_result = ch_result | join(ch_is_unaligned)
|
||||
// add `is_unaligned` to the metamap (note the use of `+` to create a copy of `meta`
|
||||
// to avoid modifying every item in the channel;
|
||||
// https://github.com/nextflow-io/nextflow/issues/2660)
|
||||
| map { meta, paths, is_unaligned -> [meta + [is_unaligned: is_unaligned], paths] }
|
||||
| branch { meta, paths ->
|
||||
// set `paths` to `null` for uBAM samples if unallowed (they will be added to
|
||||
// the results channel in shape of `[meta, null]` at the end of the function
|
||||
@ -245,7 +241,12 @@ process checkBamHeaders {
|
||||
output:
|
||||
// set the two env variables by `eval`-ing the output of the python script
|
||||
// checking the XAM headers
|
||||
tuple val(meta), env(IS_UNALIGNED), env(MIXED_HEADERS)
|
||||
tuple(
|
||||
val(meta),
|
||||
path("input_dir/reads*.bam", includeInputs: true),
|
||||
env(IS_UNALIGNED),
|
||||
env(MIXED_HEADERS),
|
||||
)
|
||||
script:
|
||||
"""
|
||||
workflow-glue check_bam_headers_in_dir input_dir > env.vars
|
||||
@ -306,14 +307,18 @@ process bamstats {
|
||||
input:
|
||||
tuple val(meta), path("reads.bam")
|
||||
output:
|
||||
tuple val(meta), path("reads.bam"), path("bamstats_results")
|
||||
tuple val(meta),
|
||||
path("reads.bam"),
|
||||
path("bamstats_results")
|
||||
script:
|
||||
def bamstats_threads = Math.max(1, task.cpus - 1)
|
||||
"""
|
||||
mkdir bamstats_results
|
||||
bamstats reads.bam -s $meta.alias -u \
|
||||
-f bamstats_results/bamstats.flagstat.tsv -t $bamstats_threads \
|
||||
--histograms histograms \
|
||||
| bgzip > bamstats_results/bamstats.readstats.tsv.gz
|
||||
mv histograms/* bamstats_results/
|
||||
|
||||
# extract the run IDs from the per-read stats
|
||||
csvtk cut -tf runid bamstats_results/bamstats.readstats.tsv.gz \
|
||||
@ -450,7 +455,9 @@ process fastcat {
|
||||
tuple val(meta), path("input")
|
||||
val extra_args
|
||||
output:
|
||||
tuple val(meta), path("seqs.fastq.gz"), path("fastcat_stats")
|
||||
tuple val(meta),
|
||||
path("seqs.fastq.gz"),
|
||||
path("fastcat_stats")
|
||||
script:
|
||||
String out = "seqs.fastq.gz"
|
||||
String fastcat_stats_outdir = "fastcat_stats"
|
||||
@ -460,10 +467,12 @@ process fastcat {
|
||||
-s ${meta["alias"]} \
|
||||
-r >(bgzip -c > $fastcat_stats_outdir/per-read-stats.tsv.gz) \
|
||||
-f $fastcat_stats_outdir/per-file-stats.tsv \
|
||||
--histograms histograms \
|
||||
$extra_args \
|
||||
input \
|
||||
| bgzip > $out
|
||||
|
||||
mv histograms/* $fastcat_stats_outdir
|
||||
# extract the run IDs from the per-read stats
|
||||
csvtk cut -tf runid $fastcat_stats_outdir/per-read-stats.tsv.gz \
|
||||
| csvtk del-header | sort | uniq > $fastcat_stats_outdir/run_ids
|
||||
|
||||
@ -105,7 +105,7 @@ params {
|
||||
]
|
||||
agent = null
|
||||
container_sha = "shae7c9f184996a384e99be68e790f0612f0c732867"
|
||||
common_sha = "sha91452ece4f647f62b32dac3a614635a6f0d7f8b5"
|
||||
common_sha = "sha399b89c275a4d8eac477a415691cb93180661be6"
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ profiles {
|
||||
container = "${params.aws_image_prefix}-wf-transcriptomes:${params.wf.container_sha}-root"
|
||||
}
|
||||
withLabel:wf_common {
|
||||
container = "${params.aws_image_prefix}-wf-common:${params.wf.common_sha}-root"
|
||||
container = "${params.aws_image_prefix}-wf-common:${params.wf.common_sha}"
|
||||
}
|
||||
shell = ['/bin/bash', '-euo', 'pipefail']
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user