Skip to content

Commit 15b3ca9

Browse files
authored
Merge pull request #1110 from maxplanck-ie/KS_hHMM
update predict chip dict and chipseq snakefile
2 parents 1eec85f + 49f59ef commit 15b3ca9

File tree

8 files changed

+78
-74
lines changed

8 files changed

+78
-74
lines changed

.ci_stuff/test_dag.sh

Lines changed: 32 additions & 32 deletions
Large diffs are not rendered by default.

snakePipes/common_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,11 @@ def predict_chip_dict(wdir, input_pattern_str, bamExt, fromBAM=None):
871871
print("No control sample found!")
872872

873873
chip_dict_pred["chip_dict"][i] = {}
874-
chip_dict_pred["chip_dict"][i]['Control'] = tmp if tmp != "" else None
874+
chip_dict_pred["chip_dict"][i]['control'] = tmp if tmp != "" else None
875875
if re.match(".*(H3K4me1|H3K36me3|H3K9me3|H3K27me3).*", i, re.IGNORECASE):
876-
chip_dict_pred["chip_dict"][i]['Broad'] = True
876+
chip_dict_pred["chip_dict"][i]['broad'] = True
877877
else:
878-
chip_dict_pred["chip_dict"][i]['Broad'] = False
878+
chip_dict_pred["chip_dict"][i]['broad'] = False
879879

880880
outfile = os.path.join(wdir, "chip_seq_sample_config.PREDICTED.yaml")
881881
write_configfile(outfile, chip_dict_pred,trafo=tr)

snakePipes/shared/rscripts/chipqc.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ if( genome %in% supported_annotations){
107107

108108
annotation<-supported_annotations[grep(genome,extended_annotations)]
109109

110-
}else {stop("No matching annotation was found.")}
110+
}else {
111+
#stop("No matching annotation was found.")
112+
annotation<-NULL
113+
}
111114

112115
if(file.exists(blacklist)){
113116
blist<-blacklist}else{blist<-NULL}
114117

115118
message(paste0("Using blacklist: ",blist))
116-
QC<-ChIPQC(sampledat,annotation=annotation,mapQCth=3,blacklist=blist)
119+
QC<-ChIPQC(sampledat,annotation=annotation,mapQCth=3,blacklist=blist,chromosomes=NULL,annotation=annotation)
117120
ChIPQCreport(QC,reportFolder=".",facet=FALSE,colourBy="Factor")
118121

119122
sink("sessionInfo.txt")

snakePipes/shared/rules/ChIP_peak_calling.snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ rule chipqc:
231231
output:
232232
"{}_chipqc/sessionInfo.txt".format(peakCaller)
233233
params:
234-
genome = genome,
234+
genome = os.path.basename(genome),
235235
outdir = "{}_chipqc".format(peakCaller),
236236
blacklist = blacklist_bed,
237237
bams = lambda wildcards,input: [os.path.join(outdir,x) for x in input.bams],

snakePipes/shared/rules/ChIP_peak_calling_spikein.snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ rule chipqc:
227227
output:
228228
"{}_chipqc/sessionInfo.txt".format(peakCaller)
229229
params:
230-
genome = genome,
230+
genome = os.path.basename(genome),
231231
outdir = "{}_chipqc".format(peakCaller),
232232
blacklist = blacklist_bed,
233233
bams = lambda wildcards,input: [os.path.join(outdir,x) for x in input.bams],

snakePipes/shared/rules/histoneHMM.snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ rule histoneHMM_chipqc:
7676
output:
7777
"histoneHMM_chipqc/sessionInfo.txt"
7878
params:
79-
genome = genome,
79+
genome = os.path.basename(genome),
8080
outdir = "histoneHMM_chipqc",
8181
blacklist = blacklist_bed,
8282
bams = lambda wildcards,input: [os.path.join(outdir,x) for x in input.bams],

snakePipes/workflows/ChIPseq/Snakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ if sampleSheet and cf.check_replicates(sampleSheet):
7373
#include: os.path.join(maindir, "shared", "rules", "deepTools_qc.snakefile")
7474

7575
def run_histoneHMM(allele_info): # TODO what is a good practice for broad peaks of cutntag?
76-
if not allele_info:
76+
if not allele_info and broad_samples:
7777
## run histoneHMM broad enrichment calling only for samples annotated as *broad*
78-
file_list = expand("histoneHMM/{chip_sample}.filtered.histoneHMM-regions.gff.gz", chip_sample = [s for s in chip_samples if is_broad(s)])
78+
file_list = expand("histoneHMM/{sample}.filtered.histoneHMM-regions.gff.gz", sample=broad_samples)
79+
file_list.append(expand("histoneHMM/{sample}_avgp0.5.bed", sample=broad_samples))
7980
file_list.append("histoneHMM_chipqc/sessionInfo.txt")
8081
else:
8182
file_list = []

tests/test_jobcounts.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def test_default(self, ifs):
566566
print(' '.join([str(i) for i in ci]))
567567
_p = sp.run(ci, capture_output=True, text=True)
568568
assert _p.returncode == 0
569-
assert parseSpOut(_p) == 55
569+
assert parseSpOut(_p) == 54
570570
def test_nosamplesheet(self, ifs):
571571
ci = [
572572
"ChIPseq",
@@ -580,7 +580,7 @@ def test_nosamplesheet(self, ifs):
580580
print(' '.join([str(i) for i in ci]))
581581
_p = sp.run(ci, capture_output=True, text=True)
582582
assert _p.returncode == 0
583-
assert parseSpOut(_p) == 33
583+
assert parseSpOut(_p) == 32
584584
def test_nosamplesheet_genrich(self, ifs):
585585
ci = [
586586
"ChIPseq",
@@ -596,7 +596,7 @@ def test_nosamplesheet_genrich(self, ifs):
596596
print(' '.join([str(i) for i in ci]))
597597
_p = sp.run(ci, capture_output=True, text=True)
598598
assert _p.returncode == 0
599-
assert parseSpOut(_p) == 36
599+
assert parseSpOut(_p) == 35
600600
def test_broad(self, ifs):
601601
ci = [
602602
"ChIPseq",
@@ -630,7 +630,7 @@ def test_genrich(self, ifs):
630630
print(' '.join([str(i) for i in ci]))
631631
_p = sp.run(ci, capture_output=True, text=True)
632632
assert _p.returncode == 0
633-
assert parseSpOut(_p) == 57
633+
assert parseSpOut(_p) == 56
634634
def test_seacr(self, ifs):
635635
ci = [
636636
"ChIPseq",
@@ -648,7 +648,7 @@ def test_seacr(self, ifs):
648648
print(' '.join([str(i) for i in ci]))
649649
_p = sp.run(ci, capture_output=True, text=True)
650650
assert _p.returncode == 0
651-
assert parseSpOut(_p) == 73
651+
assert parseSpOut(_p) == 72
652652
def test_seacr_spikein(self, ifs):
653653
ci = [
654654
"ChIPseq",
@@ -667,7 +667,7 @@ def test_seacr_spikein(self, ifs):
667667
print(' '.join([str(i) for i in ci]))
668668
_p = sp.run(ci, capture_output=True, text=True)
669669
assert _p.returncode == 0
670-
assert parseSpOut(_p) == 114
670+
assert parseSpOut(_p) == 113
671671
def test_SE(self, ifs):
672672
ci = [
673673
"ChIPseq",
@@ -684,7 +684,7 @@ def test_SE(self, ifs):
684684
print(' '.join([str(i) for i in ci]))
685685
_p = sp.run(ci, capture_output=True, text=True)
686686
assert _p.returncode == 0
687-
assert parseSpOut(_p) == 55
687+
assert parseSpOut(_p) == 54
688688
def test_l2ratio(self, ifs):
689689
ci = [
690690
"ChIPseq",
@@ -702,7 +702,7 @@ def test_l2ratio(self, ifs):
702702
print(' '.join([str(i) for i in ci]))
703703
_p = sp.run(ci, capture_output=True, text=True)
704704
assert _p.returncode == 0
705-
assert parseSpOut(_p) == 49
705+
assert parseSpOut(_p) == 48
706706
def test_default_noInput(self, ifs):
707707
ci = [
708708
"ChIPseq",
@@ -718,7 +718,7 @@ def test_default_noInput(self, ifs):
718718
print(' '.join([str(i) for i in ci]))
719719
_p = sp.run(ci, capture_output=True, text=True)
720720
assert _p.returncode == 0
721-
assert parseSpOut(_p) == 34
721+
assert parseSpOut(_p) == 33
722722
def test_genrich_noInput(self, ifs):
723723
ci = [
724724
"ChIPseq",
@@ -736,7 +736,7 @@ def test_genrich_noInput(self, ifs):
736736
print(' '.join([str(i) for i in ci]))
737737
_p = sp.run(ci, capture_output=True, text=True)
738738
assert _p.returncode == 0
739-
assert parseSpOut(_p) == 33
739+
assert parseSpOut(_p) == 32
740740
def test_seacr_noInput(self, ifs):
741741
ci = [
742742
"ChIPseq",
@@ -754,7 +754,7 @@ def test_seacr_noInput(self, ifs):
754754
print(' '.join([str(i) for i in ci]))
755755
_p = sp.run(ci, capture_output=True, text=True)
756756
assert _p.returncode == 0
757-
assert parseSpOut(_p) == 46
757+
assert parseSpOut(_p) == 45
758758
def test_seacr_spikein_noInput(self, ifs):
759759
ci = [
760760
"ChIPseq",
@@ -773,7 +773,7 @@ def test_seacr_spikein_noInput(self, ifs):
773773
print(' '.join([str(i) for i in ci]))
774774
_p = sp.run(ci, capture_output=True, text=True)
775775
assert _p.returncode == 0
776-
assert parseSpOut(_p) == 67
776+
assert parseSpOut(_p) == 66
777777
def test_frombam(self, ifs):
778778
ci = [
779779
"ChIPseq",
@@ -791,7 +791,7 @@ def test_frombam(self, ifs):
791791
print(' '.join([str(i) for i in ci]))
792792
_p = sp.run(ci, capture_output=True, text=True)
793793
assert _p.returncode == 0
794-
assert parseSpOut(_p) == 115
794+
assert parseSpOut(_p) == 114
795795
def test_frombam_noInput(self, ifs):
796796
ci = [
797797
"ChIPseq",
@@ -809,7 +809,7 @@ def test_frombam_noInput(self, ifs):
809809
print(' '.join([str(i) for i in ci]))
810810
_p = sp.run(ci, capture_output=True, text=True)
811811
assert _p.returncode == 0
812-
assert parseSpOut(_p) == 76
812+
assert parseSpOut(_p) == 75
813813
def test_spikein(self, ifs):
814814
ci = [
815815
"ChIPseq",
@@ -826,7 +826,7 @@ def test_spikein(self, ifs):
826826
print(' '.join([str(i) for i in ci]))
827827
_p = sp.run(ci, capture_output=True, text=True)
828828
assert _p.returncode == 0
829-
assert parseSpOut(_p) == 102
829+
assert parseSpOut(_p) == 101
830830
def test_spikein_noInput(self, ifs):
831831
ci = [
832832
"ChIPseq",
@@ -843,7 +843,7 @@ def test_spikein_noInput(self, ifs):
843843
print(' '.join([str(i) for i in ci]))
844844
_p = sp.run(ci, capture_output=True, text=True)
845845
assert _p.returncode == 0
846-
assert parseSpOut(_p) == 61
846+
assert parseSpOut(_p) == 60
847847
def test_spikeinfrombam(self, ifs):
848848
ci = [
849849
"ChIPseq",
@@ -862,7 +862,7 @@ def test_spikeinfrombam(self, ifs):
862862
print(' '.join([str(i) for i in ci]))
863863
_p = sp.run(ci, capture_output=True, text=True)
864864
assert _p.returncode == 0
865-
assert parseSpOut(_p) == 138
865+
assert parseSpOut(_p) == 137
866866
def test_spikeinfrombamTSSnorm(self, ifs):
867867
ci = [
868868
"ChIPseq",
@@ -883,7 +883,7 @@ def test_spikeinfrombamTSSnorm(self, ifs):
883883
print(' '.join([str(i) for i in ci]))
884884
_p = sp.run(ci, capture_output=True, text=True)
885885
assert _p.returncode == 0
886-
assert parseSpOut(_p) == 114
886+
assert parseSpOut(_p) == 113
887887
def test_spikeinfrombaminputnorm(self, ifs):
888888
ci = [
889889
"ChIPseq",
@@ -904,7 +904,7 @@ def test_spikeinfrombaminputnorm(self, ifs):
904904
print(' '.join([str(i) for i in ci]))
905905
_p = sp.run(ci, capture_output=True, text=True)
906906
assert _p.returncode == 0
907-
assert parseSpOut(_p) == 111
907+
assert parseSpOut(_p) == 110
908908
def test_allelic(self, ifs):
909909
ci = [
910910
"ChIPseq",
@@ -936,7 +936,7 @@ def test_multicomp(self, ifs):
936936
print(' '.join([str(i) for i in ci]))
937937
_p = sp.run(ci, capture_output=True, text=True)
938938
assert _p.returncode == 0
939-
assert parseSpOut(_p) == 77
939+
assert parseSpOut(_p) == 76
940940
def test_multicomp_genrich(self, ifs):
941941
ci = [
942942
"ChIPseq",
@@ -954,7 +954,7 @@ def test_multicomp_genrich(self, ifs):
954954
print(' '.join([str(i) for i in ci]))
955955
_p = sp.run(ci, capture_output=True, text=True)
956956
assert _p.returncode == 0
957-
assert parseSpOut(_p) == 83
957+
assert parseSpOut(_p) == 82
958958
def test_multicomp_broad(self, ifs):
959959
ci = [
960960
"ChIPseq",
@@ -988,7 +988,7 @@ def test_multicomp_fromBam(self, ifs):
988988
print(' '.join([str(i) for i in ci]))
989989
_p = sp.run(ci, capture_output=True, text=True)
990990
assert _p.returncode == 0
991-
assert parseSpOut(_p) == 137
991+
assert parseSpOut(_p) == 136
992992
def test_multicomp_fromBam_Genrich(self, ifs):
993993
ci = [
994994
"ChIPseq",
@@ -1008,7 +1008,7 @@ def test_multicomp_fromBam_Genrich(self, ifs):
10081008
print(' '.join([str(i) for i in ci]))
10091009
_p = sp.run(ci, capture_output=True, text=True)
10101010
assert _p.returncode == 0
1011-
assert parseSpOut(_p) == 143
1011+
assert parseSpOut(_p) == 142
10121012
def test_multicomp_spikein(self, ifs):
10131013
ci = [
10141014
"ChIPseq",
@@ -1025,7 +1025,7 @@ def test_multicomp_spikein(self, ifs):
10251025
print(' '.join([str(i) for i in ci]))
10261026
_p = sp.run(ci, capture_output=True, text=True)
10271027
assert _p.returncode == 0
1028-
assert parseSpOut(_p) == 122
1028+
assert parseSpOut(_p) == 121
10291029
def test_multicomp_spikein_genrich(self, ifs):
10301030
ci = [
10311031
"ChIPseq",
@@ -1044,7 +1044,7 @@ def test_multicomp_spikein_genrich(self, ifs):
10441044
print(' '.join([str(i) for i in ci]))
10451045
_p = sp.run(ci, capture_output=True, text=True)
10461046
assert _p.returncode == 0
1047-
assert parseSpOut(_p) == 128
1047+
assert parseSpOut(_p) == 127
10481048
def test_multicomp_spikein_noInput(self, ifs):
10491049
ci = [
10501050
"ChIPseq",
@@ -1061,7 +1061,7 @@ def test_multicomp_spikein_noInput(self, ifs):
10611061
print(' '.join([str(i) for i in ci]))
10621062
_p = sp.run(ci, capture_output=True, text=True)
10631063
assert _p.returncode == 0
1064-
assert parseSpOut(_p) == 77
1064+
assert parseSpOut(_p) == 76
10651065
def test_multicomp_spikein_noInput_Genrich(self, ifs):
10661066
ci = [
10671067
"ChIPseq",
@@ -1080,7 +1080,7 @@ def test_multicomp_spikein_noInput_Genrich(self, ifs):
10801080
print(' '.join([str(i) for i in ci]))
10811081
_p = sp.run(ci, capture_output=True, text=True)
10821082
assert _p.returncode == 0
1083-
assert parseSpOut(_p) == 80
1083+
assert parseSpOut(_p) == 79
10841084
def test_multicomp_spikein_fromBam(self, ifs):
10851085
ci = [
10861086
"ChIPseq",
@@ -1099,7 +1099,7 @@ def test_multicomp_spikein_fromBam(self, ifs):
10991099
print(' '.join([str(i) for i in ci]))
11001100
_p = sp.run(ci, capture_output=True, text=True)
11011101
assert _p.returncode == 0
1102-
assert parseSpOut(_p) == 158
1102+
assert parseSpOut(_p) == 157
11031103
def test_multicomp_spikein_fromBam_genrich(self, ifs):
11041104
ci = [
11051105
"ChIPseq",
@@ -1120,7 +1120,7 @@ def test_multicomp_spikein_fromBam_genrich(self, ifs):
11201120
print(' '.join([str(i) for i in ci]))
11211121
_p = sp.run(ci, capture_output=True, text=True)
11221122
assert _p.returncode == 0
1123-
assert parseSpOut(_p) == 164
1123+
assert parseSpOut(_p) == 163
11241124
def test_multicomp_spikein_fromBam_noInput(self, ifs):
11251125
ci = [
11261126
"ChIPseq",
@@ -1139,7 +1139,7 @@ def test_multicomp_spikein_fromBam_noInput(self, ifs):
11391139
print(' '.join([str(i) for i in ci]))
11401140
_p = sp.run(ci, capture_output=True, text=True)
11411141
assert _p.returncode == 0
1142-
assert parseSpOut(_p) == 101
1142+
assert parseSpOut(_p) == 100
11431143
def test_multicomp_spikein_fromBam_noInput_genrich(self, ifs):
11441144
ci = [
11451145
"ChIPseq",
@@ -1160,7 +1160,7 @@ def test_multicomp_spikein_fromBam_noInput_genrich(self, ifs):
11601160
print(' '.join([str(i) for i in ci]))
11611161
_p = sp.run(ci, capture_output=True, text=True)
11621162
assert _p.returncode == 0
1163-
assert parseSpOut(_p) == 104
1163+
assert parseSpOut(_p) == 103
11641164
def test_multicomp_fromBam_noInput_SEACR(self, ifs):
11651165
ci = [
11661166
"ChIPseq",
@@ -1180,7 +1180,7 @@ def test_multicomp_fromBam_noInput_SEACR(self, ifs):
11801180
print(' '.join([str(i) for i in ci]))
11811181
_p = sp.run(ci, capture_output=True, text=True)
11821182
assert _p.returncode == 0
1183-
assert parseSpOut(_p) == 104
1183+
assert parseSpOut(_p) == 103
11841184

11851185
class TestmRNAseq:
11861186
def test_default(self, ifs):

0 commit comments

Comments
 (0)