Skip to content

Commit

Permalink
updating rules and Snakefile to avoid pipeline confusing 10X input wi…
Browse files Browse the repository at this point in the history
…th .h5ad input when only one is available
  • Loading branch information
Helen Yihua Kang committed Jun 13, 2023
1 parent 3d4cc27 commit 328404c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
4 changes: 0 additions & 4 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,11 @@ def get_output_files(wildcards):
for item in output_list:
all_output.extend([item])

# print(all_output)
# print(output_files)
return all_output


rule all:
input: get_output_files
# params:
# mem_gb: "36"



Expand Down
51 changes: 26 additions & 25 deletions workflow/rules/cNMF_pipeline.smk
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,37 @@ def get_rule_prepare_cNMF_partition(wildcards):
# return all_output


# ## todo: rethink the structure of UMAP part: what are the possible input file types?
# rule create_Seurat_Object:
# input:
# mtx = os.path.join(config["dataDir"], "matrix.mtx.gz"),
# features = os.path.join(config["dataDir"], "features.tsv.gz"),
# barcodes = os.path.join(config["dataDir"], "barcodes.tsv.gz")
# output:
# seurat_object = os.path.join(config["analysisDir"], "data/{sample}.SeuratObject.RDS")
# params:
# time = "2:00:00",
# mem_gb = "200",
# datadir = config["dataDir"],
# outdir = os.path.join(config["analysisDir"], "data"),
# partition = "owners,normal"
# shell:
# "bash -c ' source $HOME/.bashrc; \
# conda activate cnmf_analysis_R; \
# Rscript workflow/scripts/create_seurat_object.R \
# --outdir {params.outdir}/ \
# --datadir {params.datadir} \
# --sampleName {wildcards.sample} \
# ' "
## todo: rethink the structure of UMAP part: what are the possible input file types?
rule create_Seurat_Object:
input:
mtx = os.path.join(config["dataDir"], "matrix.mtx.gz"),
features = os.path.join(config["dataDir"], "features.tsv.gz"),
barcodes = os.path.join(config["dataDir"], "barcodes.tsv.gz")
output:
seurat_object = os.path.join(config["analysisDir"], "data/{sample}.SeuratObject.RDS")
params:
time = "2:00:00",
mem_gb = "200",
datadir = config["dataDir"],
outdir = os.path.join(config["analysisDir"], "data"),
partition = "owners,normal"
shell:
"bash -c ' source $HOME/.bashrc; \
conda activate cnmf_analysis_R; \
Rscript workflow/scripts/create_seurat_object.R \
--outdir {params.outdir}/ \
--datadir {params.datadir} \
--sampleName {wildcards.sample} \
' "


## convert Seurat Object to h5ad file
rule Seurat_Object_to_h5ad:
input:
seurat_object = os.path.join(config["analysisDir"], "data/{sample}.SeuratObject.RDS")
output:
h5ad_mtx = os.path.join(config["analysisDir"], "data/raw/{sample}.h5ad")
h5ad_mtx = os.path.join(config["analysisDir"], "data/{sample}.h5ad"),
gene_name_txt = os.path.join(config["analysisDir"], "data/{sample}.h5ad.all.genes.txt")
params:
time = "2:00:00",
mem_gb = "64",
Expand All @@ -161,7 +162,7 @@ def get_raw_h5ad_file(wildcards):

rule raw_h5ad_to_filtered_h5ad:
input:
get_raw_h5ad_file
raw_h5ad_mtx = get_raw_h5ad_file
output:
h5ad_mtx = os.path.join(config["analysisDir"], "data/{sample}.h5ad"),
gene_name_txt = os.path.join(config["analysisDir"], "data/{sample}.h5ad.all.genes.txt")
Expand All @@ -172,7 +173,7 @@ rule raw_h5ad_to_filtered_h5ad:
"bash -c ' source $HOME/.bashrc; \
conda activate cnmf_env; \
python workflow/scripts/filter_to_h5ad.py \
--input_h5ad {input.seurat_object} \
--input_h5ad {input.raw_h5ad_mtx} \
--output_h5ad {output.h5ad_mtx} \
--output_gene_name_txt {output.gene_name_txt} ' "

Expand Down

0 comments on commit 328404c

Please sign in to comment.