1+ /* *******************************************************************************/
2+ /* Copyright 2009-2011 -- The Regents of the University of California */
3+ /* This code is provided for research purposes to scientists at non-profit */
4+ /* organizations. All other use is strictly prohibited. For further */
5+ /* details please contact University of California, Santa Cruz or */
6+ /* Five3 Genomics, LLC (http://five3genomics.com). */
7+ /* *******************************************************************************/
8+
19#include < fstream>
210
311#include " common.h"
412#include " evidencesource.h"
513
614#define THROW (msg ) throw std::runtime_error (msg)
715
8- EvidenceFactorGen::EvidenceFactorGen(const PropertySet& p) : _params()
16+ EvidenceFactorGen::EvidenceFactorGen(const PropertySet& p) : _params()
917{
1018 _params.reserve (9 );
1119 if (p.hasKey (" factorParams" )) {
@@ -33,7 +41,7 @@ EvidenceFactorGen::EvidenceFactorGen(const PropertySet& p) : _params()
3341 Real minor = epsilon / 2 ;
3442 Real major0 = 1 - epsilon0;
3543 Real minor0 = epsilon0 / 2 ;
36-
44+
3745 bool flip = false ;
3846 if (p.hasKey (" reverse" )) {
3947 if (p.getStringAs <string>(" reverse" ) == " true" ) {
@@ -49,7 +57,7 @@ EvidenceFactorGen::EvidenceFactorGen(const PropertySet& p) : _params()
4957 _params.push_back (minor);
5058 _params.push_back (minor0);
5159 _params.push_back (major);
52-
60+
5361 _params.push_back (minor);
5462 _params.push_back (major0);
5563 _params.push_back (minor);
@@ -61,18 +69,18 @@ EvidenceFactorGen::EvidenceFactorGen(const PropertySet& p) : _params()
6169 _params.push_back (major);
6270 _params.push_back (minor0);
6371 _params.push_back (minor);
64-
72+
6573 _params.push_back (minor);
6674 _params.push_back (major0);
6775 _params.push_back (minor);
68-
76+
6977 _params.push_back (minor);
7078 _params.push_back (minor0);
7179 _params.push_back (major);
7280 }
7381}
7482
75- void EvidenceFactorGen::generateValues (const vector< string >& edge_types,
83+ void EvidenceFactorGen::generateValues (const vector< string >& edge_types,
7684 vector< Real >& outVals) const
7785{
7886 assert (edge_types.size () == 1 );
@@ -81,10 +89,10 @@ void EvidenceFactorGen::generateValues(const vector< string >& edge_types,
8189 }
8290}
8391
84- EvidenceSource::EvidenceSource (PropertySet &p, string base) :
92+ EvidenceSource::EvidenceSource (PropertySet &p, string base) :
8593 cutoffs(),
8694 options(p),
87- attachPoint(),
95+ attachPoint(),
8896 _evidenceFile()
8997{
9098 if (p.hasKey (" disc" ))
@@ -142,9 +150,9 @@ double stringToDouble(const string& s) {
142150 return result;
143151}
144152
145- void EvidenceSource::loadFromFile (PathwayTab& p,
146- map<string, size_t >& sampleMap,
147- vector<Evidence::Observation>& sampleData)
153+ void EvidenceSource::loadFromFile (PathwayTab& p,
154+ map<string, size_t >& sampleMap,
155+ vector<Evidence::Observation>& sampleData)
148156{
149157 ifstream infile;
150158 infile.open ( _evidenceFile.c_str () );
@@ -169,7 +177,7 @@ void EvidenceSource::loadFromFile(PathwayTab& p,
169177
170178 FactorGenerator* fgen = new EvidenceFactorGen (options);
171179 p.addFactorGenerator (" protein" , _suffix, fgen);
172-
180+
173181 while (getline (infile,line)) {
174182 vector<string> vals;
175183 Tokenize (line,vals," \t " );
@@ -179,7 +187,7 @@ void EvidenceSource::loadFromFile(PathwayTab& p,
179187 string sample = vals[0 ];
180188 _sampleNames.push_back (sample);
181189 vals.erase (vals.begin ());
182-
190+
183191 for (size_t i = 0 ; i < vals.size (); i++) {
184192 if (p.getEntityType (header[i]) != " protein" ) // skip adding evidence if it's not in the pathway
185193 continue ;
@@ -220,4 +228,3 @@ void Tokenize(const string& str,
220228 pos = str.find_first_of (delimiters, lastPos);
221229 }
222230}
223-
0 commit comments