MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / readChrNamesInBed

Function readChrNamesInBed

src/myFunc.cpp:267–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void readChrNamesInBed(const std::string &targetBed, std::vector<std::string>&names_bed){
268 ifstream file(targetBed.c_str());
269 if (!file.is_open()) {
270 cerr << "Error: unable to open "+targetBed+"\n" ;
271 exit(-1);
272 }
273 string line;
274 string name;
275 bool isFai=0;
276 while (std::getline(file,line)) {
277 if (! line.length()) continue;
278 if (line[0] == '#') continue;
279
280 std::vector<std::string> strs = split(line, '\t');
281 if (strs.size()<2) {
282 continue;
283 }
284 name = strs[0];
285 strs.clear();
286 myReplace(name, " ", "");
287
288 //delete "Chr"
289 string::size_type pos = 0;
290 if ( (pos = name.find("chr", pos)) != string::npos )
291 name.replace( pos, 3, "" );
292
293 names_bed.push_back(name);
294 }
295 file.close();
296}
297
298
299void readFileWithGenomeInfo(const std::string &chrLenFileName, std::vector<std::string>& names, std::vector<int>& lengths) {

Callers 1

checkChrLenFunction · 0.85

Calls 2

splitFunction · 0.85
myReplaceFunction · 0.85

Tested by

no test coverage detected