Skip to content

Commit

Permalink
feat: added ref as an optional input file (#473)
Browse files Browse the repository at this point in the history
* Added reference as an optional input

* Added ref to example Snakefile
  • Loading branch information
fgvieira committed Apr 25, 2022
1 parent 12b7978 commit dd8c066
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion bio/picard/collectrnaseqmetrics/meta.yaml
@@ -1,15 +1,17 @@
name: picard CollectRnaSeqMetrics
description: |
Run picard CollectRnaSeqMetrics to generate QC metrics for RNA-seq data.
url: https://broadinstitute.github.io/picard/command-line-overview.html#CollectRnaSeqMetrics
authors:
- Brett Copeland
- Filipe G. Vieira
input:
- BAM file of RNA-seq data aligned to genome
- REF_FLAT formatted file of transcriptome annotations
- reference FASTA (optional)
output:
- RNA-Seq metrics text file
notes: |
* The `java_opts` param allows for additional arguments to be passed to the java compiler, e.g. "-XX:ParallelGCThreads=10" (not for `-XmX` or `-Djava.io.tmpdir`, since they are handled automatically).
* The `extra` param allows for additional program arguments.
* `--TMP_DIR` is automatically set by `resources.tmpdir`
* For more information, see https://broadinstitute.github.io/picard/command-line-overview.html#CollectRnaSeqMetrics
6 changes: 2 additions & 4 deletions bio/picard/collectrnaseqmetrics/test/Snakefile
Expand Up @@ -2,6 +2,8 @@ rule alignment_summary:
input:
# BAM aligned, splicing-aware, to reference genome
bam="mapped/a.bam",
# Reference genome
#ref="ref.fasta",
# Annotation file containing transcript, gene, and exon data
refflat="annotation.refFlat",
output:
Expand All @@ -14,10 +16,6 @@ rule alignment_summary:
extra="--VALIDATION_STRINGENCY STRICT",
log:
"logs/picard/rnaseq-metrics/a.log",
# optional specification of memory usage of the JVM that snakemake will respect with global
# resource restrictions (https://snakemake.readthedocs.io/en/latest/snakefiles/rules.html#resources)
# and which can be used to request RAM during cluster job submission as `{resources.mem_mb}`:
# https://snakemake.readthedocs.io/en/latest/executing/cluster.html#job-properties
resources:
mem_mb=1024,
wrapper:
Expand Down
10 changes: 8 additions & 2 deletions bio/picard/collectrnaseqmetrics/wrapper.py
Expand Up @@ -15,14 +15,20 @@
java_opts = get_java_opts(snakemake)


ref = snakemake.input.get("ref", "")
if ref:
ref = f"--REFERENCE_SEQUENCE {ref}"


with tempfile.TemporaryDirectory() as tmpdir:
shell(
"picard CollectRnaSeqMetrics"
" {java_opts} {extra}"
" --INPUT {snakemake.input.bam}"
" --TMP_DIR {tmpdir}"
" --OUTPUT {snakemake.output}"
" {ref}"
" --REF_FLAT {snakemake.input.refflat}"
" --STRAND_SPECIFICITY {strand}"
" --TMP_DIR {tmpdir}"
" --OUTPUT {snakemake.output}"
" {log}"
)

0 comments on commit dd8c066

Please sign in to comment.