/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* one or more ScGroup objects, which are referenced by each seqCigar's group
* membership
*/
- private List<ScGroup> scGroups=null;
+ private List<ScGroup> scGroups = null;
private boolean isNa = false;
selseqs = alignment.getSequencesArray();
}
- List<List<SequenceI>> seqsets=new ArrayList<List<SequenceI>>();
+ List<List<SequenceI>> seqsets = new ArrayList<List<SequenceI>>();
// get the alignment's group list and make a copy
List<SequenceGroup> grps = new ArrayList<SequenceGroup>();
List<SequenceGroup> gg = alignment.getGroups();
{
if (!seqcigararray.isSeqCigarArray())
{
- throw new Error(MessageManager.getString("error.implementation_error_can_only_make_alignmnet_from_cigararray"));
+ throw new Error(
+ MessageManager
+ .getString("error.implementation_error_can_only_make_alignmnet_from_cigararray"));
}
// contigs = seqcigararray.applyDeletions();
contigs = seqcigararray.getDeletedRegions();
{
ColumnSelection colsel = new ColumnSelection();
- return new Object[]
- {
+ return new Object[] {
SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
contigs), colsel };
}
* alignment.
*
* @param c
+ * gap character to use to recreate the alignment
* @return
*/
private SequenceI[] getVisibleSeqs(char c)
SequenceI[] aln = new SequenceI[sequences.length];
for (int i = 0, j = sequences.length; i < j; i++)
{
- aln[i] = sequences[i].getSeq('-');
- }
- // Remove hidden regions from sequence objects.
- String seqs[] = getSequenceStrings('-');
- for (int i = 0, j = aln.length; i < j; i++)
- {
- aln[i].setSequence(seqs[i]);
+ aln[i] = sequences[i].getSeq(c);
+ // Remove hidden regions from sequence
+ aln[i].setSequence(getASequenceString(c, i));
}
return aln;
}
}
/**
+ * 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
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;
}
{
if (sequences == null || width <= 0)
{
- throw new Error(MessageManager.getString("error.empty_view_cannot_be_updated"));
+ throw new Error(
+ MessageManager
+ .getString("error.empty_view_cannot_be_updated"));
}
if (nvismsa == null)
{
j++;
if (mseq.length != sequences.length)
{
- throw new Error(MessageManager.formatMessage("error.mismatch_between_number_of_sequences_in_block", new String[]{Integer.valueOf(j).toString(),Integer.valueOf(mseq.length).toString(),Integer.valueOf(sequences.length).toString() }));
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.mismatch_between_number_of_sequences_in_block",
+ new String[] {
+ Integer.valueOf(j).toString(),
+ Integer.valueOf(mseq.length)
+ .toString(),
+ Integer.valueOf(
+ sequences.length)
+ .toString() }));
}
swidth = mseq[0].getLength(); // JBPNote: could ensure padded
// here.
else
{
// place gaps.
- throw new Error(MessageManager.getString("error.padding_not_yet_implemented"));
+ throw new Error(
+ MessageManager
+ .getString("error.padding_not_yet_implemented"));
}
}
}
}
}
- return new Object[]
- { alignment, columnselection };
+ return new Object[] { alignment, columnselection };
}
else
{
if (nvismsa.length != 1)
{
- throw new Error(MessageManager.formatMessage("error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view", new String[]{Integer.valueOf(nvismsa.length).toString()}));
+ throw new Error(
+ MessageManager
+ .formatMessage(
+ "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
+ new String[] { Integer.valueOf(
+ nvismsa.length).toString() }));
}
if (nvismsa[0] != null)
{
- return new Object[]
- { nvismsa[0], new ColumnSelection() };
+ return new Object[] { nvismsa[0], new ColumnSelection() };
}
else
{
}
else
{
- return new int[]
- { 0, width };
+ return new int[] { 0, width };
}
}