Skip to content

Commit

Permalink
add salmon output into design
Browse files Browse the repository at this point in the history
  • Loading branch information
CChahrour committed Mar 28, 2024
1 parent b585e1b commit be0ecf6
Show file tree
Hide file tree
Showing 6 changed files with 657 additions and 29 deletions.
579 changes: 579 additions & 0 deletions salmon.txt

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions seqnado/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def setup_configuration(assay, genome, template_data):
"Path to fastqscreen config:",
default="/ceph/project/milne_group/shared/seqnado_reference/fastqscreen_reference/fastq_screen.conf",
)

# Blacklist
template_data["remove_blacklist"] = get_user_input(
"Do you want to remove blacklist regions? (yes/no)",
Expand All @@ -108,8 +108,8 @@ def setup_configuration(assay, genome, template_data):
)
# Library Complexity
template_data["library_complexity"] = get_user_input(
"Calculate library complexity? (yes/no)", default="no", is_boolean=True
)
"Calculate library complexity? (yes/no)", default="no", is_boolean=True
)
else:
template_data["remove_pcr_duplicates_method"] = "False"
template_data["library_complexity"] = "False"
Expand Down Expand Up @@ -169,6 +169,26 @@ def setup_configuration(assay, genome, template_data):
choices=["lanceotron", "macs", "homer"],
)

# RNA options
template_data["rna_quantification"] = (
get_user_input(
"RNA quantification method:",
default="feature_counts",
choices=["feature_counts", "salmon"],
)
if assay == "rna"
else "False"
)

template_data["salmon_index"] = (
get_user_input(
"Path to salmon index:",
default="/ceph/project/milne_group/shared/salmon_ref/hg38/cDNA/Homo_sapiens.GRCh38.cdna.all.fa.gz",
)
if template_data["rna_quantification"] == "salmon"
else "False"
)

# Run DESeq2
template_data["run_deseq2"] = (
get_user_input("Run DESeq2? (yes/no)", default="no", is_boolean=True)
Expand Down Expand Up @@ -256,6 +276,10 @@ def setup_configuration(assay, genome, template_data):
threads: 16
options: -s 0 -p --countReadPairs -t exon -g gene_id
salmon:
threads: 16
options: --libType A
homer:
maketagdirectory:
makebigwig:
Expand Down
6 changes: 5 additions & 1 deletion seqnado/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,14 @@ class RNAOutput(Output):
assay: Literal["RNA"]
project_name: str
run_deseq2: bool = False
rna_quantification: Optional[Literal["feature_counts", "salmon"]] = None

@property
def counts(self):
return ["seqnado_output/feature_counts/read_counts.tsv"]
if self.rna_quantification == "feature_counts":
return ["seqnado_output/quantification/feature_counts/read_counts.tsv"]
elif self.rna_quantification == "salmon":
return ["seqnado_output/quantification/salmon/quant.sf"]

@property
def deseq2(self):
Expand Down
3 changes: 3 additions & 0 deletions seqnado/workflow/config/config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ make_heatmaps: "{{make_heatmaps}}"
call_peaks: "{{call_peaks}}"
peak_calling_method: "{{peak_calling_method}}"

rna_quantification: "{{rna_quantification}}"
salmon_index: "{{salmon_index}}"

run_deseq2: "{{run_deseq2}}"


Expand Down
47 changes: 43 additions & 4 deletions seqnado/workflow/rules/alignment_counts.smk
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
from seqnado.helpers import check_options



rule feature_counts:
input:
bam=expand("seqnado_output/aligned/{sample}.bam", sample=SAMPLE_NAMES),
bai=expand("seqnado_output/aligned/{sample}.bam.bai", sample=SAMPLE_NAMES),
annotation=config["genome"]["gtf"],
output:
counts="seqnado_output/feature_counts/read_counts.tsv",
counts="seqnado_output/quantification/feature_counts/read_counts.tsv",
params:
options=check_options(config["featurecounts"]["options"]),
threads: config["featurecounts"]["threads"]
resources:
mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB",
runtime="2h",
log:
"seqnado_output/logs/readcounts/featurecounts/featurecounts.log",
"seqnado_output/logs/quantification/featurecounts/featurecounts.log",
shell:
"""
featureCounts \
Expand All @@ -30,3 +28,44 @@ rule feature_counts:
{input.bam} \
> {log} 2>&1
"""

rule salmon_counts_paired:
input:
fq1="seqnado_output/fastq/{sample}_1.fastq.gz", sample=SAMPLE_NAMES,
fq2="seqnado_output/fastq/{sample}_2.fastq.gz", sample=SAMPLE_NAMES,
output:
counts="seqnado_output/quantification/salmon/quant.sf",
params:
index=config["salmon"]["index"],
options=check_options(config["salmon"]["options"]),
threads: config["salmon"]["threads"]
resources:
mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB",
runtime="2h",
log:
"seqnado_output/logs/readcounts/salmon/salmon.log",
shell:
"""
salmon quant -p -t {params.index} {params.options} -1 {input.fq1} -2 {input.fq2} -p {threads} -o seqnado_output/quantification/salmon
"""

rule salmon_counts_single:
input:
fq="seqnado_output/fastq/{sample}.fastq.gz", sample=SAMPLE_NAMES,
output:
counts="seqnado_output/quantification/salmon/quant.sf",
params:
index=config["salmon"]["index"],
options=check_options(config["salmon"]["options"]),
threads: config["salmon"]["threads"]
resources:
mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB",
runtime="2h",
log:
"seqnado_output/logs/readcounts/salmon/salmon.log",
shell:
"""
salmon quant -t {params.index} {params.options} -r {input.fq} -p {threads} -o seqnado_output/quantification/salmon
"""

ruleorder: feature_counts > salmon_counts_paired > salmon_counts_single
21 changes: 0 additions & 21 deletions seqnado/workflow/rules/transcript_counts.smk

This file was deleted.

0 comments on commit be0ecf6

Please sign in to comment.