X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=3d5a97576e2221e81a5ceb127302a9709b6ef74b;hb=refs%2Fheads%2Ffeatures%2FJAL-1479_SIFTS-mapping;hp=13aae26f495bd1b722ee7a64ccc5d16c9365dc5c;hpb=14c840a69bcdc5d9709fde571d62c1add051e4f6;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 13aae26..3d5a975 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -326,7 +326,7 @@ public class StructureSelectionManager * @param forStructureView * when true, record the mapping for use in mouseOvers * - * @param sequence + * @param sequenceArray * - one or more sequences to be mapped to pdbFile * @param targetChains * - optional chain specification for mapping each sequence to pdb @@ -338,7 +338,7 @@ public class StructureSelectionManager * @return null or the structure data parsed as a pdb file */ synchronized public PDBfile setMapping(boolean forStructureView, - SequenceI[] sequence, String[] targetChains, String pdbFile, + SequenceI[] sequenceArray, String[] targetChains, String pdbFile, String protocol) { /* @@ -348,7 +348,7 @@ public class StructureSelectionManager boolean parseSecStr = processSecondaryStructure; if (isPDBFileRegistered(pdbFile)) { - for (SequenceI sq : sequence) + for (SequenceI sq : sequenceArray) { SequenceI ds = sq; while (ds.getDatasetSequence() != null) @@ -372,15 +372,25 @@ public class StructureSelectionManager } } PDBfile pdb = null; + boolean isMapUsingSIFTs = Boolean.valueOf(jalview.bin.Cache.getDefault( + "MAP_WITH_SIFTS", "false")); + SiftsClient siftsClient = null; try { pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices, pdbFile, protocol); + if (isMapUsingSIFTs) + { + siftsClient = new SiftsClient(pdb); + } if (pdb.id != null && pdb.id.trim().length() > 0 && AppletFormatAdapter.FILE.equals(protocol)) { registerPDBFile(pdb.id.trim(), pdbFile); } + } catch (SiftsException e) + { + e.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); @@ -388,10 +398,10 @@ public class StructureSelectionManager } String targetChain; - for (int s = 0; s < sequence.length; s++) + for (int s = 0; s < sequenceArray.length; s++) { boolean infChain = true; - final SequenceI seq = sequence[s]; + final SequenceI seq = sequenceArray[s]; if (targetChains != null && targetChains[s] != null) { infChain = false; @@ -465,16 +475,29 @@ public class StructureSelectionManager pdbFile = "INLINE" + pdb.id; } - StructureMapping seqToStrucMapping = null; - boolean isMapViaSIFTs = Boolean.valueOf(jalview.bin.Cache.getDefault( - "MAP_WITH_SIFTS", "false")); - if (isMapViaSIFTs) + ArrayList seqToStrucMapping = null; + if (isMapUsingSIFTs) { - SiftsClient siftsClient = new SiftsClient(pdb); try { - seqToStrucMapping = siftsClient.getSiftsStructureMapping(seq, - pdbFile, maxChainId); + seqToStrucMapping = new ArrayList(); + if (targetChain != null && !targetChain.trim().isEmpty()) + { + maxChainId = targetChain; + StructureMapping curChainMapping = siftsClient + .getSiftsStructureMapping(seq, pdbFile, targetChain); + seqToStrucMapping.add(curChainMapping); + } + else + { + for (PDBChain chain : pdb.chains) + { + maxChainId = chain.id; + StructureMapping curChainMapping = siftsClient + .getSiftsStructureMapping(seq, pdbFile, chain.id); + seqToStrucMapping.add(curChainMapping); + } + } } catch (SiftsException e) { System.err @@ -492,13 +515,15 @@ public class StructureSelectionManager if (forStructureView) { - mappings.add(seqToStrucMapping); + // mappings.add(seqToStrucMapping); + mappings.addAll(seqToStrucMapping); } } return pdb; } - private StructureMapping getNWMappings(SequenceI seq, String pdbFile, + private ArrayList getNWMappings(SequenceI seq, + String pdbFile, String maxChainId, PDBChain maxChain, PDBfile pdb, AlignSeq maxAlignseq) { @@ -574,7 +599,9 @@ public class StructureSelectionManager StructureMapping nwMapping = new StructureMapping(seq, pdbFile, pdb.id, maxChainId, mapping, mappingDetails.toString()); maxChain.transferResidueAnnotation(nwMapping, sqmpping); - return nwMapping; + ArrayList mappings = new ArrayList(); + mappings.add(nwMapping); + return mappings; } public void removeStructureViewerListener(Object svl, String[] pdbfiles)