我正在使用来自 arxiv 的 Python 中的第三方代码,它使用 RDkit 作为库。它需要一个 .sdf 文件,其中包含有关化学分子的数据作为参数,但随后 RDkit 抛出错误:
OSError: File error: Bad input file file.sdf
我按照说明安装了所有需要的软件包,按照他们的说法下载了文件,提高了我计算机中的交换空间,因为 .sdf 非常大,删除了这个文件的大部分数据......但我可以不要让它运行,这些尝试都没有成功。
我一直在寻找 RDkit 包,这是引发错误的一段代码:
LocalForwardSDMolSupplier(std::string filename, bool sanitize, bool removeHs,
bool strictParsing) {
std::istream *tmpStream = nullptr;
tmpStream = static_cast<std::istream *>(
new std::ifstream(filename.c_str(), std::ios_base::binary));
if (!tmpStream || (!(*tmpStream)) || (tmpStream->bad())) {
std::ostringstream errout;
errout << "Bad input file " << filename;
throw RDKit::BadFileException(errout.str());
}
dp_inStream = tmpStream;
df_owner = true;
df_sanitize = sanitize;
df_removeHs = removeHs;
df_strictParsing = strictParsing;
POSTCONDITION(dp_inStream, "bad instream");
}
它似乎是C++,我不知道。
我希望看到这段代码是如何工作的,通过哪些输入和输出来适应我的代码。我想看看这个 .sdf 文件,但也许另一个可以满足我的目的。