-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnakefile
63 lines (47 loc) · 1.34 KB
/
Snakefile
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
54
55
56
57
58
59
60
61
62
63
import sys
import logging
from snakemake.io import glob_wildcards, expand
import glob,os
import pathlib
import csv
import pandas as pd
import numpy as np
#run with snakemake --profile slurm --use-conda
#import multiqc
DATADIR_SHORT="/beegfs/scratch/ric.cosr/ric.cosr/Menarini/ALL_BAM_sorted_markdup/start/"
files = []
for file_name in os.listdir(DATADIR_SHORT):
if file_name.endswith("_markdup.bam"):
files.append(file_name)
SUFF = []
SAMPLELIST = []
for file in files:
A = file.split("_")[0]
B = file.split("_")[1]
E = A + '_' + B
SUFF.append(E)
SUFF=set(SUFF)
SUFFIX = ' '.join(map(str, SUFF))
print("SUFFIX", SUFFIX)
#SUFFIX = "URIN101220_D10_2linfocitiadesi"
path = "logs_slurm"
try:
os.mkdir(path)
except OSError:
print ("Creation of the directory %s failed" % path)
else:
print ("Successfully created the directory %s " % path)
rule all:
input:
expand(["coverage/{pref}_coverage.txt"], pref=SUFFIX.split(' '))
rule bTb:
input:
BAM = "/beegfs/scratch/ric.cosr/ric.cosr/Menarini/ALL_BAM_sorted_markdup/start/{pref}_markdup.bam",
output:
"coverage/{pref}_coverage.txt"
resources: time_min = 5000, mem_mb=2500, cpus = 1
shell:"""
mkdir -p bed
count=$(samtools view -F 4 -c {input.BAM})
echo -e "{wildcards.pref}\t$count" > {output}
"""