X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=9bd247a4ef11b3428a242d6f8a697e1c3b37873a;hb=7050afe69de0bcfb55cdd28c913fd75357148cd0;hp=3194cce2f5f516bf08b6e4cbbf5d10061ad186f6;hpb=7e3a6674abdd31bf48e7e249a74eff50fd2ce589;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 3194cce..9bd247a 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -155,16 +155,16 @@ public class StructureSelectionManager { if (mappings.isEmpty()) { - System.err.println("reportMapping: No PDB/Sequence mappings."); + jalview.bin.Console.errPrintln("reportMapping: No PDB/Sequence mappings."); } else { - System.err.println( + jalview.bin.Console.errPrintln( "reportMapping: There are " + mappings.size() + " mappings."); int i = 0; for (StructureMapping sm : mappings) { - System.err.println("mapping " + i++ + " : " + sm.pdbfile); + jalview.bin.Console.errPrintln("mapping " + i++ + " : " + sm.pdbfile); } } } @@ -327,7 +327,7 @@ public class StructureSelectionManager IProgressIndicator progress) { return computeMapping(true, sequence, targetChains, pdbFile, protocol, - progress, null, null); + progress, null, null, true); } /** @@ -353,8 +353,42 @@ public class StructureSelectionManager String pdbFile, DataSourceType sourceType, TFType tft, String paeFilename) { + return setMapping(forStructureView, sequenceArray, targetChainIds, + pdbFile, sourceType, tft, paeFilename, true); + } + + + /** + * create sequence structure mappings between each sequence and the given + * pdbFile (retrieved via the given protocol). Either constructs a mapping + * using NW alignment or derives one from any available SIFTS mapping data. + * + * @param forStructureView + * when true, record the mapping for use in mouseOvers + * + * @param sequenceArray + * - one or more sequences to be mapped to pdbFile + * @param targetChainIds + * - optional chain specification for mapping each sequence to pdb + * (may be nill, individual elements may be nill) - JBPNote: JAL-2693 + * - this should be List>, empty lists indicate no + * predefined mappings + * @param pdbFile + * - structure data resource + * @param sourceType + * - how to resolve data from resource + * @param tft - specify how to interpret the temperature factor column in the atom data + * @param paeFilename - when not null, specifies a filename containing a matrix formatted in JSON using one of the known PAE formats + * @param doXferSettings - when true, transfer annotation to mapped sequences in sequenceArray + * @return null or the structure data parsed as a pdb file + */ + synchronized public StructureFile setMapping(boolean forStructureView, + SequenceI[] sequenceArray, String[] targetChainIds, + String pdbFile, DataSourceType sourceType, TFType tft, + String paeFilename, boolean doXferSettings) + { return computeMapping(forStructureView, sequenceArray, targetChainIds, - pdbFile, sourceType, null, tft, paeFilename); + pdbFile, sourceType, null, tft, paeFilename, doXferSettings); } /** @@ -379,12 +413,16 @@ public class StructureSelectionManager * @param IProgressIndicator * reference to UI component that maintains a progress bar for the * mapping operation + * @param tft - specify how to interpret the temperature factor column in the atom data + * @param paeFilename - when not null, specifies a filename containing a matrix formatted in JSON using one of the known PAE formats + * @param doXferSettings - when true, transfer annotation to mapped sequences in sequenceArray * @return null or the structure data parsed as a pdb file */ synchronized public StructureFile computeMapping(boolean forStructureView, SequenceI[] sequenceArray, String[] targetChainIds, String pdbFile, DataSourceType sourceType, - IProgressIndicator progress, TFType tft, String paeFilename) + IProgressIndicator progress, TFType tft, String paeFilename, + boolean doXferSettings) { long progressSessionId = System.currentTimeMillis() * 3; @@ -394,8 +432,7 @@ public class StructureSelectionManager // FIXME: possibly should just delete boolean parseSecStr = processSecondaryStructure - ? isStructureFileProcessed(pdbFile, sequenceArray) - : false; + && !isStructureFileProcessed(pdbFile, sequenceArray); StructureFile pdb = null; boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts(); @@ -412,7 +449,11 @@ public class StructureSelectionManager pdb.addSettings(parseSecStr && processSecondaryStructure, parseSecStr && addTempFacAnnot, parseSecStr && secStructServices); + // save doXferSettings and reset after doParse() + boolean temp = pdb.getDoXferSettings(); + pdb.setDoXferSettings(doXferSettings); pdb.doParse(); + pdb.setDoXferSettings(temp); if (pdb.getId() != null && pdb.getId().trim().length() > 0 && DataSourceType.FILE == sourceType) { @@ -601,12 +642,12 @@ public class StructureSelectionManager chain.transferResidueAnnotation(siftsMapping, null); } catch (SiftsException e) { - System.err.println(e.getMessage()); + jalview.bin.Console.errPrintln(e.getMessage()); } catch (Exception e) { - System.err.println( + jalview.bin.Console.errPrintln( "Unexpected exception during SIFTS mapping - falling back to NW for this sequence/structure pair"); - System.err.println(e.getMessage()); + jalview.bin.Console.errPrintln(e.getMessage()); } } if (!foundSiftsMappings.isEmpty()) @@ -667,7 +708,7 @@ public class StructureSelectionManager private boolean isStructureFileProcessed(String pdbFile, SequenceI[] sequenceArray) { - boolean parseSecStr = true; + boolean processed = false; if (isPDBFileRegistered(pdbFile)) { for (SequenceI sq : sequenceArray) @@ -687,13 +728,13 @@ public class StructureSelectionManager // passed, not the structure data ID - if (PDBfile.isCalcIdForFile(ala, findIdForPDBFile(pdbFile))) { - parseSecStr = false; + processed = true; } } } } } - return parseSecStr; + return processed; } public void addStructureMapping(StructureMapping sm) @@ -1238,7 +1279,7 @@ public class StructureSelectionManager * * if (mappings[j].sequence == seq && mappings[j].getPdbId().equals(pdbid) * && mappings[j].pdbfile.equals(sl.getPdbFile())) { - * System.out.println(pdbid+" "+mappings[j].getPdbId() +" + * jalview.bin.Console.outPrintln(pdbid+" "+mappings[j].getPdbId() +" * "+mappings[j].pdbfile); * * java.awt.Color col; for(int index=0; index