X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fsifts%2FSiftsClient.java;fp=src%2Fjalview%2Fws%2Fsifts%2FSiftsClient.java;h=2ff4a8b3922fc6e1f3ee6d1a98addf68430b32b4;hb=e0aacff0a162fdf1beb71cd5965b6ff4f8c9de0d;hp=fe3a25b822575c8dea7c6ea1302a057276fa7c4c;hpb=627a783b3535fc5ac2a2b2354ee3f61006f6c37f;p=jalview.git diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index fe3a25b..2ff4a8b 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -21,6 +21,8 @@ package jalview.ws.sifts; import jalview.analysis.AlignSeq; +import jalview.analysis.scoremodels.ScoreMatrix; +import jalview.analysis.scoremodels.ScoreModels; import jalview.api.DBRefEntryI; import jalview.api.SiftsClientI; import jalview.datamodel.DBRefEntry; @@ -963,7 +965,7 @@ public class SiftsClient implements SiftsClientI } @Override - public StringBuffer getMappingOutput(MappingOutputPojo mp) + public StringBuilder getMappingOutput(MappingOutputPojo mp) throws SiftsException { String seqRes = mp.getSeqResidue(); @@ -985,7 +987,7 @@ public class SiftsClient implements SiftsClientI int nochunks = ((seqRes.length()) / len) + ((seqRes.length()) % len > 0 ? 1 : 0); // output mappings - StringBuffer output = new StringBuffer(); + StringBuilder output = new StringBuilder(512); output.append(NEWLINE); output.append("Sequence \u27f7 Structure mapping details").append( NEWLINE); @@ -1006,6 +1008,7 @@ public class SiftsClient implements SiftsClientI output.append(String.valueOf(pdbEnd)); output.append(NEWLINE).append(NEWLINE); + ScoreMatrix pam250 = ScoreModels.getInstance().getPam250(); int matchedSeqCount = 0; for (int j = 0; j < nochunks; j++) { @@ -1024,27 +1027,29 @@ public class SiftsClient implements SiftsClientI output.append(NEWLINE); output.append(new Format("%" + (maxid) + "s").form(" ")).append(" "); - // Print out the matching chars + /* + * Print out the match symbols: + * | for exact match (ignoring case) + * . if PAM250 score is positive + * else a space + */ for (int i = 0; i < len; i++) { try { if ((i + (j * len)) < seqRes.length()) { - boolean sameChar = Comparison.isSameResidue( - seqRes.charAt(i + (j * len)), - strRes.charAt(i + (j * len)), false); - if (sameChar - && !jalview.util.Comparison.isGap(seqRes.charAt(i - + (j * len)))) + char c1 = seqRes.charAt(i + (j * len)); + char c2 = strRes.charAt(i + (j * len)); + boolean sameChar = Comparison.isSameResidue(c1, c2, false); + if (sameChar && !Comparison.isGap(c1)) { matchedSeqCount++; output.append("|"); } else if (type.equals("pep")) { - if (ResidueProperties.getPAM250(seqRes.charAt(i + (j * len)), - strRes.charAt(i + (j * len))) > 0) + if (pam250.getPairwiseScore(c1, c2) > 0) { output.append("."); }