Commits

opticall committed f1f8393

made file parsing more robust by allowing consecutive whitespace using the ecompress option on the split method

Comments (0)

Files changed (1)

opticall/opticall.cpp

 	
 	trim(line);
 
-	split(linedata, line, boost::is_any_of("\t "));
+	split(linedata, line, boost::is_any_of("\t "), token_compress_on);
 	
 	//cout << "bits of line data " << linedata[5] << " " << linedata[linedata.size()-1] << " " << linedata.size()  << endl;
 
 	MatrixXd sample(min<int>(sample_block_size,snpcount*individuals.size()),2);
 	vector<int> sampling_indices;
 
+	//cout << "getting ready to smaple" << endl;
+
 	//first check if there's actually enough points to take a big sample
 	if (sample_block_size >= snpcount*individuals.size())
 	{
+		//cout << " not enough points for sample " << endl;
 		for (int i = 0; i < snpcount*individuals.size(); i++) {
 			sampling_indices.push_back(i);
 		}
 	}
 	else {
-
+		//cout << " enough points for random sample " << endl;
 		//select a bunch of random numbers
 		srand(time(0));
 		while (sampling_indices.size() < sample_block_size) {
 		sort (sampling_indices.begin(), sampling_indices.end(), lessthanfunction);
 	}
 
-
+	//cout << sampling_indices[0] << " " << sampling_indices[1] << endl;
 
 	//and now finally we fetch the sampled file
 	int counter = 0;
 	for (int snpt = 0; snpt < snpcount; snpt++)
 	{
-
+		//cout << "getting into loop" << endl;
 		MatrixXd block = readVblockFromIntFile(intensityfile,1,individuals.size(),snpinfo);	//read one line from the file
 		//now put the block into a sample
+
+		//cout << snpinfo[snpt][0] << endl;
+
 		for (int ind = 0; ind < individuals.size(); ind++)
 		{
 			if (snpt*individuals.size() + ind == sampling_indices[0])