-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_rules.smk
831 lines (803 loc) · 42 KB
/
custom_rules.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
"""Custom rules used in the ``snakemake`` pipeline.
This file is included by the pipeline ``Snakefile``.
"""
rule spatial_distances:
"""Get spatial distances from PDB."""
input:
pdb="data/7puy.pdb",
output:
csv="results/spatial_distances/spatial_distances.csv",
params:
target_chains=["a", "b", "c", "A", "B", "C"],
log:
log="results/logs/spatial_distances.txt",
conda:
os.path.join(config["pipeline_path"], "environment.yml")
script:
"scripts/spatial_distances.py"
rule averaged_ridgeplot_func_scores:
"""
Average the functional score variants by type
and display as a ridgeplot for the final functional
selections used in the averages.
"""
input:
func_scores="results/func_effects/averages/293T_entry_func_effects.csv",
nb="notebooks/visualize_func_scores_by_variant_type.ipynb",
params:
libA_1="LibA-220823-293T-1",
libA_2="LibA-220823-293T-2",
libA_3="LibA-220907-293T-1",
libA_4="LibA-220907-293T-2",
libB_1="LibB-220823-293T-1",
libB_2="LibB-220823-293T-2",
libB_3="LibB-220907-293T-1",
libB_4="LibB-220907-293T-2",
summary_dir="results/func_scores/",
score_dir="results/func_scores/",
html_dir="results/averaged_func_scores_ridgeplot/"
output:
html_output="results/averaged_func_scores_ridgeplot/averaged_func_scores_ridgeplot.html",
nb="results/notebooks/visualize_func_scores_by_variant_type.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/averaged_ridgeplot_func_scores.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p libA_1 {params.libA_1} \
-p libA_2 {params.libA_2} \
-p libA_3 {params.libA_3} \
-p libA_4 {params.libA_4} \
-p libB_1 {params.libB_1} \
-p libB_2 {params.libB_2} \
-p libB_3 {params.libB_3} \
-p libB_4 {params.libB_4} \
-p summary_dir {params.summary_dir} \
-p score_dir {params.score_dir} \
-p html_dir {params.html_dir} \
-p html_output {output.html_output} \
&> {log}
"""
rule visualize_mutation_distributions:
"""
Create altair version of amino-acid count
distribution plots.
"""
input:
variant_data = "results/variants/codon_variants.csv",
nb="notebooks/visualize_mutation_distributions.ipynb",
params:
out_dir="results/summary_of_libraries/",
output:
out_file="results/summary_of_libraries/present_and_absent_mutations_in_DMS_libraries.csv",
nb="results/notebooks/visualize_mutation_distributions.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/visualize_mutation_distributions.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p variant_data {input.variant_data} \
-p out_dir {params.out_dir} \
-p out_file {output.out_file} \
&> {log}
"""
rule single_mutant_global_epistasis_analysis:
"""
Create correlation plots of raw functional scores
and functional effects from global epistasis model.
"""
input:
func_effects = "results/func_effects/averages/293T_entry_func_effects.csv",
nb="notebooks/func_scores_vs_func_effects.ipynb",
params:
libA_1="LibA-220823-293T-1",
libA_2="LibA-220823-293T-2",
libA_3="LibA-220907-293T-1",
libA_4="LibA-220907-293T-2",
libB_1="LibB-220823-293T-1",
libB_2="LibB-220823-293T-2",
libB_3="LibB-220907-293T-1",
libB_4="LibB-220907-293T-2",
scores_dir="results/func_scores/",
effects_dir="results/func_effects/by_selection/",
output:
nb="results/notebooks/func_scores_vs_func_effects.ipynb",
conda:
os.path.join(config["pipeline_path"], "environment.yml")
log:
"results/logs/func_scores_vs_func_effects.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p libA_1 {params.libA_1} \
-p libA_2 {params.libA_2} \
-p libA_3 {params.libA_3} \
-p libA_4 {params.libA_4} \
-p libB_1 {params.libB_1} \
-p libB_2 {params.libB_2} \
-p libB_3 {params.libB_3} \
-p libB_4 {params.libB_4} \
-p scores_dir {params.scores_dir} \
-p effects_dir {params.effects_dir} \
&> {log}
"""
rule library_replicate_correlations:
"""
Create correlation plots of library replicates.
"""
input:
func_effects = "results/func_effects/averages/293T_entry_func_effects.csv",
nb="notebooks/library_func_effects_correlations.ipynb",
params:
libA_1="LibA-220823-293T-1",
libA_2="LibA-220823-293T-2",
libA_3="LibA-220907-293T-1",
libA_4="LibA-220907-293T-2",
libB_1="LibB-220823-293T-1",
libB_2="LibB-220823-293T-2",
libB_3="LibB-220907-293T-1",
libB_4="LibB-220907-293T-2",
effects_dir="results/func_effects/by_selection/",
MTS=2,
output:
nb="results/notebooks/library_func_effects_correlations.ipynb",
conda:
os.path.join(config["pipeline_path"], "environment.yml")
log:
"results/logs/library_func_effects_correlations.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p libA_1 {params.libA_1} \
-p libA_2 {params.libA_2} \
-p libA_3 {params.libA_3} \
-p libA_4 {params.libA_4} \
-p libB_1 {params.libB_1} \
-p libB_2 {params.libB_2} \
-p libB_3 {params.libB_3} \
-p libB_4 {params.libB_4} \
-p effects_dir {params.effects_dir} \
-p MTS {params.MTS} \
&> {log}
"""
rule human_mastomys_correlation:
"""
Correlation of functional scores from humanDAG1
vs mastomysDAG1 expressing cells.
"""
input:
hek293T_scores="results/func_effects/averages/293T_entry_func_effects.csv",
humanDAG1_scores="results/func_effects/averages/human_293T_entry_func_effects.csv",
mastomysDAG1_scores="results/func_effects/averages/mastomys_293T_entry_func_effects.csv",
avg_shifts="results/func_effect_shifts/averages/aDG_comparison_shifts.csv", # dummy file
nb="notebooks/human_mastomys_correlation.ipynb",
params:
MTS=2, # min_times_seen
n_selections=8,
shift_file_dir="results/func_effect_shifts/by_comparison/",
html_dir="results/DAG1_ortholog_correlations/",
output:
html_output="results/DAG1_ortholog_correlations/DAG1_ortholog_correlations.html",
multidms_shrinkage_plot="results/DAG1_ortholog_correlations/DAG1_shrinkage_plot.svg",
multidms_shift_profile="results/DAG1_ortholog_correlations/multidms_shift_profile.svg",
nb="results/notebooks/human_mastomys_correlation.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/human_mastomys_correlation.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p HEK293T_data_path {input.hek293T_scores} \
-p humanDAG1_data_path {input.humanDAG1_scores} \
-p mastomysDAG1_data_path {input.mastomysDAG1_scores} \
-p MTS {params.MTS} \
-p n_selections {params.n_selections} \
-p shift_file_dir {params.shift_file_dir} \
-p html_dir {params.html_dir} \
-p html_output {output.html_output} \
-p multidms_shrinkage_plot {output.multidms_shrinkage_plot} \
-p multidms_shift_profile {output.multidms_shift_profile} \
&> {log}
"""
rule validation_titers:
"""
Correlation of single mutant validations titers to
predicted values from DMS pipeline.
"""
input:
titers="data/single_mutant_functional_validations.csv",
func_scores="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
nb="notebooks/validation_titers.ipynb",
params:
out_dir="results/validation_plots/",
output:
saved_image_path="results/validation_plots/functional_validation_correlation.svg",
nb="results/notebooks/validation_titers.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/validation_titers.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p validation_titers_path {input.titers} \
-p functional_scores_path {input.func_scores} \
-p out_dir {params.out_dir} \
-p saved_image_path {output.saved_image_path} \
&> {log}
"""
rule validation_neuts_89F:
"""
Correlation of single mutant validations for 8.9F to
predicted values from DMS pipeline.
"""
input:
frac_infected="data/validation_frac_infected_89F.csv",
neuts="data/validation_neuts_89F.csv",
predicted_scores="results/antibody_escape/averages/89F_mut_effect.csv",
nb="notebooks/validation_neuts_89F.ipynb",
params:
out_dir="results/validation_plots/",
output:
neuts_image_path="results/validation_plots/validation_neut_curves_89F.svg",
corr_image_path="results/validation_plots/89F_validation_correlation.svg",
nb="results/notebooks/validation_neuts_89F.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/validation_neuts_89F.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p fraction_infected_89F_path {input.frac_infected} \
-p validation_neuts_89F_path {input.neuts} \
-p model_predictions_path {input.predicted_scores} \
-p out_dir {params.out_dir} \
-p neuts_image_path {output.neuts_image_path} \
-p corr_image_path {output.corr_image_path} \
&> {log}
"""
rule visualize_RBD_regions:
"""
Heatmaps of alpha-dystroglycan and LAMP1
binding residues.
"""
input:
func_scores="results/func_effects/averages/293T_entry_func_effects.csv",
nb="notebooks/visualize_RBD_regions.ipynb",
params:
min_times_seen=2,
n_selections=8,
html_dir="results/func_scores_distributions/",
output:
html_output="results/func_scores_distributions/func_scores_distributions.html",
nb="results/notebooks/visualize_RBD_regions.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/visualize_RBD_regions.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p func_scores {input.func_scores} \
-p min_times_seen {params.min_times_seen} \
-p n_selections {params.n_selections} \
-p html_dir {params.html_dir} \
-p html_output {output.html_output} \
&> {log}
"""
rule compare_to_natural:
"""
Compare DMS to data to natural sequences and show
any validation neutralization assays for isolates
identified for escape.
"""
input:
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
contacts_89F="data/antibody_contacts/antibody_contacts_89F.csv",
contacts_377H="data/antibody_contacts/antibody_contacts_377H.csv",
contacts_256A="data/antibody_contacts/antibody_contacts_256A.csv",
contacts_2510C="data/antibody_contacts/antibody_contacts_2510C.csv",
contacts_121F="data/antibody_contacts/antibody_contacts_121F.csv",
contacts_372D="data/antibody_contacts/antibody_contacts_372D.csv",
func_scores="results/func_effects/averages/293T_entry_func_effects.csv",
natural_sequence_variation="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_protein_variation.csv",
natural_GPC_sequence_alignment="non-pipeline_analyses/LASV_phylogeny_analysis/Results/LASV_GPC_protein_alignment.fasta",
fraction_infected_natural_isolates="data/validation_frac_infected_natural_isolates.csv",
nb="notebooks/compare_to_natural_data.ipynb",
params:
min_times_seen=2,
n_selections=8,
out_dir="results/validation_plots/",
out_dir_escape="results/antibody_escape_profiles/",
out_dir_natural="results/natural_isolate_escape/",
output:
neuts_image_path="results/validation_plots/validation_neut_curves_natural_isolates.svg",
neuts_256A_image_path="results/validation_plots/validation_neut_256A_curves_natural_isolates.svg",
corr_image_path="results/validation_plots/natural_isolate_validation_correlation.svg",
corr_256A_image_path="results/validation_plots/natural_isolate_validation_256A_correlation.svg",
escape_top10_image_path="results/antibody_escape_profiles/natural_isolate_top10_escape_profiles.svg",
escape_all_image_path="results/antibody_escape_profiles/natural_isolate_all_escape_profiles.svg",
escape_all_256A_image_path="results/antibody_escape_profiles/natural_isolate_all_256A_escape_profiles.svg",
natural_escape="results/natural_isolate_escape/natural_isolate_escape.svg",
html_nat_mut_freqs_vs_escape="results/natural_isolate_escape/nat_mut_freqs_vs_escape.html",
html_nat_mut_freqs_vs_escape_all_abs="results/natural_isolate_escape/nat_mut_freqs_vs_escape_all_abs.html",
html_natural_vs_escape="results/natural_isolate_escape/natural_vs_escape.html",
html_natural_vs_escape_all_abs="results/natural_isolate_escape/natural_vs_escape_all_abs.html",
html_arevirumab_comparisons="results/antibody_escape_profiles/arevirumab_comparisons.html",
nb="results/notebooks/compare_to_natural_data.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/compare_to_natural.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p filtered_escape_377H {input.filtered_escape_377H} \
-p filtered_escape_89F {input.filtered_escape_89F} \
-p filtered_escape_2510C {input.filtered_escape_2510C} \
-p filtered_escape_121F {input.filtered_escape_121F} \
-p filtered_escape_256A {input.filtered_escape_256A} \
-p filtered_escape_372D {input.filtered_escape_372D} \
-p contacts_89F {input.contacts_89F} \
-p contacts_377H {input.contacts_377H} \
-p contacts_256A {input.contacts_256A} \
-p contacts_2510C {input.contacts_2510C} \
-p contacts_121F {input.contacts_121F} \
-p contacts_372D {input.contacts_372D} \
-p func_scores {input.func_scores} \
-p natural_sequence_variation {input.natural_sequence_variation} \
-p natural_GPC_sequence_alignment {input.natural_GPC_sequence_alignment} \
-p fraction_infected_natural_isolates {input.fraction_infected_natural_isolates} \
-p min_times_seen {params.min_times_seen} \
-p n_selections {params.n_selections} \
-p out_dir {params.out_dir} \
-p out_dir_escape {params.out_dir_escape} \
-p out_dir_natural {params.out_dir_natural} \
-p neuts_image_path {output.neuts_image_path} \
-p neuts_256A_image_path {output.neuts_256A_image_path} \
-p corr_image_path {output.corr_image_path} \
-p corr_256A_image_path {output.corr_256A_image_path} \
-p escape_top10_image_path {output.escape_top10_image_path} \
-p escape_all_image_path {output.escape_all_image_path} \
-p escape_all_256A_image_path {output.escape_all_256A_image_path} \
-p natural_escape {output.natural_escape} \
-p html_nat_mut_freqs_vs_escape {output.html_nat_mut_freqs_vs_escape} \
-p html_nat_mut_freqs_vs_escape_all_abs {output.html_nat_mut_freqs_vs_escape_all_abs} \
-p html_natural_vs_escape {output.html_natural_vs_escape} \
-p html_natural_vs_escape_all_abs {output.html_natural_vs_escape_all_abs} \
-p html_arevirumab_comparisons {output.html_arevirumab_comparisons} \
&> {log}
"""
rule GPC_region_comparisons_to_natural:
"""
Compare functional effects of mutations to
natural variation for different GPC regions.
"""
input:
natural_sequence_variation="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_protein_variation.csv",
filtered_func_293T="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
nb="notebooks/func_effects_vs_natural_variation.ipynb",
params:
html_dir="results/func_scores_distributions/",
output:
html_output="results/func_scores_distributions/func_scores_vs_natural_variation_by_region.html",
nb="results/notebooks/func_effects_vs_natural_variation.ipynb",
conda:
os.path.join(config["pipeline_path"], "environment.yml")
log:
"results/logs/GPC_region_comparisons_to_natural.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p natural_sequence_variation {input.natural_sequence_variation} \
-p filtered_func_293T {input.filtered_func_293T} \
-p html_dir {params.html_dir} \
-p html_output {output.html_output} \
&> {log}
"""
rule func_effects_of_naturally_present_mutations:
"""
Compare functional effects of mutations to
naturally abundant GPC mutations.
"""
input:
natural_GPC_sequence_alignment="non-pipeline_analyses/LASV_phylogeny_analysis/Results/LASV_GPC_protein_alignment.fasta",
filtered_func_293T="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
nb="notebooks/func_effects_of_naturally_present_mutations.ipynb",
output:
nb="results/notebooks/func_effects_of_naturally_present_mutations.ipynb",
conda:
os.path.join(config["pipeline_path"], "environment.yml")
log:
"results/logs/func_effects_of_naturally_present_mutations.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p natural_GPC_sequence_alignment {input.natural_GPC_sequence_alignment} \
-p filtered_func_293T {input.filtered_func_293T} \
&> {log}
"""
rule natural_sequence_antigenic_analysis:
"""
Compare dms data to natural sequences
to look if there is any antigenic selection.
"""
input:
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
func_scores="results/func_effects/averages/293T_entry_func_effects.csv",
GPC_tree_mutations="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_tree_mutations.csv",
GPC_FEL_results="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_FEL_results.json",
GPC_FUBAR_results="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_FUBAR_results.json",
natural_seq_metadata="non-pipeline_analyses/LASV_phylogeny_analysis/Results/LASV_S_segment_metadata.tsv",
natural_seq_alignment="non-pipeline_analyses/LASV_phylogeny_analysis/Results/LASV_GPC_protein_alignment.fasta",
nb="notebooks/natural_sequence_antigenic_analysis.ipynb",
params:
out_dir_natural="results/natural_isolate_escape/",
min_times_seen=2,
n_selections=8,
output:
ols_regression="results/natural_isolate_escape/ols_regression.html",
nb="results/notebooks/natural_sequence_antigenic_analysis.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/natural_sequence_antigenic_analysis.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p filtered_escape_377H {input.filtered_escape_377H} \
-p filtered_escape_89F {input.filtered_escape_89F} \
-p filtered_escape_2510C {input.filtered_escape_2510C} \
-p filtered_escape_121F {input.filtered_escape_121F} \
-p filtered_escape_256A {input.filtered_escape_256A} \
-p filtered_escape_372D {input.filtered_escape_372D} \
-p func_scores {input.func_scores} \
-p GPC_tree_mutations {input.GPC_tree_mutations} \
-p GPC_FEL_results {input.GPC_FEL_results} \
-p GPC_FUBAR_results {input.GPC_FUBAR_results} \
-p natural_seq_metadata {input.natural_seq_metadata} \
-p natural_seq_alignment {input.natural_seq_alignment} \
-p out_dir_natural {params.out_dir_natural} \
-p min_times_seen {params.min_times_seen} \
-p n_selections {params.n_selections} \
-p ols_regression {output.ols_regression} \
&> {log}
"""
rule get_filtered_CSVs:
"""
Filter antibody escape data based on configuration
for displaying data to easily port to other analysis.
"""
input:
func_scores_293T="results/func_effects/averages/293T_entry_func_effects.csv",
func_scores_human_293T="results/func_effects/averages/human_293T_entry_func_effects.csv",
func_scores_mastomys_293T="results/func_effects/averages/mastomys_293T_entry_func_effects.csv",
escape_377H="results/antibody_escape/averages/377H_mut_effect.csv",
escape_89F="results/antibody_escape/averages/89F_mut_effect.csv",
escape_2510C="results/antibody_escape/averages/2510C_mut_effect.csv",
escape_121F="results/antibody_escape/averages/121F_mut_effect.csv",
escape_256A="results/antibody_escape/averages/256A_mut_effect.csv",
escape_372D="results/antibody_escape/averages/372D_mut_effect.csv",
contacts_89F="data/antibody_contacts/antibody_contacts_89F.csv",
contacts_377H="data/antibody_contacts/antibody_contacts_377H.csv",
contacts_256A="data/antibody_contacts/antibody_contacts_256A.csv",
contacts_2510C="data/antibody_contacts/antibody_contacts_2510C.csv",
contacts_121F="data/antibody_contacts/antibody_contacts_121F.csv",
contacts_372D="data/antibody_contacts/antibody_contacts_372D.csv",
nb="notebooks/get_filtered_CSVs.ipynb",
params:
min_times_seen=2,
min_func_score=-1.5,
n_selections=8,
frac_models=1,
out_dir="results/filtered_antibody_escape_CSVs/",
out_dir_simplified="results/simplified_filtered_antibody_escape_CSVs/",
out_dir_images="results/antibody_escape_profiles/",
out_dir_func="results/filtered_func_effect_CSVs/",
output:
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
simple_filtered_escape_377H="results/simplified_filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
simple_filtered_escape_89F="results/simplified_filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
simple_filtered_escape_2510C="results/simplified_filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
simple_filtered_escape_121F="results/simplified_filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
simple_filtered_escape_256A="results/simplified_filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
simple_filtered_escape_372D="results/simplified_filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
filtered_func_293T="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
filtered_func_human_293T="results/filtered_func_effect_CSVs/human_293T_filtered_func_effects.csv",
filtered_func_mastomys_293T="results/filtered_func_effect_CSVs/mastomys_293T_filtered_func_effects.csv",
func_effect_scale_bar="results/antibody_escape_profiles/func_effect_scale_bar.svg",
escape_scale_bar="results/antibody_escape_profiles/escape_scale_bar.svg",
saved_image_path="results/antibody_escape_profiles/antibody_escape_profiles.svg",
validation_image_path="results/antibody_escape_profiles/validation_escape_profile.svg",
arevirumab_escape_profile="results/antibody_escape_profiles/arevirumab_escape_profile.svg",
nb="results/notebooks/get_filtered_CSVs.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/get_filtered_escape_CSVs.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p func_scores_293T {input.func_scores_293T} \
-p func_scores_human_293T {input.func_scores_human_293T} \
-p func_scores_mastomys_293T {input.func_scores_mastomys_293T} \
-p escape_377H {input.escape_377H} \
-p escape_89F {input.escape_89F} \
-p escape_2510C {input.escape_2510C} \
-p escape_121F {input.escape_121F} \
-p escape_256A {input.escape_256A} \
-p escape_372D {input.escape_372D} \
-p contacts_89F {input.contacts_89F} \
-p contacts_377H {input.contacts_377H} \
-p contacts_256A {input.contacts_256A} \
-p contacts_2510C {input.contacts_2510C} \
-p contacts_121F {input.contacts_121F} \
-p contacts_372D {input.contacts_372D} \
-p min_times_seen {params.min_times_seen} \
-p min_func_score {params.min_func_score} \
-p n_selections {params.n_selections} \
-p frac_models {params.frac_models} \
-p out_dir {params.out_dir} \
-p out_dir_simplified {params.out_dir_simplified} \
-p out_dir_images {params.out_dir_images} \
-p out_dir_func {params.out_dir_func} \
-p filtered_escape_377H {output.filtered_escape_377H} \
-p filtered_escape_89F {output.filtered_escape_89F} \
-p filtered_escape_2510C {output.filtered_escape_2510C} \
-p filtered_escape_121F {output.filtered_escape_121F} \
-p filtered_escape_256A {output.filtered_escape_256A} \
-p filtered_escape_372D {output.filtered_escape_372D} \
-p simple_filtered_escape_377H {output.simple_filtered_escape_377H} \
-p simple_filtered_escape_89F {output.simple_filtered_escape_89F} \
-p simple_filtered_escape_2510C {output.simple_filtered_escape_2510C} \
-p simple_filtered_escape_121F {output.simple_filtered_escape_121F} \
-p simple_filtered_escape_256A {output.simple_filtered_escape_256A} \
-p simple_filtered_escape_372D {output.simple_filtered_escape_372D} \
-p filtered_func_293T {output.filtered_func_293T} \
-p filtered_func_human_293T {output.filtered_func_human_293T} \
-p filtered_func_mastomys_293T {output.filtered_func_mastomys_293T} \
-p func_effect_scale_bar {output.func_effect_scale_bar} \
-p escape_scale_bar {output.escape_scale_bar} \
-p saved_image_path {output.saved_image_path} \
-p validation_image_path {output.validation_image_path} \
-p arevirumab_escape_profile {output.arevirumab_escape_profile} \
&> {log}
"""
rule escape_sites_stratified_by_antibody_distance:
"""
Stratify escape sites by distance to antibody.
"""
input:
contacts_89F="data/antibody_contacts/antibody_contacts_89F.csv",
contacts_377H="data/antibody_contacts/antibody_contacts_377H.csv",
contacts_256A="data/antibody_contacts/antibody_contacts_256A.csv",
contacts_2510C="data/antibody_contacts/antibody_contacts_2510C.csv",
contacts_121F="data/antibody_contacts/antibody_contacts_121F.csv",
contacts_372D="data/antibody_contacts/antibody_contacts_372D.csv",
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
func_scores="results/func_effects/averages/293T_entry_func_effects.csv",
nb="notebooks/escape_vs_antibody_distance.ipynb",
params:
out_dir="results/antibody_escape_profiles/",
min_times_seen=2,
n_selections=8,
output:
func_vs_escape="results/antibody_escape_profiles/antibody_escape_vs_func_effect.html",
func_vs_escape_svg="results/antibody_escape_profiles/antibody_escape_vs_func_effect.svg",
saved_image_path="results/antibody_escape_profiles/antibody_escape_by_distance.svg",
func_distance_image_path="results/antibody_escape_profiles/func_effect_by_distance.svg",
nb="results/notebooks/escape_vs_antibody_distance.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/escape_sites_stratified_by_antibody_distance.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p contacts_89F {input.contacts_89F} \
-p contacts_377H {input.contacts_377H} \
-p contacts_256A {input.contacts_256A} \
-p contacts_2510C {input.contacts_2510C} \
-p contacts_121F {input.contacts_121F} \
-p contacts_372D {input.contacts_372D} \
-p filtered_escape_377H {input.filtered_escape_377H} \
-p filtered_escape_89F {input.filtered_escape_89F} \
-p filtered_escape_2510C {input.filtered_escape_2510C} \
-p filtered_escape_121F {input.filtered_escape_121F} \
-p filtered_escape_256A {input.filtered_escape_256A} \
-p filtered_escape_372D {input.filtered_escape_372D} \
-p func_scores {input.func_scores} \
-p out_dir {params.out_dir} \
-p min_times_seen {params.min_times_seen} \
-p n_selections {params.n_selections} \
-p func_vs_escape {output.func_vs_escape} \
-p func_vs_escape_svg {output.func_vs_escape_svg} \
-p saved_image_path {output.saved_image_path} \
-p func_distance_image_path {output.func_distance_image_path} \
&> {log}
"""
rule escape_vs_functional_effects:
"""
Compare antibody escape and functional effects
"""
input:
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
filtered_func_293T="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
Josiah_sequence="data/Josiah_nucleotide_reference_NC_004296.fasta",
nb="notebooks/escape_vs_func_effects.ipynb",
params:
out_dir="results/antibody_escape_profiles/",
output:
func_vs_escape="results/antibody_escape_profiles/antibody_escape_vs_func_effect_all_muts.html",
func_vs_escape_svg="results/antibody_escape_profiles/antibody_escape_vs_func_effect_all_muts.svg",
nb="results/notebooks/escape_vs_func_effects.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/escape_vs_functional_effects.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p filtered_escape_377H {input.filtered_escape_377H} \
-p filtered_escape_89F {input.filtered_escape_89F} \
-p filtered_escape_2510C {input.filtered_escape_2510C} \
-p filtered_escape_121F {input.filtered_escape_121F} \
-p filtered_escape_256A {input.filtered_escape_256A} \
-p filtered_escape_372D {input.filtered_escape_372D} \
-p filtered_func_293T {input.filtered_func_293T} \
-p Josiah_sequence {input.Josiah_sequence} \
-p out_dir {params.out_dir} \
-p func_vs_escape {output.func_vs_escape} \
-p func_vs_escape_svg {output.func_vs_escape_svg} \
&> {log}
"""
rule map_scores_onto_pdb_structure:
"""
Map filtered functional and antibody scores onto pdb structure.
"""
input:
func_scores="results/filtered_func_effect_CSVs/293T_filtered_func_effects.csv",
pdb_file="data/7puy.pdb",
filtered_escape_377H="results/filtered_antibody_escape_CSVs/377H_filtered_mut_effect.csv",
filtered_escape_89F="results/filtered_antibody_escape_CSVs/89F_filtered_mut_effect.csv",
filtered_escape_2510C="results/filtered_antibody_escape_CSVs/2510C_filtered_mut_effect.csv",
filtered_escape_121F="results/filtered_antibody_escape_CSVs/121F_filtered_mut_effect.csv",
filtered_escape_256A="results/filtered_antibody_escape_CSVs/256A_filtered_mut_effect.csv",
filtered_escape_372D="results/filtered_antibody_escape_CSVs/372D_filtered_mut_effect.csv",
natural_sequence_variation="non-pipeline_analyses/LASV_phylogeny_analysis/Results/GPC_protein_variation.csv",
nb="notebooks/pdb_mapping.ipynb",
params:
out_dir="results/mapped_scores_onto_pdb/",
output:
pdb_func_min="results/mapped_scores_onto_pdb/func_scores_min.pdb",
pdb_func_max="results/mapped_scores_onto_pdb/func_scores_max.pdb",
pdb_377H="results/mapped_scores_onto_pdb/377H_escape.pdb",
pdb_89F="results/mapped_scores_onto_pdb/89F_escape.pdb",
pdb_2510C="results/mapped_scores_onto_pdb/2510C_escape.pdb",
pdb_121F="results/mapped_scores_onto_pdb/121F_escape.pdb",
pdb_256A="results/mapped_scores_onto_pdb/256A_escape.pdb",
pdb_372D="results/mapped_scores_onto_pdb/372D_escape.pdb",
pdb_natural_variation="results/mapped_scores_onto_pdb/natural_variation.pdb",
pdb_arevirumab="results/mapped_scores_onto_pdb/arevirumab_escape.pdb",
nb="results/notebooks/pdb_mapping.ipynb",
conda:
"data/custom_rules_environment.yml",
log:
"results/logs/map_scores_onto_pdb_structure.txt",
shell:
"""
papermill {input.nb} {output.nb} \
-p func_scores {input.func_scores} \
-p pdb_file {input.pdb_file} \
-p filtered_escape_377H {input.filtered_escape_377H} \
-p filtered_escape_89F {input.filtered_escape_89F} \
-p filtered_escape_2510C {input.filtered_escape_2510C} \
-p filtered_escape_121F {input.filtered_escape_121F} \
-p filtered_escape_256A {input.filtered_escape_256A} \
-p filtered_escape_372D {input.filtered_escape_372D} \
-p natural_sequence_variation {input.natural_sequence_variation} \
-p out_dir {params.out_dir} \
-p pdb_func_min {output.pdb_func_min} \
-p pdb_func_max {output.pdb_func_max} \
-p pdb_377H {output.pdb_377H} \
-p pdb_89F {output.pdb_89F} \
-p pdb_2510C {output.pdb_2510C} \
-p pdb_121F {output.pdb_121F} \
-p pdb_256A {output.pdb_256A} \
-p pdb_372D {output.pdb_372D} \
-p pdb_natural_variation {output.pdb_natural_variation} \
-p pdb_arevirumab {output.pdb_arevirumab} \
&> {log}
"""
docs["Additional analyses and data files"] = {
"Variant mutation analysis" : {
"Interactive plot showing averaged functional score distributions by variant type" : rules.averaged_ridgeplot_func_scores.output.html_output,
"Notebook creating averaged functional score distributions" : rules.averaged_ridgeplot_func_scores.output.nb,
"Notebook creating altair version of mutation distribution" : rules.visualize_mutation_distributions.output.nb,
"Notebook creating correlation plots between functional scores and functional effects derived from global epistasis model" : rules.single_mutant_global_epistasis_analysis.output.nb,
"Notebook creating library correlation plots" : rules.library_replicate_correlations.output.nb,
},
"Correlations of DAG1 ortholog functional selections" : {
"Interactive plot showing correlations between DAG1 ortholog functional selections" : rules.human_mastomys_correlation.output.html_output,
"Notebook correlating functional effects of humanDAG1 vs mastomysDAG1 expressing cells" : rules.human_mastomys_correlation.output.nb,
},
"Functional and antibody selection validations" : {
"Notebook correlating measured vs predicted functional effects" : rules.validation_titers.output.nb,
"Notebook correlating measured vs predicted neutralization": rules.validation_neuts_89F.output.nb,
},
"Functional scores for different GPC regions" : {
"Interactive plot showing functional scores for different GPC regions" : rules.visualize_RBD_regions.output.html_output,
"Notebook visualizing functional scores for different GPC regions" : rules.visualize_RBD_regions.output.nb,
},
"Comparisons of natural Lassa GPC diveristy to DMS data" : {
"Notebook analyzing natural sequence data for sequences predicted antibody escape" : rules.compare_to_natural.output.nb,
"Notebook comparing functional effects and natural sequence variation for different GPC regions" : rules.GPC_region_comparisons_to_natural.output.nb,
"Notebook analyzing distribution of functional effects for mutations in natural GPCs" : rules.func_effects_of_naturally_present_mutations.output.nb,
"Interactive plots comparing DMS data and natural sequence diversity" : {
"Interactive plot showing correlation of natural diversity and functions scores for different GPC regions" : rules.GPC_region_comparisons_to_natural.output.html_output,
"Interactive plot showing correlation of mutation frequencies and antibody escape" : rules.compare_to_natural.output.html_nat_mut_freqs_vs_escape,
"Interactive plot showing correlation of mutation frequencies and antibody escape across Arevirumab-3 antibodies" : rules.compare_to_natural.output.html_nat_mut_freqs_vs_escape_all_abs,
"Interactive plot showing correlation of natural diversity and antibody escape" : rules.compare_to_natural.output.html_natural_vs_escape,
"Interactive plot showing correlation of natural diversity and antibody escape across Arevirumab-3 antibodies" : rules.compare_to_natural.output.html_natural_vs_escape_all_abs,
"Interactive plot showing correlation of escape across Arevirumab-3 antibodies" : rules.compare_to_natural.output.html_arevirumab_comparisons,
},
},
"Filtered antibody escape and functional data" : {
"Notebook applying filters to antibody escape and functional data" : rules.get_filtered_CSVs.output.nb,
"Filtered antibody escape CSVs" : {
"CSV with filtered 377H antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_377H,
"CSV with filtered 89F antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_89F,
"CSV with filtered 2510C antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_2510C,
"CSV with filtered 121F antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_121F,
"CSV with filtered 256A antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_256A,
"CSV with filtered 372D antibody escape data" : rules.get_filtered_CSVs.output.filtered_escape_372D,
},
"Filtered functional CSVs" : {
"CSV with filtered 293T effects" : rules.get_filtered_CSVs.output.filtered_func_293T,
"CSV with filtered human 293T effects" : rules.get_filtered_CSVs.output.filtered_func_human_293T,
"CSV with filtered mastomys 293T effects" : rules.get_filtered_CSVs.output.filtered_func_mastomys_293T,
},
},
"Antibody escape compared to functional effects" : {
"Interactive plot showing antibody escape vs functional effects" : rules.escape_vs_functional_effects.output.func_vs_escape,
"Interactive plot showing antibody escape vs functional effect for antibody contacts" : rules.escape_sites_stratified_by_antibody_distance.output.func_vs_escape,
"Analysis notebooks" : {
"Notebook plotting escape vs functional effects" : rules.escape_vs_functional_effects.output.nb,
"Notebook plotting escape by distance to antibody" : rules.escape_sites_stratified_by_antibody_distance.output.nb,
}
},
"Mapped data onto pdb structure" : {
"Notebook mapping score onto pdb structure" : rules.map_scores_onto_pdb_structure.output.nb,
},
}