From: Jim Procter Date: Mon, 29 Aug 2016 21:13:13 +0000 (+0100) Subject: JAL-2154 refactor if (for easier breakpoint) and formatting X-Git-Tag: Release_2_10_0~47^2~4^2~34 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a22250ded2ef2b4a65e342066762008b4f380bbd;p=jalview.git JAL-2154 refactor if (for easier breakpoint) and formatting --- diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index aefc6f8..46256a6 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -836,8 +836,8 @@ public class CrossRef * * @return true if relationship found and sequence added. */ - boolean searchDataset(boolean fromDna, SequenceI fromSeq, - DBRefEntry xrf, List foundSeqs, AlignedCodonFrame mappings, + boolean searchDataset(boolean fromDna, SequenceI fromSeq, DBRefEntry xrf, + List foundSeqs, AlignedCodonFrame mappings, boolean direct) { boolean found = false; @@ -898,37 +898,38 @@ public class CrossRef // } if (!cands.isEmpty()) { - if (!foundSeqs.contains(nxt)) + if (foundSeqs.contains(nxt)) { - found = true; - foundSeqs.add(nxt); - if (mappings != null && !direct) + continue; + } + found = true; + foundSeqs.add(nxt); + if (mappings != null && !direct) + { + /* + * if the matched sequence has mapped dbrefs to + * protein product / cdna, add equivalent mappings to + * our source sequence + */ + for (DBRefEntry candidate : cands) { - /* - * if the matched sequence has mapped dbrefs to - * protein product / cdna, add equivalent mappings to - * our source sequence - */ - for (DBRefEntry candidate : cands) + Mapping mapping = candidate.getMap(); + if (mapping != null) { - Mapping mapping = candidate.getMap(); - if (mapping != null) + MapList map = mapping.getMap(); + if (mapping.getTo() != null + && map.getFromRatio() != map.getToRatio()) { - MapList map = mapping.getMap(); - if (mapping.getTo() != null - && map.getFromRatio() != map.getToRatio()) + /* + * add a mapping, as from dna to peptide sequence + */ + if (map.getFromRatio() == 3) { - /* - * add a mapping, as from dna to peptide sequence - */ - if (map.getFromRatio() == 3) - { - mappings.addMap(nxt, fromSeq, map); - } - else - { - mappings.addMap(nxt, fromSeq, map.getInverse()); - } + mappings.addMap(nxt, fromSeq, map); + } + else + { + mappings.addMap(nxt, fromSeq, map.getInverse()); } } }