- /**
- * A helper class to parse a string of the possible forms "content"
- * "[index]content", "[keyName=keyValue]content" and return the integer index,
- * the strings keyName and keyValue, and the content after the square brackets
- * (if present). Values not set will be -1 or null.
- */
- protected class SubId
- {
- protected int index = 0;
+ // open the structure (from same PDB file or given PDBfile)
+ if (!ArgParser.getBoolean(m, Arg.NOSTRUCTURE))
+ {
+ AlignFrame af = afMap.get(id);
+ if (ArgParser.getArgValues(m, Arg.STRUCTURE) != null)
+ {
+ for (String val : ArgParser.getValues(m, Arg.STRUCTURE))
+ {
+ SubVal subId = new SubVal(val);
+ SequenceI seq = getSpecifiedSequence(af, subId);
+ if (seq == null)
+ {
+ Console.warn("Could not find sequence for argument --"
+ + Arg.STRUCTURE + "=" + val);
+ // you probably want to continue here, not break
+ // break;
+ continue;
+ }
+ File structureFile = null;
+ if (subId.content != null && subId.content.length() != 0)
+ {
+ structureFile = new File(subId.content);
+ Console.debug("Using structure file (from argument) '"
+ + structureFile.getAbsolutePath() + "'");
+ }
+ /* THIS DOESN'T WORK */
+ else if (seq.getAllPDBEntries() != null
+ && seq.getAllPDBEntries().size() > 0)
+ {
+ structureFile = new File(
+ seq.getAllPDBEntries().elementAt(0).getFile());
+ Console.debug("Using structure file (from sequence) '"
+ + structureFile.getAbsolutePath() + "'");
+ }
+
+ if (structureFile == null)
+ {
+ Console.warn("Not provided structure file with '" + val + "'");
+ continue;
+ }
+
+ if (!structureFile.exists())
+ {
+ Console.warn("Structure file '"
+ + structureFile.getAbsoluteFile() + "' not found.");
+ continue;
+ }
+
+ Console.debug("Using structure file "
+ + structureFile.getAbsolutePath());
+
+ // open structure view
+ AlignmentPanel ap = af.alignPanel;
+ StructureChooser.openStructureFileForSequence(ap, seq,
+ structureFile);
+ }
+ }
+ }