4 * Created on: Sep 23, 2009
17 * Try to find the Bowtie index specified by the user. First try the
18 * exact path given by the user. Then try the user-provided string
19 * appended onto the path of the "indexes" subdirectory below this
20 * executable, then try the provided string appended onto
23 string adjustEbwtBase(const string& cmdline,
24 const string& ebwtFileBase,
27 string str = ebwtFileBase;
29 if(verbose) cout << "Trying " << str << endl;
30 in.open((str + ".1.ebwt").c_str(), ios_base::in | ios::binary);
32 if(verbose) cout << " didn't work" << endl;
35 size_t st = str.find_last_of("/\\");
36 if(st != string::npos) {
43 if(verbose) cout << "Trying " << str << endl;
44 in.open((str + ".1.ebwt").c_str(), ios_base::in | ios::binary);
46 if(verbose) cout << " didn't work" << endl;
48 if(getenv("BOWTIE_INDEXES") != NULL) {
49 str = string(getenv("BOWTIE_INDEXES")) + "/" + ebwtFileBase;
50 if(verbose) cout << "Trying " << str << endl;
51 in.open((str + ".1.ebwt").c_str(), ios_base::in | ios::binary);
53 if(verbose) cout << " didn't work" << endl;
56 if(verbose) cout << " worked" << endl;
62 cerr << "Could not locate a Bowtie index corresponding to basename \"" << ebwtFileBase << "\"" << endl;