I'm using a third party code in python from an arxiv which use RDkit as a library. It takes a .sdf file with data about chemicals molecules as an argument, but then RDkit throw an error:
OSError: File error: Bad input file file.sdf 
I followed the instructions, installed all the packages needed, downloaded the files as they said, raise de swap space in my computer because the .sdf is pretty big, strike off a big part of the data of this file... but I can't make it run, none of this tries got success.
I have been looking to the RDkit package and this is the piece of code that raise the error:
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");
}
It seems to be C++, which I don't know.
I expect to see how this code works, with which inputs and outputs, to adapt to my code. I would like to see with this .sdf file, but maybe another one could work for my purpose.
Finally, I found in the original code that the path of that file was incorrect. It needed to add the ../ before, because it was calling to a file in another folder, not from the master, but from one of the subfolders.
Thanks, guys!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With