Skip to content

Commit

Permalink
Added wrapper for rsem-generate-data-matrix. (#374)
Browse files Browse the repository at this point in the history
* Added wrapper for rsem-generate-data-matrix.

* Added a second results file to demonstrate merging.
  • Loading branch information
brcopeland authored Jun 23, 2021
1 parent 6cd6aa5 commit 0997adf
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bio/rsem/generate-data-matrix/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
channels:
- bioconda
dependencies:
- rsem ==1.3.3
11 changes: 11 additions & 0 deletions bio/rsem/generate-data-matrix/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: rsem generate data matrix
description: |
Run rsem-generate-data-matrix to combine a set of single-sample rsem results into a single matrix.
authors:
- Brett Copeland
input:
- a list of rsem results files
output:
- Quantification results summarized by allele/gene/isoform per sample
notes: |
* For more information, see https://github.com/deweylab/RSEM.
14 changes: 14 additions & 0 deletions bio/rsem/generate-data-matrix/test/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
rule rsem_generate_data_matrix:
input:
# one or more expression files created by rsem-calculate-expression
["a.genes.results", "b.genes.results"],
output:
# a tsv containing each sample in the input as a column
"genes.results",
params:
# optional additional parameters
extra="",
log:
"logs/rsem/generate_data_matrix.log",
wrapper:
"master/bio/rsem/generate-data-matrix"
2 changes: 2 additions & 0 deletions bio/rsem/generate-data-matrix/test/a.genes.results
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gene_id transcript_id(s) length effective_length expected_count TPM FPKM
Sheila Sheila 20.00 20.00 0.00 0.00 0.00
2 changes: 2 additions & 0 deletions bio/rsem/generate-data-matrix/test/b.genes.results
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gene_id transcript_id(s) length effective_length expected_count TPM FPKM
Sheila Sheila 20.00 20.00 1.00 1.00 1.00
17 changes: 17 additions & 0 deletions bio/rsem/generate-data-matrix/wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
__author__ = "Brett Copeland"
__copyright__ = "Copyright 2021, Brett Copeland"
__email__ = "[email protected]"
__license__ = "MIT"


import os

from snakemake.shell import shell

extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
shell(
"rsem-generate-data-matrix {extra} "
"{snakemake.input} > {snakemake.output} "
"{log}"
)
8 changes: 8 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3935,3 +3935,11 @@ def test_rsem_prepare_reference():
"bio/rsem/prepare-reference",
["snakemake", "--cores", "1", "--use-conda", "-F"],
)


@skip_if_not_modified
def test_generate_data_matrix():
run(
"bio/rsem/generate-data-matrix",
["snakemake", "--cores", "1", "--use-conda", "-F"],
)

0 comments on commit 0997adf

Please sign in to comment.