Skip to content
Snippets Groups Projects
Commit f53e24eb authored by Studer Gabriel's avatar Studer Gabriel
Browse files

make molck ready for the mmcif format

When loading the structure, molck checks now for the file endings
.mmcif and .cif and invokes the corresponding reader. Everything
else is still expected to be in pdb format.
parent 162a14ac
Branches
Tags
No related merge requests found
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <ost/conop/amino_acids.hh> #include <ost/conop/amino_acids.hh>
#include <ost/io/mol/pdb_reader.hh> #include <ost/io/mol/pdb_reader.hh>
#include <ost/io/mol/pdb_writer.hh> #include <ost/io/mol/pdb_writer.hh>
#include <ost/io/mol/mmcif_reader.hh>
#include <ost/io/io_exception.hh> #include <ost/io/io_exception.hh>
#include <ost/conop/nonstandard.hh> #include <ost/conop/nonstandard.hh>
#if defined(__APPLE__) #if defined(__APPLE__)
...@@ -26,15 +27,25 @@ namespace fs=boost::filesystem; ...@@ -26,15 +27,25 @@ namespace fs=boost::filesystem;
EntityHandle load_x(const String& file, const IOProfile& profile) EntityHandle load_x(const String& file, const IOProfile& profile)
{ {
try { try {
PDBReader reader(file, profile); EntityHandle ent = CreateEntity();
if (reader.HasNext()) { if(file.compare(file.length() - 6, 6, ".mmcif") == 0 ||
EntityHandle ent=CreateEntity(); file.compare(file.length() - 4, 4, ".cif") == 0){
reader.Import(ent); MMCifReader reader(file,ent,profile);
reader.Parse();
return ent; return ent;
} }
std::cerr << "ERROR: '" << file << "' does not contain any ATOM records. " //if its not mmcif, we assume the file to be in pdb format without even
//looking at the filename
else{
PDBReader reader(file, profile);
if (reader.HasNext()) {
reader.Import(ent);
return ent;
}
std::cerr << "ERROR: '" << file << "' does not contain any ATOM records. "
<< "Are you sure this is a PDB file?" << std::endl; << "Are you sure this is a PDB file?" << std::endl;
return EntityHandle(); return EntityHandle();
}
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "ERROR: " << e.what() << std::endl; std::cerr << "ERROR: " << e.what() << std::endl;
return EntityHandle(); return EntityHandle();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment