opticall avatar opticall committed 3edefdb

made the intensity file reader able to handle spaces and tabs using boost split

Comments (0)

Files changed (2)

opticall/exampleintensityfile.int

+SNP	Coor	Alleles	sample1A	sample1B	sample2A	sample2B
+imm_15_36603164	36603164	AG	0.187	0.212	0.026	0.252
+imm_15_36605574	36605574	AC	0.137	0.727	0.127	0.608
+imm_15_36616490	36616490	AG	0.649	0.011	0.646	0.017
+imm_15_36622324	36622324	AG	0.360	0.047	0.332	0.042
+imm_15_36625239	36625239	AC	0.817	0.044	0.865	0.033
+imm_15_36658372	36658372	AG	NaN	NaN	0.725	0.019
+imm_15_36685468	36685468	AG	1.064	0.044	1.046	0.018

opticall/opticall.cpp

 #include <time.h>
 
 #include <boost/tokenizer.hpp>
+#include <boost/algorithm/string.hpp>
 #include <boost/math/distributions/chi_squared.hpp>
 
 #include <Eigen/Core>
 
 /***********************Parse a line to get the intensities***************/
 
+
+
+
+
 vector<string> intensitiesFromLine(string line, vector < vector <string>  > &snpinfo){
-
-	string s = line;
 	
-	char_separator<char> sep("\t");
-	tokenizer<char_separator<char> >  tokens(s, sep);
 	
-
 	vector<string> linedata;
 	linedata.reserve(6000);    // make room for 10 elements
 	
-	
-	for(tokenizer<char_separator<char> >::iterator tok_iter = tokens.begin();
-		tok_iter != tokens.end(); ++tok_iter){
-		//cout << *tok_iter << "\n";
-		linedata.push_back(*tok_iter);
-	}
+	split(linedata, line, boost::is_any_of("\t "));
 	
 	//cout << linedata.size() << "\n";
 	vector<string> individs(&linedata[0]+3,&linedata[0]+linedata.size());
 	snpinfo.push_back(snpdesc);
 	return individs;
 
-	
 }
 
 
 
+
 /*****************Get Header Info**************/
 
 vector<string> readHeaderInfoFromIntFile(const char * fname) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.