From: James Procter Date: Thu, 11 Jan 2024 15:15:28 +0000 (+0000) Subject: JAL-4366 remove some tortuous repetition in computeMapping, so SIFTs failures result... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2dc7f485be2afd841461e5eafc71dee47b44f14a;p=jalview.git JAL-4366 remove some tortuous repetition in computeMapping, so SIFTs failures result in NW mappings being created in the same way as if sifts mappings was disabled in preferences. --- diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 735d814..6761cc3 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -598,6 +598,7 @@ public class StructureSelectionManager } List seqToStrucMapping = new ArrayList<>(); + List foundSiftsMappings = new ArrayList<>(); if (isMapUsingSIFTs && seq.isProtein()) { if (progress != null) @@ -622,26 +623,15 @@ public class StructureSelectionManager pdb.getId().toLowerCase(Locale.ROOT)); maxChain.transferResidueAnnotation(siftsMapping, null); ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); + foundSiftsMappings.add(siftsMapping); } catch (SiftsException e) { - // fall back to NW alignment Console.error(e.getMessage()); - StructureMapping nwMapping = getNWMappings(seq, pdbFile, - 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.transferResidueAnnotation(nwMapping, sqmpping); - ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); } } else { - List foundSiftsMappings = new ArrayList<>(); for (PDBChain chain : pdb.getChains()) { StructureMapping siftsMapping = null; @@ -665,30 +655,23 @@ public class StructureSelectionManager jalview.bin.Console.errPrintln(e.getMessage()); } } + // If sifts was successful, add mappings and return if (!foundSiftsMappings.isEmpty()) { - seqToStrucMapping.addAll(foundSiftsMappings); ds.addPDBId(sqmpping.getTo().getAllPDBEntries().get(0)); } - else - { - /* - * fallback to NeedlemanWunch. - */ - 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.transferResidueAnnotation(nwMapping, sqmpping); - ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); - } + } + + // If sifts was successful, add mappings and return + if (!foundSiftsMappings.isEmpty()) + { + seqToStrucMapping.addAll(foundSiftsMappings); } } - else + if (foundSiftsMappings.isEmpty()) { - // Not doing SIFTS + // Not doing SIFTS, or SIFTS failed for some reason. + // first check if we should use an identity mapping if (idLengthChain != null && maxAlignseq.getS2Coverage() < 0.5) {