Provide command line interface to test parsing of any CIF
merkys opened this issue · 5 comments
Currently, Demo.java
has a nice command line interface to test parsing of 1acj
PDB entry:
ciftools-java/src/main/java/org/rcsb/cif/Demo.java
Lines 17 to 23 in c589bd5
It would be great if
main
in Demo.java
could accept a filename to parse, and fallback on 1acj
if not given anything.
I am doing a comparison of CIF readers and would like to include CIFTools (cod-developers/CIF-parsers#4). To do so I need a command line interface to parse a given file. I believe having such command line interface would benefit other purposes as well, for example, to see if a CIF file parses correctly.
Hi @merkys,
That's nice to hear. I've ran some of your test cases and this implementation looks quite forgiving when it comes to malformed files.
Something along these lines should allow you to test files via the command-line:
import java.nio.file.Paths;
public class Validate {
public static void main(String[] args) {
try {
CifIO.readFromPath(Paths.get(args[0]));
} catch (Exception e) {
System.out.println("Not OK: " + e.getClass().getSimpleName() + " - " + e.getMessage());
}
}
}
Let me know if you'd like me to compile this into a runnable .jar
and send it to you. I would rather not commit any changes related to this issue to the repo.
Best,
Sebastian
Thanks for prompt response, @JonStargaryen. I will look into adapting your code example into a test runner, I believe I will manage without a runnable JAR, but thanks.
I would rather not commit any changes related to this issue to the repo.
I saw Demo.java
having a command line interface and thought this could make a nice backwards-compatible extension. But sure, I fully understand your choice.
I am closing this issue as I consider it solved. Thanks again!
Your example worked, thanks a lot. I have included ciftools-java in my comparison of CIF parsers. By the way, is ciftools-java able to read CIF v2.0 files?
No, neither reading nor writing of CIF2 files is supported.
OK, thanks for the answer.