X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=9702159e713f550792fe44321109e55411aff26c;hb=a7ea1ba47dae32481aa6390a29cef6c7c5a403c4;hp=156fc35c4c58fd19e12d6ded90acaf0824caf474;hpb=ee91b5df4a306e551e7b75861f86b32fac504d5c;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 156fc35..9702159 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -53,6 +53,8 @@ import jalview.util.MessageManager; public class StructureSelectionManager { + public final static String NEWLINE = System.lineSeparator(); + static IdentityHashMap instances; private List mappings = new ArrayList(); @@ -495,7 +497,7 @@ public class StructureSelectionManager do { - Atom tmp = (Atom) maxChain.atoms.elementAt(index); + Atom tmp = maxChain.atoms.elementAt(index); if (resNum != tmp.resNumber && tmp.alignmentMapping != -1) { resNum = tmp.resNumber; @@ -853,16 +855,34 @@ public class StructureSelectionManager return tmp.toArray(new StructureMapping[tmp.size()]); } - public String printMapping(String pdbfile) + /** + * Returns a readable description of all mappings for the given pdbfile to any + * of the given sequences + * + * @param pdbfile + * @param seqs + * @return + */ + public String printMappings(String pdbfile, List seqs) { + if (pdbfile == null || seqs == null || seqs.isEmpty()) + { + return ""; + } + StringBuilder sb = new StringBuilder(64); for (StructureMapping sm : mappings) { - if (sm.pdbfile.equals(pdbfile)) + if (sm.pdbfile.equals(pdbfile) && seqs.contains(sm.sequence)) { sb.append(sm.mappingDetails); + sb.append(NEWLINE); + // separator makes it easier to read multiple mappings + sb.append("====================="); + sb.append(NEWLINE); } } + sb.append(NEWLINE); return sb.toString(); }