From: Jim Procter Date: Tue, 1 Sep 2015 16:19:38 +0000 (+0100) Subject: JAL-1853 refactor clip routine from getSequenceStrings X-Git-Tag: Release_2_10_0~514^2~3^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=65f339692b3a60a8c8d7681021d127bf12982163;p=jalview.git JAL-1853 refactor clip routine from getSequenceStrings --- diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index a6f4310..7ccd9cf 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -515,8 +515,38 @@ public class AlignmentView } /** + * build a string excluding hidden regions from a particular sequence in the + * view + * + * @param c + * @param n + * @return + */ + private String getASequenceString(char c, int n) + { + String sqn; + String fullseq = sequences[n].getSequenceString(c); + if (contigs != null) + { + sqn = ""; + int p = 0; + for (int h = 0; h < contigs.length; h += 3) + { + sqn += fullseq.substring(p, contigs[h + 1]); + p = contigs[h + 1] + contigs[h + 2]; + } + sqn += fullseq.substring(p); + } + else + { + sqn = fullseq; + } + return sqn; + } + + /** * get an array of visible sequence strings for a view on an alignment using - * the given gap character + * the given gap character uses getASequenceString * * @param c * char @@ -527,22 +557,7 @@ public class AlignmentView String[] seqs = new String[sequences.length]; for (int n = 0; n < sequences.length; n++) { - String fullseq = sequences[n].getSequenceString(c); - if (contigs != null) - { - seqs[n] = ""; - int p = 0; - for (int h = 0; h < contigs.length; h += 3) - { - seqs[n] += fullseq.substring(p, contigs[h + 1]); - p = contigs[h + 1] + contigs[h + 2]; - } - seqs[n] += fullseq.substring(p); - } - else - { - seqs[n] = fullseq; - } + seqs[n] = getASequenceString(c, n); } return seqs; }