代码拉取完成,页面将自动刷新
/*
* ebwt.cpp
*
* Created on: Sep 23, 2009
* Author: Ben Langmead
*/
#include <string>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
using namespace std;
#ifdef BOWTIE_64BIT_INDEX
std::string gEbwt_ext("ebwtl");
std::string gBt2_ext("bt2l");
#else
std::string gEbwt_ext("ebwt");
std::string gBt2_ext("bt2");
#endif // BOWTIE_64BIT_INDEX
string gLastIOErrMsg;
/**
* Try to find the Bowtie index specified by the user. First try the
* exact path given by the user. Then try the user-provided string
* appended onto the path of the "indexes" subdirectory below this
* executable, then try the provided string appended onto
* "$BOWTIE_INDEXES/".
*/
string adjustEbwtBase(const string& cmdline,
const string& ebwtFileBase,
bool verbose = false)
{
string str = ebwtFileBase;
ifstream in;
if(verbose) cout << "Trying " << str << endl;
if (access((str + ".1." + gBt2_ext).c_str(), R_OK) == 0) {
gEbwt_ext = gBt2_ext;
}
in.open((str + ".1." + gEbwt_ext).c_str(), ios_base::in | ios::binary);
if(!in.is_open()) {
if(verbose) cout << " didn't work" << endl;
in.close();
str = cmdline;
size_t st = str.find_last_of("/\\");
if(st != string::npos) {
str.erase(st);
str += "/indexes/";
} else {
str = "indexes/";
}
str += ebwtFileBase;
if(verbose) cout << "Trying " << str << endl;
in.open((str + ".1." + gEbwt_ext).c_str(), ios_base::in | ios::binary);
if(!in.is_open()) {
if(verbose) cout << " didn't work" << endl;
in.close();
if(getenv("BOWTIE_INDEXES") != NULL) {
str = string(getenv("BOWTIE_INDEXES")) + "/" + ebwtFileBase;
if(verbose) cout << "Trying " << str << endl;
if (access((str + ".1." + gBt2_ext).c_str(), R_OK) == 0) {
gEbwt_ext = gBt2_ext;
}
in.open((str + ".1." + gEbwt_ext).c_str(), ios_base::in | ios::binary);
if(!in.is_open()) {
if(verbose) cout << " didn't work" << endl;
in.close();
} else {
if(verbose) cout << " worked" << endl;
}
}
}
}
if(!in.is_open()) {
cerr << "Could not locate a Bowtie index corresponding to basename \"" << ebwtFileBase << "\"" << endl;
throw 1;
}
return str;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。