Commits

opticall  committed 44b5b28

made file parsing more robust by stripping trailing whitespace

  • Participants
  • Parent commits 84d901b

Comments (0)

Files changed (1)

File opticall/opticall.cpp

 	vector<string> linedata;
 	linedata.reserve(6000);    // make room for 10 elements
 	
+	trim(line);
+
 	split(linedata, line, boost::is_any_of("\t "));
 	
+	//cout << "bits of line data " << linedata[5] << " " << linedata[linedata.size()-1] << " " << linedata.size()  << endl;
+
 	//cout << linedata.size() << "\n";
 	vector<string> individs(&linedata[0]+3,&linedata[0]+linedata.size());
 	vector<string> snpdesc(&linedata[0],&linedata[0]+3);
 
 				if (intensities[j] == "NaN")
 				{
-					cout << "have an NaN in the dataset" << endl;
+					//cout << "have an NaN in the dataset" << endl;
 					vblock(snpcounter,j) = numeric_limits<double>::quiet_NaN();
 					vblock(snpcounter,j+1) = numeric_limits<double>::quiet_NaN();
 				}
 		}
 	}
 
+	//cout << "num indices size " << num_indices.size() << endl;
+
 	MatrixXd num_data(num_indices.size(),inputdata.cols());
 	for (int i =0; i < num_indices.size(); i++)
 	{
 		num_data.row(i) = inputdata.row(num_indices[i]);
 	}
 
+	//cout << num_data << endl;
+
+	//cout << "numeric data" << endl;
+
 	return num_data;
 
 
 	vector<string> individuals;
 	
 	snpcount = snpCount(fname.c_str(),true);
+
+	cout << "number of SNPs is " << snpcount << endl;
+
 	individuals = readHeaderInfoFromIntFile(fname.c_str());
-	
+
+	cout << "number of inds is " << individuals.size() << endl;
 
 	vector < vector< string > > snpinfo;
 	vector < vector< string > > snpinfo2;
 
 
+
+	//cout << "number of individuals is" << individuals.size() << endl;
+
+
 	ifstream intensityfile (fname_block.c_str());
 
 	//cout << output_fstem+output_prob_ext << endl;
 
 
 	vector<int> sample_nan_inds;
+	cout << "the sample is" << endl;
+	cout << sample << endl;
 	sample = strip_nans(sample, sample_nan_inds);
-
-
+	cout << "NaNs removed: " << sample_nan_inds.size() << endl;
+	cout << "---------" << endl;
 
 
 
 	custommus.push_back(Matrix<double, 1, 2>::Zero());
 	customcovars.push_back(Matrix<double, 2, 2>::Identity() * 100	);
 
-	cout << sample << endl;
+	//cout << sample << endl;
 
 	MatrixXd sd_sample = sd_of_data(sample);
 	cout << "sd sample " << sd_sample << endl;