| 481 | } |
| 482 | |
| 483 | vector<string> Options::makeListFromFileByLine(string filename) { |
| 484 | vector<string> ret; |
| 485 | ifstream file; |
| 486 | file.open(filename.c_str(), ifstream::in); |
| 487 | const int maxLine = 1000; |
| 488 | char line[maxLine]; |
| 489 | cerr << "filter by index, loading " << filename << endl; |
| 490 | while(file.getline(line, maxLine)){ |
| 491 | // trim \n, \r or \r\n in the tail |
| 492 | int readed = strlen(line); |
| 493 | if(readed >=2 ){ |
| 494 | if(line[readed-1] == '\n' || line[readed-1] == '\r'){ |
| 495 | line[readed-1] = '\0'; |
| 496 | if(line[readed-2] == '\r') |
| 497 | line[readed-2] = '\0'; |
| 498 | } |
| 499 | } |
| 500 | string linestr(line); |
| 501 | for(int i=0; i<linestr.length(); i++) { |
| 502 | if(linestr[i] != 'A' && linestr[i] != 'T' && linestr[i] != 'C' && linestr[i] != 'G') { |
| 503 | error_exit("processing " + filename + ", each line should be one barcode, which can only contain A/T/C/G"); |
| 504 | } |
| 505 | } |
| 506 | cerr << linestr << endl; |
| 507 | ret.push_back(linestr); |
| 508 | } |
| 509 | cerr << endl; |
| 510 | return ret; |
| 511 | } |
| 512 | |
| 513 | string Options::getAdapter1(){ |
| 514 | if(adapter.sequence == "" || adapter.sequence == "auto") |
nothing calls this directly
no test coverage detected