My overall goal is to be able to start with a Structure object, or a wrapper for it in another programming language, and search the RCSB PDB for similar structures. To reproduce the behavior reported here takes a bit of effort, but I think this goal is useful enough to warrant the attention.
To do a structure similarity search through the RCSB you either have a PDB ID or a file to upload. You can do this programmatically through the API by uploading an MMCIF file to a server which then stores a binary CIF file, but for this github issue I can just refer to the web search interface.
In the web interface you select "Structure Similarity", then choose "File Upload" from the dropdown menu
If you upload a local file the buttons change to this configuration
At this point you hit the button "Count" and if it works it changes to a number (which you can click through to the results)
but if it fails, then the "Count" button doesn't change and at the top of the page you see this message
What does this have to do with gemmi you might ask? When I create an MMCIF file from a Structure in gemmi, that CIF file gives the error. Using the following c++ code,
void roundTripMMCIF(const std::string &infile, const std::string &outfile) {
using namespace gemmi;
auto st = make_structure_from_block(cif::read(MaybeGzipped(infile)).blocks.at(0));
auto doc = gemmi::make_mmcif_document(st);
std::ofstream outputstream(outfile);
cif::write_cif_to_stream(outputstream, doc, cif::Style::Pdbx);
}
on this input file gives me an MMCIF file that doesn't work (would it help to upload it here to this ticket?).
So this is an RCSB issue then - maybe, probably, I will search for their github and report it there as well. But if I rewrite the above function to skip the Document->Structure->Document round trip, using the following function
void roundTripMMCIF2(const std::string &infile, const std::string &outfile) {
using namespace gemmi;
auto doc = cif::read(MaybeGzipped(infile));
std::ofstream outputstream(outfile);
cif::write_cif_to_stream(outputstream, doc, cif::Style::Pdbx);
}
then the RCSB structure similarity search works as expected.
Do you know what might be in the output from roundTripMMCIF2 that isn't in roundTripMMCIF that causes the failure? I'm interested to fix this even if it is as-designed on gemmi's end and involves a workaround on my end.
My overall goal is to be able to start with a Structure object, or a wrapper for it in another programming language, and search the RCSB PDB for similar structures. To reproduce the behavior reported here takes a bit of effort, but I think this goal is useful enough to warrant the attention.
To do a structure similarity search through the RCSB you either have a PDB ID or a file to upload. You can do this programmatically through the API by uploading an MMCIF file to a server which then stores a binary CIF file, but for this github issue I can just refer to the web search interface.
In the web interface you select "Structure Similarity", then choose "File Upload" from the dropdown menu
If you upload a local file the buttons change to this configuration
At this point you hit the button "Count" and if it works it changes to a number (which you can click through to the results)
but if it fails, then the "Count" button doesn't change and at the top of the page you see this message
What does this have to do with gemmi you might ask? When I create an MMCIF file from a Structure in gemmi, that CIF file gives the error. Using the following c++ code,
on this input file gives me an MMCIF file that doesn't work (would it help to upload it here to this ticket?).
So this is an RCSB issue then - maybe, probably, I will search for their github and report it there as well. But if I rewrite the above function to skip the Document->Structure->Document round trip, using the following function
then the RCSB structure similarity search works as expected.
Do you know what might be in the output from
roundTripMMCIF2that isn't inroundTripMMCIFthat causes the failure? I'm interested to fix this even if it is as-designed on gemmi's end and involves a workaround on my end.