File tree Expand file tree Collapse file tree 4 files changed +108
-0
lines changed Expand file tree Collapse file tree 4 files changed +108
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,19 @@ set( pmh_pr_src
84
84
src/migrationgraph.h
85
85
)
86
86
87
+ set ( ms_hdr
88
+ src/utils.h
89
+ src/frequencymatrix.h
90
+ )
91
+
92
+ set ( ms_src
93
+ src/ms.cpp
94
+ src/utils.cpp
95
+ src/frequencymatrix.cpp
96
+ src/utils.h
97
+ src/frequencymatrix.h
98
+ )
99
+
87
100
set ( pmh_cti_hdr
88
101
src/utils.h
89
102
src/nonbinaryclonetree.h
@@ -259,6 +272,9 @@ add_executable( pmh_cti ${pmh_cti_src} ${pmh_cti_hdr} )
259
272
target_include_directories ( pmh_cti PUBLIC "${LIBLEMON_ROOT} /include" "src" ${Boost_INCLUDE_DIRS} ${GUROBI_INCLUDE_DIR} )
260
273
target_link_libraries ( pmh_cti ${CommonLibs} ${GUROBI_LIBRARIES} )
261
274
275
+ add_executable ( ms ${ms_src} ${ms_hdr} )
276
+ target_link_libraries ( ms ${CommonLibs} )
277
+
262
278
add_executable ( generatemigrationtrees ${generatemigrationtrees_src} ${generatemigrationtrees_hdr} )
263
279
target_link_libraries ( generatemigrationtrees ${CommonLibs} )
264
280
Original file line number Diff line number Diff line change @@ -18,6 +18,30 @@ FrequencyMatrix::FrequencyMatrix()
18
18
{
19
19
}
20
20
21
+ bool FrequencyMatrix::mS () const
22
+ {
23
+ bool res = true ;
24
+ for (int s = 0 ; s < _m; ++s)
25
+ {
26
+ for (int t = 0 ; t < s; ++t)
27
+ {
28
+ for (int i = 0 ; i < _n; ++i)
29
+ {
30
+ if (isSurelySubclonal (s, i) && isSurelySubclonal (t, i))
31
+ {
32
+ std::cerr << " Mutation '" << _indexToCharacter[i] << " '"
33
+ << " is surely subclonal in anatomical sites '"
34
+ << _indexToSample[s] << " ' and '" << _indexToSample[t] << " '"
35
+ << std::endl;
36
+ res = false ;
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ return res;
43
+ }
44
+
21
45
std::ostream& operator <<(std::ostream& out, const FrequencyMatrix& F)
22
46
{
23
47
out << F._m << " #samples" << std::endl;
Original file line number Diff line number Diff line change @@ -120,6 +120,26 @@ class FrequencyMatrix
120
120
return Sigma;
121
121
}
122
122
123
+ // / Return whether a mutation is surely subclonal
124
+ // /
125
+ // / @param s Sample index
126
+ // / @param i Character index
127
+ bool isSurelySubclonal (int s, int i) const
128
+ {
129
+ for (int j = 0 ; j < _n; ++j)
130
+ {
131
+ if (i == j) continue ;
132
+
133
+ if (_f[s][i].second < _f[s][j].first && _f[s][i].first > 0 )
134
+ return true ;
135
+ }
136
+
137
+ return false ;
138
+ }
139
+
140
+ // / Return whether (F^-, F+^) satisfy a necessary condition for mS
141
+ bool mS () const ;
142
+
123
143
private:
124
144
typedef std::pair<double , double > DoublePair;
125
145
typedef std::vector<DoublePair> DoublePairVector;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * ms.cpp
3
+ *
4
+ * Created on: 3-jul-2017
5
+ * Author: M. El-Kebir
6
+ */
7
+
8
+ #include " utils.h"
9
+ #include " frequencymatrix.h"
10
+ #include < fstream>
11
+ #include < lemon/arg_parser.h>
12
+
13
+ int main (int argc, char ** argv)
14
+ {
15
+ lemon::ArgParser ap (argc, argv);
16
+ ap.other (" frequencies" , " Frequencies" );
17
+ ap.parse ();
18
+
19
+ if (ap.files ().size () != 1 )
20
+ {
21
+ std::cerr << " Error: <frequencies> must be specified" << std::endl;
22
+ return 1 ;
23
+ }
24
+
25
+ std::string filenameFrequencies = ap.files ()[0 ];
26
+
27
+ std::ifstream inFrequencies (filenameFrequencies.c_str ());
28
+ if (!inFrequencies.good ())
29
+ {
30
+ std::cerr << " Could not open '" << filenameFrequencies << " ' for reading" << std::endl;
31
+ return 1 ;
32
+ }
33
+
34
+ FrequencyMatrix F;
35
+ inFrequencies >> F;
36
+ inFrequencies.close ();
37
+
38
+ if (F.mS ())
39
+ {
40
+ std::cerr << " Provided frequency matrix is potentially generated by a clone tree with a monoclonal single-source seeding pattern" << std::endl;
41
+ }
42
+ else
43
+ {
44
+ std::cerr << " Provided frequency matrix is NOT generated by a clone tree with a monoclonal single-source seeding pattern" << std::endl;
45
+ }
46
+
47
+ return 0 ;
48
+ }
You can’t perform that action at this time.
0 commit comments