-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnakefile
82 lines (75 loc) · 2.15 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
include_barcode_matrix = True
if os.path.isfile('input/selected.txt'):
file = open("input/selected.txt", "r")
samples = [line.rstrip() for line in file]
else:
samples = glob_wildcards("input/{sample}/msi").sample
if os.path.isfile('input/exclude.txt'):
file = open("input/exclude.txt", "r")
samples = list(set(samples).difference(set([line.rstrip() for line in file])))
if include_barcode_matrix:
output_file = "spaceranger_aggregated"
else:
output_file = "spaceranger"
rule all:
input:
expand("output/{sample}/"+output_file+"/filtered_feature_bc_matrix.h5", sample=samples)
rule check_inputs:
message:
'Checking inputs.'
conda: 'magpie'
input:
"input/"
output:
"output/summary.csv"
params:
verbose = True
script:
"scripts/check_inputs.py"
rule perform_coreg:
message:
"Performing co-registration."
conda: 'magpie'
input:
"input/{sample}/msi/MSI_metadata.csv",
"output/summary.csv"
output:
"output/{sample}/transformed.csv",
"output/{sample}/transformed.png"
params:
no_HE_transform = 'affine',
MSI2HE_transform = 'affine',
HE2HE_transform = 'TPS',
sample = "{sample}",
verbose = True
script:
"scripts/alter_data.py"
rule make_spaceranger:
message:
"Creating spaceranger formatted output."
conda: 'magpie'
input:
"output/{sample}/transformed.csv",
"output/{sample}/transformed.png"
output:
"output/{sample}/spaceranger/filtered_feature_bc_matrix.h5"
params:
sample = "{sample}",
verbose = True
script:
"scripts/create_mock_spaceranger.py"
rule create_barcode_matrix:
message:
"Generating aggregated data."
conda: 'magpie'
input:
"output/{sample}/spaceranger/filtered_feature_bc_matrix.h5"
output:
"output/{sample}/spaceranger_aggregated/filtered_feature_bc_matrix.h5"
params:
sample = "{sample}",
agg_fn = 'mean',
verbose = True,
only_within_tissue = False
script:
"scripts/create_perbarcode_matrix.py"