Source

optiCall / opticall / filtering.cpp

Diff from to

File opticall/filtering.cpp

 
 /********************* Read gender file ******************************/
 
-vector<int> readInfoFile(string fname, vector<string> allsamples, MatrixXi &samplegenders) {
+vector<int> readInfoFile(string fname, vector<string> allsamples, MatrixXi &samplegenders, MatrixXi &samplebatches) {
 
 	string line;
 	
 	vector<string> infosampleids;
 	vector<int> infosamplegender;
 	vector<int> infosampleexclude;
+	vector<int> infosamplebatch;
 	
 	ifstream myfile (fname.c_str());
 	
 				continue;
 			}
 			
-			//linedata[0] is the sampleid, linedata[1] is the sex, linedata[2] is the exclusion flag
+			//linedata[0] is the sampleid, linedata[1] is the sex, linedata[2] is the exclusion flag, linedata[3] is the batch
 			infosampleids.push_back(linedata[0]);
 			infosamplegender.push_back(atoi(linedata[1].c_str()));
 			infosampleexclude.push_back(atoi(linedata[2].c_str()));
+            infosamplebatch.push_back(atoi(linedata[3].c_str()));
 			
 			
 		}
 	for (int i = 0; i < allsamples.size(); i++)
 	{
 		samplegenders(i,0) = 0;
+        samplebatches(i,0) = 0;
 		for (int j = 0; j < infosampleids.size(); j++ )
 		{
 			if ( allsamples[i] == infosampleids[j] && infosampleexclude[j] == 1 &&  find (exclusion_indices.begin(), exclusion_indices.end(), i)  ==   exclusion_indices.end()  ) {
 			}
 			if ( allsamples[i] == infosampleids[j]  ) {
 				samplegenders(i,0) = infosamplegender[j];
+                samplebatches(i,0) = infosamplebatch[j];
 			}
 		}
 	}