-
Notifications
You must be signed in to change notification settings - Fork 0
/
call_md.smk
53 lines (42 loc) · 1.37 KB
/
call_md.smk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
configfile: "config/config.yaml"
cluster_config: "config/cluster.yaml"
include: "helpers.py"
#make sure the output folder exists before running anything
hisat_outdir = get_output_dir(config["project_top_level"], config['histat3n_output_folder'])
mdcalleddir = get_output_dir(config["project_top_level"], config['mdcalleddir'])
os.system("mkdir -p {0}".format(mdcalleddir))
SAMPLES = pd.read_csv(config["sampleCSVpath"], sep = ",")
SAMPLES = SAMPLES.replace(np.nan, '', regex=True)
SAMPLE_NAMES = SAMPLES['sample_name'].tolist()
GENOME_DIR = config['GENOME_DIR']
GENOME_FA = config['fasta']
rule all_call:
input:
expand(mdcalleddir + "{name}.mdcalled.bam", name = SAMPLE_NAMES),
expand(mdcalleddir + "{name}.mdcalled.bam.bai", name = SAMPLE_NAMES)
rule call_md_tag:
wildcard_constraints:
name="|".join(SAMPLE_NAMES)
input:
hisat_outdir + "{name}.sorted.bam"
output:
mdcalleddir + "{name}.mdcalled.bam"
threads:
4
shell:
"""
echo "Processing {input} file..."
samtools calmd -@ 4 -b {input} {GENOME_FA} > {output}
"""
rule index_mdcalled:
wildcard_constraints:
name="|".join(SAMPLE_NAMES),
input:
mdcalleddir + "{name}.mdcalled.bam"
output:
mdcalleddir + "{name}.mdcalled.bam.bai"
shell:
"""
samtools index {input}
"""