X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=c8a846c1cadee06efebeda4a45c4c8d2a19c5544;hp=0209e200bbfb66c32a969eee0479ce6343321da0;hb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;hpb=e7338a61f3ce96dadf44ac80b2b32cc5ba4b94c8 diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 0209e20..c8a846c 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -321,7 +321,7 @@ public class StructureSelectionManager * @return null or the structure data parsed as a pdb file */ synchronized public StructureFile setMapping(SequenceI[] sequence, - String[] targetChains, String pdbFile, DataSourceType protocol, + String[] targetChains, String pdbFile, DataSourceType protocol, IProgressIndicator progress) { return computeMapping(true, sequence, targetChains, pdbFile, protocol, @@ -378,9 +378,9 @@ public class StructureSelectionManager * mapping operation * @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, + synchronized public StructureFile computeMapping(boolean forStructureView, + SequenceI[] sequenceArray, String[] targetChainIds, + String pdbFile, DataSourceType sourceType, IProgressIndicator progress) { long progressSessionId = System.currentTimeMillis() * 3; @@ -411,17 +411,20 @@ public class StructureSelectionManager registerPDBFile(pdb.getId().trim(), pdbFile); } // if PDBId is unavailable then skip SIFTS mapping execution path - // TODO: JAL-3868 need to know if structure is actually from - // PDB (has valid PDB ID and has provenance suggesting it + // TODO: JAL-3868 need to know if structure is actually from + // PDB (has valid PDB ID and has provenance suggesting it // actually came from PDB) boolean isProtein = false; - for (SequenceI s:sequenceArray) { - if (s.isProtein()) { + for (SequenceI s : sequenceArray) + { + if (s.isProtein()) + { isProtein = true; break; } } - isMapUsingSIFTs = isMapUsingSIFTs && pdb.isPPDBIdAvailable() && !pdb.getId().startsWith("AF-") && isProtein; + isMapUsingSIFTs = isMapUsingSIFTs && pdb.isPPDBIdAvailable() + && !pdb.getId().startsWith("AF-") && isProtein; } catch (Exception ex) { @@ -533,9 +536,11 @@ public class StructureSelectionManager List seqToStrucMapping = new ArrayList<>(); if (isMapUsingSIFTs && seq.isProtein()) { - if (progress!=null) { - progress.setProgressBar(MessageManager - .getString("status.obtaining_mapping_with_sifts"), + if (progress != null) + { + progress.setProgressBar( + MessageManager + .getString("status.obtaining_mapping_with_sifts"), progressSessionId); } jalview.datamodel.Mapping sqmpping = maxAlignseq @@ -549,7 +554,8 @@ public class StructureSelectionManager pdb, maxChain, sqmpping, maxAlignseq, siftsClient); seqToStrucMapping.add(siftsMapping); maxChain.makeExactMapping(siftsMapping, seq); - maxChain.transferRESNUMFeatures(seq, "IEA: SIFTS",pdb.getId().toLowerCase(Locale.ROOT)); + maxChain.transferRESNUMFeatures(seq, "IEA: SIFTS", + pdb.getId().toLowerCase(Locale.ROOT)); maxChain.transferResidueAnnotation(siftsMapping, null); ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); @@ -561,9 +567,10 @@ public class StructureSelectionManager targetChainId, maxChain, pdb, maxAlignseq); seqToStrucMapping.add(nwMapping); maxChain.makeExactMapping(maxAlignseq, seq); - maxChain.transferRESNUMFeatures(seq, "IEA:Jalview",pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is - // this - // "IEA:Jalview" ? + maxChain.transferRESNUMFeatures(seq, "IEA:Jalview", + pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is + // this + // "IEA:Jalview" ? maxChain.transferResidueAnnotation(nwMapping, sqmpping); ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); } @@ -576,23 +583,21 @@ public class StructureSelectionManager StructureMapping siftsMapping = null; try { - siftsMapping = getStructureMapping(seq, - pdbFile, chain.id, pdb, chain, sqmpping, maxAlignseq, - siftsClient); + siftsMapping = getStructureMapping(seq, pdbFile, chain.id, + pdb, chain, sqmpping, maxAlignseq, siftsClient); foundSiftsMappings.add(siftsMapping); chain.makeExactMapping(siftsMapping, seq); - chain.transferRESNUMFeatures(seq, "IEA: SIFTS",pdb.getId().toLowerCase(Locale.ROOT));// FIXME: is this + chain.transferRESNUMFeatures(seq, "IEA: SIFTS", + pdb.getId().toLowerCase(Locale.ROOT));// FIXME: is this // "IEA:SIFTS" ? chain.transferResidueAnnotation(siftsMapping, null); } catch (SiftsException e) { System.err.println(e.getMessage()); - } - catch (Exception e) + } catch (Exception e) { - System.err - .println( - "Unexpected exception during SIFTS mapping - falling back to NW for this sequence/structure pair"); + System.err.println( + "Unexpected exception during SIFTS mapping - falling back to NW for this sequence/structure pair"); System.err.println(e.getMessage()); } } @@ -606,8 +611,9 @@ public class StructureSelectionManager StructureMapping nwMapping = getNWMappings(seq, pdbFile, maxChainId, maxChain, pdb, maxAlignseq); seqToStrucMapping.add(nwMapping); - maxChain.transferRESNUMFeatures(seq, null,pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is this - // "IEA:Jalview" ? + maxChain.transferRESNUMFeatures(seq, null, + pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is this + // "IEA:Jalview" ? maxChain.transferResidueAnnotation(nwMapping, sqmpping); ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); } @@ -617,8 +623,9 @@ public class StructureSelectionManager { if (progress != null) { - progress.setProgressBar(MessageManager - .getString("status.obtaining_mapping_with_nw_alignment"), + progress.setProgressBar( + MessageManager.getString( + "status.obtaining_mapping_with_nw_alignment"), progressSessionId); } StructureMapping nwMapping = getNWMappings(seq, pdbFile, maxChainId, @@ -708,7 +715,8 @@ public class StructureSelectionManager private StructureMapping getStructureMapping(SequenceI seq, String pdbFile, String targetChainId, StructureFile pdb, PDBChain maxChain, jalview.datamodel.Mapping sqmpping, - AlignSeq maxAlignseq, SiftsClient siftsClient) throws SiftsException + AlignSeq maxAlignseq, SiftsClient siftsClient) + throws SiftsException { StructureMapping curChainMapping = siftsClient .getSiftsStructureMapping(seq, pdbFile, targetChainId); @@ -774,7 +782,8 @@ public class StructureSelectionManager maxChain.makeExactMapping(maxAlignseq, seq); jalview.datamodel.Mapping sqmpping = maxAlignseq .getMappingFromS1(false); - maxChain.transferRESNUMFeatures(seq, null, pdb.getId().toLowerCase(Locale.ROOT)); + maxChain.transferRESNUMFeatures(seq, null, + pdb.getId().toLowerCase(Locale.ROOT)); HashMap mapping = new HashMap<>(); int resNum = -10000;