Commit ab7ddb3f authored by bow's avatar bow
Browse files

Update flt3 detection and plotting

parent e005d9e6
......@@ -12,9 +12,9 @@ OUTPUTS = dict(
fqs="{sample}/{sample}-{pair}.fq.gz",
fqs_stats="{sample}/qc-seq/{sample}-seq-stats.json",
flt3_bam="{sample}/itd-flt3/{sample}.flt3.bam",
flt3_sc_json="{sample}/itd-flt3/{sample}.flt3-sc.json",
flt3_sc_csv="{sample}/itd-flt3/{sample}.flt3-sc.roi.csv",
flt3_sc_plots="{sample}/itd-flt3/{sample}.flt3-sc.png",
flt3_csv="{sample}/itd-flt3/{sample}.flt3.csv",
flt3_bg_csv="{sample}/itd-flt3/{sample}.bg.csv",
flt3_png="{sample}/itd-flt3/{sample}.flt3.png",
smallvars_bam="{sample}/snv-indels/{sample}.snv-indel.bam",
smallvars_vcf="{sample}/snv-indels/{sample}.annotated.vcf.gz",
smallvars_csv_all="{sample}/snv-indels/{sample}.variants_all.csv",
......
......@@ -4,15 +4,10 @@ from rattle import Run
RUN = Run(config)
RUN.set_default_setting("extract_sc_flt3",
srcdir(path.join("scripts", "extract_sc_flt3.py")))
RUN.set_default_setting("plot_sc_linear_flt3",
srcdir(path.join("scripts", "plot_sc_linear_flt3.py")))
RUN.set_default_setting("json2csv",
srcdir(path.join("scripts", "json2csv.py")))
# TODO: deploy fidus_exe and plot script properly
# Region of interest ~ exon 14-15 in transcript coordinates.
RUN.set_default_setting("flt3_name", "FLT3-001")
RUN.set_default_setting("flt3_start", 1787)
RUN.set_default_setting("flt3_end", 2024)
......@@ -39,44 +34,32 @@ rule align_flt3:
" | samtools view -Sbh -F 0x4 -"
" | picard SortSam I=/dev/stdin O={output.bam} SO=coordinate CREATE_INDEX=true"
rule extract_sc_flt3:
rule detect_flt3:
input:
bam=RUN.output("{sample}/itd-flt3/{sample}.flt3.bam"),
bai=RUN.output("{sample}/itd-flt3/{sample}.flt3.bai"),
ref=RUN.settings["flt3_fasta"],
scr=RUN.settings["extract_sc_flt3"],
output:
json=RUN.output("{sample}/itd-flt3/{sample}.flt3-sc.json"),
conda: srcdir("envs/extract_sc_flt3.yml")
threads: 2
shell:
"python {input.scr} --nthreads {threads} --region FLT3-001 --sample-id {wildcards.sample} {input.ref} {input.bam}"
" > {output.json}"
rule plot_sc_linear_flt3:
input:
counts=RUN.output("{sample}/itd-flt3/{sample}.flt3-sc.json"),
scr=RUN.settings["plot_sc_linear_flt3"],
bg=RUN.settings["bg_soft_clip_csv"],
exe=RUN.settings["fidus_exe"],
output:
png=RUN.output("{sample}/itd-flt3/{sample}.flt3-sc.png"),
csv=RUN.output("{sample}/itd-flt3/{sample}.flt3.csv"),
bg_csv=RUN.output("{sample}/itd-flt3/{sample}.bg.csv"),
threads: 1
params:
trx_name=RUN.settings["flt3_name"],
start=RUN.settings["flt3_start"],
end=RUN.settings["flt3_end"],
conda: srcdir("envs/plot_sc_linear_flt3.yml")
shell:
"python {input.scr} --sc-bg {input.bg} --min-scl-count 2 --min-insert-count 2"
" --fuzziness 12 --padding 0 {input.counts} {params.start} {params.end} {output.png}"
"{input.exe} -r {params.trx_name}:{params.start}-{params.end} --bg-counts {output.bg_csv} {input.ref} {input.bam} > {output.csv}"
rule flt3_json_to_csv:
rule plot_itd:
input:
json=RUN.output("{sample}/itd-flt3/{sample}.flt3-sc.json"),
scr=RUN.settings["json2csv"],
csv=RUN.output("{sample}/itd-flt3/{sample}.flt3.csv"),
bg_csv=RUN.output("{sample}/itd-flt3/{sample}.bg.csv"),
scr=RUN.settings["plot_itd"],
output:
csv=RUN.output("{sample}/itd-flt3/{sample}.flt3-sc.roi.csv"),
params:
start=RUN.settings["flt3_start"],
end=RUN.settings["flt3_end"],
conda: srcdir("envs/flt3_csv.yml")
png=RUN.output("{sample}/itd-flt3/{sample}.flt3.png"),
threads: 1
conda: RUN.settings["plot_itd_conda"]
shell:
"python {input.scr} {input.json} {wildcards.sample} --start {params.start} --end {params.end} > {output.csv}"
"python {input.scr} tracks {input.csv} {input.bg_csv}"
" --sample-id {wildcards.sample} {output.png}"
channels:
- bioconda
- r
- defaults
- conda-forge
dependencies:
- biopython=1.68=np111py35_0
- click=6.7=py35_0
- pip=9.0.1=py35_1
- pysam=0.9.1=py35_0
- python=3.5.3=1
- pip:
- "git+https://github.com/brentp/align@ef350d27ac0d7733740482b33074c682ab233e89#align"
channels:
- bioconda
- r
- defaults
- conda-forge
dependencies:
- click=6.6=py35_0
- pandas=0.18.1=np111py35_0
channels:
- bioconda
- r
- defaults
- conda-forge
dependencies:
- click=6.6=py35_0
- matplotlib=1.5.1=np111py35_0
- pandas=0.18.1=np111py35_0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment