Skip to content

Commit 98f80f4

Browse files
author
Nina Baumgarten
committed
updated sneep version
1 parent e14c17e commit 98f80f4

9 files changed

Lines changed: 474 additions & 188 deletions

src/Makefile

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11

22
#sources
33
SRC = Matrix_new.cpp \
4+
differentialBindingAffinity.cpp \
5+
determineSignificantHitsWithoutDifferentialBindingAffinity.cpp \
46
pvalue_copy.cpp \
57
callBashCommand.cpp \
68
HandleInOutput.cpp \
79
differentialBindingAffinity_multipleSNPs.cpp \
8-
sampleRandomRsIDs2.cpp
10+
differentialBindingAffinity_multipleSNPsSEMs.cpp \
11+
sampleRandomRsIDs.cpp \
12+
checkDistribution.cpp
913

1014
platform=$(shell uname -s)
1115

@@ -17,11 +21,15 @@ CFLAGS = -std=c++11 -Xpreprocessor -fopenmp
1721
LDFLAGS = -stdlib=libc++
1822
all: $(SRC) Makefile
1923
$(CC) Matrix_new.cpp $(CFLAGS) $(LDFLAGS) -o Marix
24+
$(CC) differentialBindingAffinity.cpp $(CFLAGS) $(LDFLAGS) -o differentialBindingAffinity
25+
$(CC) determineSignificantHitsWithoutDifferentialBindingAffinity.cpp $(CFLAGS) $(LDFLAGS) -o determineSignificantHitsWithoutDifferentialBindingAffinity
2026
$(CC) pvalue_copy.cpp $(CFLAGS) $(LDFLAGS) -o pvalue
2127
$(CC) callBashCommand.cpp $(CFLAGS) $(LDFLAGS) -o callBashCommand
2228
$(CC) HandleInOutput.cpp $(CFLAGS) $(LDFLAGS) -o HandleInOutput
2329
$(CC) differentialBindingAffinity_multipleSNPs.cpp $(CFLAGS) $(LDFLAGS) -o differentialBindingAffinity_multipleSNPs
30+
$(CC) differentialBindingAffinity_multipleSNPsSEMs.cpp $(CFLAGS) $(LDFLAGS) -o differentialBindingAffinity_multipleSNPsSEMs
2431
$(CC) sampleRandomRsIDs2.cpp $(CFLAGS) $(LDFLAGS) -o randomRsIds_2.0
32+
$(CC) checkDistribution.cpp $(CFLAGS) $(LDFLAGS) -o checkDistribution
2533

2634
else
2735

@@ -31,14 +39,110 @@ CFLAGS_ = -std=c++11 -fopenmp
3139
LDFLAGS = -static
3240
LFLAG = -I/TL/opt/include
3341
lFLAG = -lcurl
42+
IFLAG = -I json/include/ # bedtools2/src/utils/driver/ bedtools2/src/utils/version/
43+
44+
#for bedtools (copy pased form the bedtools 2 makefile)
45+
#SRC_DIR= bedtools2/src
46+
#HTSDIR = $(SRC_DIR)/utils/htslib
47+
48+
49+
#SUBDIRS = $(SRC_DIR)/annotateBed \
50+
$(SRC_DIR)/bamToBed \
51+
$(SRC_DIR)/bamToFastq \
52+
$(SRC_DIR)/bedToBam \
53+
$(SRC_DIR)/bedpeToBam \
54+
$(SRC_DIR)/bedToIgv \
55+
$(SRC_DIR)/bed12ToBed6 \
56+
$(SRC_DIR)/closestFile \
57+
$(SRC_DIR)/clusterBed \
58+
$(SRC_DIR)/complementFile \
59+
$(SRC_DIR)/coverageFile \
60+
$(SRC_DIR)/expand \
61+
$(SRC_DIR)/fastaFromBed \
62+
$(SRC_DIR)/flankBed \
63+
$(SRC_DIR)/genomeCoverageBed \
64+
$(SRC_DIR)/getOverlap \
65+
$(SRC_DIR)/groupBy \
66+
$(SRC_DIR)/intersectFile \
67+
$(SRC_DIR)/fisher \
68+
$(SRC_DIR)/jaccard \
69+
$(SRC_DIR)/linksBed \
70+
$(SRC_DIR)/maskFastaFromBed \
71+
$(SRC_DIR)/mapFile \
72+
$(SRC_DIR)/mergeFile \
73+
$(SRC_DIR)/multiBamCov \
74+
$(SRC_DIR)/multiIntersectBed \
75+
$(SRC_DIR)/nucBed \
76+
$(SRC_DIR)/pairToBed \
77+
$(SRC_DIR)/pairToPair \
78+
$(SRC_DIR)/randomBed \
79+
$(SRC_DIR)/regressTest \
80+
$(SRC_DIR)/reldist \
81+
$(SRC_DIR)/sampleFile \
82+
$(SRC_DIR)/shiftBed \
83+
$(SRC_DIR)/shuffleBed \
84+
$(SRC_DIR)/slopBed \
85+
$(SRC_DIR)/sortBed \
86+
$(SRC_DIR)/spacingFile \
87+
$(SRC_DIR)/split \
88+
$(SRC_DIR)/subtractFile \
89+
$(SRC_DIR)/summaryFile \
90+
$(SRC_DIR)/tagBam \
91+
$(SRC_DIR)/unionBedGraphs \
92+
$(SRC_DIR)/windowBed \
93+
$(SRC_DIR)/windowMaker
94+
95+
#UTIL_SUBDIRS = $(SRC_DIR)/utils/FileRecordTools \
96+
$(SRC_DIR)/utils/FileRecordTools/FileReaders \
97+
$(SRC_DIR)/utils/FileRecordTools/Records \
98+
$(SRC_DIR)/utils/bedFile \
99+
$(SRC_DIR)/utils/BinTree \
100+
$(SRC_DIR)/utils/version \
101+
$(SRC_DIR)/utils/bedGraphFile \
102+
$(SRC_DIR)/utils/chromsweep \
103+
$(SRC_DIR)/utils/Contexts \
104+
$(SRC_DIR)/utils/general \
105+
$(SRC_DIR)/utils/gzstream \
106+
$(SRC_DIR)/utils/fileType \
107+
$(SRC_DIR)/utils/bedFilePE \
108+
$(SRC_DIR)/utils/KeyListOps \
109+
$(SRC_DIR)/utils/NewChromsweep \
110+
$(SRC_DIR)/utils/sequenceUtilities \
111+
$(SRC_DIR)/utils/tabFile \
112+
$(SRC_DIR)/utils/BamTools-Ancillary \
113+
$(SRC_DIR)/utils/BlockedIntervals \
114+
$(SRC_DIR)/utils/Fasta \
115+
$(SRC_DIR)/utils/VectorOps \
116+
$(SRC_DIR)/utils/GenomeFile \
117+
$(SRC_DIR)/utils/RecordOutputMgr \
118+
$(SRC_DIR)/utils/ToolBase \
119+
$(SRC_DIR)/utils/driver
120+
121+
#INCLUDES_BEDTOOLS = $(addprefix -I,$(SUBDIRS) $(UTIL_SUBDIRS)) \
122+
-I$(SRC_DIR)/utils/BamTools/include \
123+
-I$(HTSDIR) \
124+
-I$(SRC_DIR)/utils/lineFileUtilities \
125+
-I$(SRC_DIR)/utils/Point \
126+
-I$(SRC_DIR)/utils/stringUtilities \
127+
-lz
128+
129+
34130

35131
all: $(SRC) Makefile
36132
$(CC) Matrix_new.cpp $(CFLAGS) $(LDFLAGS) -o Matrix
133+
$(CC) differentialBindingAffinity.cpp $(CFLAGS) $(LDFLAGS) -o differentialBindingAffinity
134+
$(CC) determineSignificantHitsWithoutDifferentialBindingAffinity.cpp $(CFLAGS) $(LDFLAGS) -o determineSignificantHitsWithoutDifferentialBindingAffinity
37135
$(CC) pvalue_copy.cpp $(CFLAGS) $(LDFLAGS) -o pvalue
38136
$(CC) callBashCommand.cpp $(CFLAGS) $(LDFLAGS) -o callBashCommand
39137
$(CC) HandleInOutput.cpp $(CFLAGS) $(LDFLAGS) -o HandleInOutput
138+
#$(CC) buffering.cpp $(CFLAGS) $(LDFLAGS) -o buffering $(INCLUDES_BEDTOOLS)
139+
#$(CC) sampleRandomRsIDs.cpp $(CFLAGS_) -o randomRsIds $(LFLAG) $(lFLAG) $(IFLAG) $(INCLUDES_BEDTOOLS)
40140
$(CC) sampleRandomRsIDs2.cpp $(CFLAGS) -o randomRsIds_2.0
141+
# $(CC) differentialBindingAffinity_multipleSNPs.cpp $(CFLAGS) -o differentialBindingAffinity_multipleSNPs $(LFLAG) $(lFLAG) $(IFLAG) $(INCLUDES_BEDTOOLS)
41142
$(CC) differentialBindingAffinity_multipleSNPs.cpp $(CFLAGS_) -o differentialBindingAffinity_multipleSNPs
143+
# $(CC) differentialBindingAffinity_multipleSNPsSEMs.cpp $(CFLAGS) $(LDFLAGS) -o differentialBindingAffinity_multipleSNPsSEMs
144+
$(CC) getSNPInfo.cpp $(CFLAGS_) -o getSNPInfo $(LFLAG) $(lFLAG) $(IFLAG)
145+
$(CC) checkDistribution.cpp $(CFLAGS) -o checkDistribution
42146

43147
endif
44148

src/REMsMoreThan2.Rmd

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ Table \@ref(tab:associatedREMs) lists the interactions that overlap with at leas
33
The second column provides the length of a REM, because the longer an interaction the higher the chance that several SNPs are overlapping.
44

55

6-
For example the interaction `r REMs$regionID[[1]]` of length `r REMs$length[[1]]`, which is associated to the gene `r REMs$gene[[1]]` overlaps with `r REMs$frequence[[1]]` (not necessarily unique) SNPs.
6+
For example the interaction `r REMs_table$regionID[[1]]` of length `r REMs_table$length[[1]]`, which is associated to the gene `r REMs_table$gene[[1]]` overlaps with `r REMs_table$frequence[[1]]` (not necessarily unique) SNPs.
77
Similar as for the previous table, column *TFs* and *SNPs* help to differentiate if the same SNP has an impact on several TFs or the same TF is affected by multiple SNPs.
88

99
```{r, echo = FALSE}
10-
REMs$TFs = gsub("..", "::", REMs$TFs, fixed=TRUE )
11-
REMs$TFs = gsub(".var.2.", "(var.2)", REMs$TFs, fixed=TRUE )
12-
REMs$TFs = gsub(".var.3.", "(var.3)", REMs$TFs, fixed=TRUE )
13-
REMs$TFs = linebreak(REMs$TFs)
14-
REMs$SNPs = linebreak(REMs$SNPs)
15-
REMs$gene = gsub("_", "\\_", REMs$gene, fixed=TRUE) #necessary since escape must be false for linebreaking and the gene names can include _ which must be especially handled in latex (usually escape is taking care of this)
10+
REMs_table$TFs = gsub("..", "::", REMs_table$TFs, fixed=TRUE )
11+
REMs_table$TFs = gsub(".M", "(M", REMs_table$TFs, fixed=TRUE )
12+
REMs_table$TFs = gsub(".,", "),", REMs_table$TFs, fixed=TRUE )
13+
REMs_table$TFs = linebreak(REMs_table$TFs)
14+
REMs_table$SNPs = linebreak(REMs_table$SNPs)
15+
REMs_table$gene = gsub("_", "\\_", REMs_table$gene, fixed=TRUE) #necessary since escape must be false for linebreaking and the gene names can include _ which must be especially handled in latex (usually escape is taking care of this)
1616
17-
knitr::kable(x = REMs, format = "latex",longtable = T, booktabs = T, col.names = c( "interaction ID", "length", "gene", "ensembl ID", "TFs", "SNPs", "frequency"), align = "llllllc", linesep = "", caption = "interactions overlapping at least 2 SNPs with a significant change in the binding affinity of a TF.", row.names = F, escape = F, label = "associatedREMs") %>%
18-
kable_styling(latex_options = c("striped", "repeat_header")) %>%
17+
knitr::kable(x = REMs_table, format = "latex",longtable = T, booktabs = T, col.names = c( "interaction ID", "length", "gene", "ensembl ID", "number different SNPs", "SNPs", "TFs"), align = "lllllll", linesep = "", caption = "interactions overlapping at least 2 SNPs with a significant change in the binding affinity of a TF.", row.names = F, escape = F, label = "associatedREMs") %>%
18+
#kable_styling(latex_options = c("striped", "repeat_header")) %>%
1919
column_spec(1, width = "2cm")%>%
2020
column_spec(2, width = "1.5cm") %>%
2121
column_spec(3, width = "2cm") %>%
2222
column_spec(4, width = "3cm") %>%
23-
column_spec(5, width = "2.5cm") %>%
23+
column_spec(5, width = "1.5cm") %>%
2424
column_spec(6, width = "2cm") %>%
25-
column_spec(7, width = "1.4cm")
25+
column_spec(7, width = "3cm") %>%
26+
collapse_rows(columns = 1:5, target = 1, valign = "top") #%>%
2627
```

src/callBashCommand.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void BashCommand::mkdir(string dir, string options, bool remove){
7676
string command = "mkdir " + options + " " + dir;
7777
system(command.c_str());
7878
if (remove == true){
79-
string command = "rm -r " + dir + "/*";
79+
string command = "rm -r -f " + dir + "/*";
8080
system(command.c_str());
8181
}
8282
return;
@@ -85,15 +85,17 @@ void BashCommand::mkdir(string dir, string options, bool remove){
8585
void BashCommand::callPythonScriptCheckActiveMotifs(string sourceDir, string activeTFs, string TransfacPFMs, string PFMsDir, string ensemble_name, double threshold){
8686
// cout << "sourceDir: " << sourceDir<< "/src/ activeTFs: " << activeTFs << " PFMs: " << TransfacPFMs << "PFMdir: " << PFMsDir << " ensembl names: " << ensemble_name << " threshold: " << threshold << endl;
8787

88-
string command = "python3 ./" + sourceDir + "/src/seperatePFMsAndCheckActivity.py " + activeTFs + " "+ TransfacPFMs + " " + PFMsDir + " " + ensemble_name + " " + to_string(threshold);
88+
//string command = "python3 ./" + sourceDir + "/src/seperatePFMsAndCheckActivity.py " + activeTFs + " "+ TransfacPFMs + " " + PFMsDir + " " + ensemble_name + " " + to_string(threshold);
89+
string command = "python3 " + sourceDir + "/src/seperatePFMsAndCheckActivity.py " + activeTFs + " "+ TransfacPFMs + " " + PFMsDir + " " + ensemble_name + " " + to_string(threshold);
8990
// cout << "command: " << command << endl;
9091

9192
system(command.c_str());
9293
return;
9394
}
9495

9596
void BashCommand::callPythonScriptSplitPFMs(string sourceDir, string TransfacPFMs, string PFMsDir){
96-
string command = "python3 ./" + sourceDir + "/src/seperatePFMs.py " + TransfacPFMs + " " + PFMsDir;
97+
//string command = "python3 ./" + sourceDir + "/src/seperatePFMs.py " + TransfacPFMs + " " + PFMsDir;
98+
string command = "python3 " + sourceDir + "/src/seperatePFMs.py " + TransfacPFMs + " " + PFMsDir;
9799
system(command.c_str());
98100
return;
99101
}

0 commit comments

Comments
 (0)