Skip to content

Commit

Permalink
deseq and heatmap changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CChahrour committed Jan 11, 2024
1 parent 1286f4b commit e6f199c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
5 changes: 2 additions & 3 deletions seqnado/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def setup_configuration(assay, genome, template_data):
if template_data['split_fastq']:
template_data.update['split_fastq_parts'] = get_user_input("How many parts do you want to split the FASTQ files into?", default="4")


template_data['make_bigwigs'] = get_user_input("Do you want to make bigwigs? (yes/no)", default="no", is_boolean=True)
if template_data['make_bigwigs']:
template_data['pileup_method'] = get_user_input("Pileup method:", default="deeptools", choices=["deeptools", "homer"])
Expand Down Expand Up @@ -184,7 +183,7 @@ def setup_configuration(assay, genome, template_data):
callpeak: -c 0.5
heatmap:
options:
options: --binSize 100 --beforeRegionStartLength 3000 --afterRegionStartLength 3000 --regionBodyLength 5000
colormap: RdYlBu_r
"""

Expand Down Expand Up @@ -215,7 +214,7 @@ def setup_configuration(assay, genome, template_data):
bamcoverage: -bs 1 --normalizeUsing CPM
heatmap:
options:
options: --binSize 100 --beforeRegionStartLength 3000 --afterRegionStartLength 3000 --regionBodyLength 5000
colormap: RdYlBu_r
"""

Expand Down
25 changes: 13 additions & 12 deletions seqnado/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def fastq_files(self):
@property
def sample_names_all(self):
return self.design["sample"].to_list()

@property
def translation(self):
fq_translation = {}
Expand Down Expand Up @@ -346,6 +346,16 @@ def define_output_files(
)

elif assay == "RNA":
assay_output.extend(
[
"seqnado_output/feature_counts/read_counts.tsv",
*expand(
"seqnado_output/aligned/{sample}.bam",
sample=sample_names,
),
]
)

if make_bigwigs and pileup_method:
assay_output.extend(
expand(
Expand All @@ -357,18 +367,9 @@ def define_output_files(
)

if run_deseq2:
project_id = kwargs["deseq2"].get("project_id")
assay_output.append(f"DESeq2_{project_id}.html")
project_id = kwargs["project_name"]
assay_output.append(f"deseq2_{project_id}.html")

assay_output.extend(
[
"seqnado_output/feature_counts/read_counts.tsv",
*expand(
"seqnado_output/aligned/{sample}.bam",
sample=sample_names,
),
]
)

elif assay == "SNP":
if call_snps:
Expand Down
4 changes: 2 additions & 2 deletions seqnado/workflow/rules/deseq2_rna.smk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ if config["run_deseq2"]:
rule deseq2_report_rnaseq:
input:
counts="seqnado_output/feature_counts/read_counts.tsv",
qmd=f"DESeq2_{config['project_name']}.qmd",
qmd=f"deseq2_{config['project_name']}.qmd",
output:
deseq2=f"DESeq2_{config['project_name']}.html",
deseq2=f"deseq2_{config['project_name']}.html",
log:
"seqnado_output/logs/deseq2/deseq2.log",
container:
Expand Down
4 changes: 1 addition & 3 deletions seqnado/workflow/rules/heatmap.smk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rule heatmap_matrix:
mem_mb=lambda wildcards, attempt: 16000 * 2**attempt,
log:
"seqnado_output/logs/heatmap/matrix.log",
shell: """computeMatrix scale-regions --beforeRegionStartLength 3000 --afterRegionStartLength 3000 --regionBodyLength 5000 --smartLabels --missingDataAsZero -p {threads} {params.options} -S {input.bigwigs} -R {params.gtf} -o {output.matrix} >> {log} 2>&1"""
shell: """computeMatrix scale-regions -p {threads} {params.options} --smartLabels --missingDataAsZero -S {input.bigwigs} -R {params.gtf} -o {output.matrix} >> {log} 2>&1"""

rule heatmap_plot:
input:
Expand All @@ -44,8 +44,6 @@ rule heatmap_metaplot:
matrix="seqnado_output/heatmap/heatmap_matrix.mat.gz",
output:
metaplot="seqnado_output/heatmap/metaplot.pdf",
params:
colormap = utils.check_options(config["heatmap"]["colormap"]),
resources:
mem_mb=lambda wildcards, attempt: 2000 * 2**attempt,
log:
Expand Down
3 changes: 2 additions & 1 deletion seqnado/workflow/snakefile_atac
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ rule all:
onsuccess:
slurm_files = glob.glob("slurm-*.out")
sps_files = glob.glob("sps-*")
simg_files = glob.glob("*.simg")

for fn in [*slurm_files, *sps_files]:
for fn in [*slurm_files, *sps_files, *simg_files]:
try:
if not os.path.isdir(fn):
os.remove(fn)
Expand Down
3 changes: 2 additions & 1 deletion seqnado/workflow/snakefile_chip
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ rule all:
onsuccess:
slurm_files = glob.glob("slurm-*.out")
sps_files = glob.glob("sps-*")
simg_files = glob.glob("*.simg")

for fn in [*slurm_files, *sps_files]:
for fn in [*slurm_files, *sps_files, *simg_files]:
try:
if not os.path.isdir(fn):
os.remove(fn)
Expand Down
3 changes: 2 additions & 1 deletion seqnado/workflow/snakefile_rna
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ rule all:
onsuccess:
slurm_files = glob.glob("slurm-*.out")
sps_files = glob.glob("sps-*")
simg_files = glob.glob("*.simg")

for fn in [*slurm_files, *sps_files]:
for fn in [*slurm_files, *sps_files, *simg_files]:
try:
if not os.path.isdir(fn):
os.remove(fn)
Expand Down
3 changes: 2 additions & 1 deletion seqnado/workflow/snakefile_snp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ rule all:
onsuccess:
slurm_files = glob.glob("slurm-*.out")
sps_files = glob.glob("sps-*")
simg_files = glob.glob("*.simg")

for fn in [*slurm_files, *sps_files]:
for fn in [*slurm_files, *sps_files, *simg_files]:
try:
if not os.path.isdir(fn):
os.remove(fn)
Expand Down

0 comments on commit e6f199c

Please sign in to comment.