X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentView.java;h=ea0fbe0dbfb52a3e120bd94a9fe6923c5fc13e71;hb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;hp=a76e90e2e21e280f845b2b67be331cdbdf67fc6f;hpb=7f2a5060015acbd1f5c1d45f8483329492876f87;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index a76e90e..ea0fbe0 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -1,55 +1,253 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Copyright (C) 2014 The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.datamodel; +import jalview.util.ShiftList; +import java.io.PrintStream; +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; /** - *

Title:

- * - *

Description:

- * - *

Copyright: Copyright (c) 2004

- * - *

Company: Dundee University

- * - * @author not attributable - * @version 1.0 + * Transient object compactly representing a 'view' of an alignment - with + * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence + * groups and specific selected regions on the alignment. */ public class AlignmentView { - /** - * Transient object compactly representing a 'view' of an alignment - with discontinuities marked. - */ - private SeqCigar[] sequences = null; + private SeqCigar[] sequences = null; + private int[] contigs = null; - private int width=0; + + private int width = 0; + + private int firstCol = 0; + + /** + * one or more ScGroup objects, which are referenced by each seqCigar's group + * membership + */ + private Vector scGroups; + + /** + * Group defined over SeqCigars. Unlike AlignmentI associated groups, each + * SequenceGroup hold just the essential properties for the group, but no + * references to the sequences involved. SeqCigars hold references to the + * seuqenceGroup entities themselves. + */ + private class ScGroup + { + public Vector seqs; + + public SequenceGroup sg; + + ScGroup() + { + seqs = new Vector(); + } + } + + /** + * vector of selected seqCigars. This vector is also referenced by each + * seqCigar contained in it. + */ + private Vector selected; + + /** + * Construct an alignmentView from a live jalview alignment view. Note - + * hidden rows will be excluded from alignmentView Note: JAL-1179 + * + * @param alignment + * - alignment as referenced by an AlignViewport + * @param columnSelection + * - + * @param selection + * @param hasHiddenColumns + * - mark the hidden columns in columnSelection as hidden in the view + * @param selectedRegionOnly + * - when set, only include the selected region in the view, + * otherwise just mark the selected region on the constructed view. + * @param recordGroups + * - when set, any groups on the given alignment will be marked on + * the view + */ + public AlignmentView(AlignmentI alignment, + ColumnSelection columnSelection, SequenceGroup selection, + boolean hasHiddenColumns, boolean selectedRegionOnly, + boolean recordGroups) + { + // refactored from AlignViewport.getAlignmentView(selectedOnly); + this(new jalview.datamodel.CigarArray(alignment, + (hasHiddenColumns ? columnSelection : null), + (selectedRegionOnly ? selection : null)), + (selectedRegionOnly && selection != null) ? selection + .getStartRes() : 0); + // walk down SeqCigar array and Alignment Array - optionally restricted by + // selected region. + // test group membership for each sequence in each group, store membership + // and record non-empty groups in group list. + // record / sub-select selected region on the alignment view + SequenceI[] selseqs; + if (selection != null && selection.getSize() > 0) + { + List sel = selection.getSequences(null); + this.selected = new Vector(); + selseqs = selection + .getSequencesInOrder(alignment, selectedRegionOnly); + } + else + { + selseqs = alignment.getSequencesArray(); + } + + // get the alignment's group list and make a copy + Vector grps = new Vector(); + List gg = alignment.getGroups(); + grps.addAll(gg); + ScGroup[] sgrps = null; + boolean addedgps[] = null; + if (grps != null) + { + SequenceGroup sg; + if (selection != null && selectedRegionOnly) + { + // trim annotation to the region being stored. + // strip out any groups that do not actually intersect with the + // visible and selected region + int ssel = selection.getStartRes(), esel = selection.getEndRes(); + Vector isg = new Vector(); + Enumeration en = grps.elements(); + while (en.hasMoreElements()) + { + sg = (SequenceGroup) en.nextElement(); + + if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel)) + { + // adjust bounds of new group, if necessary. + if (sg.getStartRes() < ssel) + { + sg.setStartRes(ssel); + } + if (sg.getEndRes() > esel) + { + sg.setEndRes(esel); + } + sg.setStartRes(sg.getStartRes() - ssel + 1); + sg.setEndRes(sg.getEndRes() - ssel + 1); + + isg.addElement(sg); + } + } + grps = isg; + } + + sgrps = new ScGroup[grps.size()]; + addedgps = new boolean[grps.size()]; + for (int g = 0; g < sgrps.length; g++) + { + sg = (SequenceGroup) grps.elementAt(g); + sgrps[g] = new ScGroup(); + sgrps[g].sg = new SequenceGroup(sg); + addedgps[g] = false; + grps.setElementAt(sg.getSequences(null), g); + } + // grps now contains vectors (should be sets) for each group, so we can + // track when we've done with the group + } + int csi = 0; + for (int i = 0; i < selseqs.length; i++) + { + if (selseqs[i] != null) + { + if (selection != null && selection.getSize() > 0 + && !selectedRegionOnly) + { + sequences[csi].setGroupMembership(selected); + selected.addElement(sequences[csi]); + } + if (grps != null) + { + for (int sg = 0; sg < sgrps.length; sg++) + { + if (((Vector) grps.elementAt(sg)).contains(selseqs[i])) + { + sequences[csi].setGroupMembership(sgrps[sg]); + sgrps[sg].sg.deleteSequence(selseqs[i], false); + sgrps[sg].seqs.addElement(sequences[csi]); + if (!addedgps[sg]) + { + if (scGroups == null) + { + scGroups = new Vector(); + } + addedgps[sg] = true; + scGroups.addElement(sgrps[sg]); + } + } + } + } + csi++; + } + } + // finally, delete the remaining sequences (if any) not selected + for (int sg = 0; sg < sgrps.length; sg++) + { + SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null); + for (int si = 0; si < sqs.length; si++) + { + sgrps[sg].sg.deleteSequence(sqs[si], false); + } + sgrps[sg] = null; + } + } + + /** + * construct an alignmentView from a SeqCigarArray. Errors are thrown if the + * seqcigararray.isSeqCigarArray() flag is not set. + */ public AlignmentView(CigarArray seqcigararray) { if (!seqcigararray.isSeqCigarArray()) - throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences."); - //contigs = seqcigararray.applyDeletions(); + { + throw new Error( + "Implementation Error - can only make an alignment view from a CigarArray of sequences."); + } + // contigs = seqcigararray.applyDeletions(); contigs = seqcigararray.getDeletedRegions(); sequences = seqcigararray.getSeqCigarArray(); width = seqcigararray.getWidth(); // visible width } + /** + * Create an alignmentView where the first column corresponds with the + * 'firstcol' column of some reference alignment + * + * @param sdata + * @param firstcol + */ + public AlignmentView(CigarArray sdata, int firstcol) + { + this(sdata); + firstCol = firstcol; + } + public void setSequences(SeqCigar[] sequences) { this.sequences = sequences; @@ -64,6 +262,7 @@ public class AlignmentView { return sequences; } + /** * @see CigarArray.getDeletedRegions * @return int[] { vis_start, sym_start, length } @@ -72,26 +271,247 @@ public class AlignmentView { return contigs; } + /** - * get the full alignment and a columnselection object marking the hidden regions - * @param gapCharacter char + * get the full alignment and a columnselection object marking the hidden + * regions + * + * @param gapCharacter + * char * @return Object[] { SequenceI[], ColumnSelection} */ - public Object[] getAlignmentAndColumnSelection(char gapCharacter) { + public Object[] getAlignmentAndColumnSelection(char gapCharacter) + { ColumnSelection colsel = new ColumnSelection(); - return new Object[] { SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, contigs), colsel}; + return new Object[] + { + SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, + contigs), colsel }; + } + + /** + * return the visible alignment corresponding to this view. Sequences in this + * alignment are edited versions of the parent sequences - where hidden + * regions have been removed. NOTE: the sequence data in this alignment is not + * complete! + * + * @param c + * @return + */ + public AlignmentI getVisibleAlignment(char c) + { + SequenceI[] aln = getVisibleSeqs(c); + + AlignmentI vcal = new Alignment(aln); + addPrunedGroupsInOrder(vcal, -1, -1, true); + return vcal; + } + + /** + * add groups from view to the given alignment + * + * @param vcal + * @param gstart + * -1 or 0 to width-1 + * @param gend + * -1 or gstart to width-1 + * @param viscontigs + * - true if vcal is alignment of the visible regions of the view + * (e.g. as returned from getVisibleAlignment) + */ + private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, + int gend, boolean viscontigs) + { + boolean r = false; + if (gstart > -1 && gstart <= gend) + { + r = true; + } + + SequenceI[] aln = vcal.getSequencesArray(); + { + /** + * prune any groups to the visible coordinates of the alignment. + */ + { + int nvg = (scGroups != null) ? scGroups.size() : 0; + if (nvg > 0) + { + SequenceGroup[] nsg = new SequenceGroup[nvg]; + for (int g = 0; g < nvg; g++) + { + SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg; + if (r) + { + if (sg.getStartRes() > gend || sg.getEndRes() < gstart) + { + // Skip this group + nsg[g] = null; + continue; + } + } + + // clone group properties + nsg[g] = new SequenceGroup(sg); + + // may need to shift/trim start and end ? + if (r && !viscontigs) + { + // Not fully tested code - routine not yet called with + // viscontigs==false + if (nsg[g].getStartRes() < gstart) + { + nsg[g].setStartRes(0); + } + else + { + nsg[g].setStartRes(nsg[g].getStartRes() - gstart); + nsg[g].setEndRes(nsg[g].getEndRes() - gstart); + } + if (nsg[g].getEndRes() > (gend - gstart)) + { + nsg[g].setEndRes(gend - gstart); + } + } + } + if (viscontigs) + { + // prune groups to cover just the visible positions between + // gstart/gend. + if (contigs != null) + { + int p = 0; + ShiftList prune = new ShiftList(); + if (r) + { + // adjust for start of alignment within visible window. + prune.addShift(gstart, -gstart); // + } + for (int h = 0; h < contigs.length; h += 3) + { + { + prune.addShift(p + contigs[h + 1], contigs[h + 2] + - contigs[h + 1]); + } + p = contigs[h + 1] + contigs[h + 2]; + } + for (int g = 0; g < nsg.length; g++) + { + if (nsg[g] != null) + { + int s = nsg[g].getStartRes(), t = nsg[g].getEndRes(); + int w = 1 + t - s; + if (r) + { + if (s < gstart) + { + s = gstart; + } + if (t > gend) + { + t = gend; + } + } + s = prune.shift(s); + t = prune.shift(t); + nsg[g].setStartRes(s); + nsg[g].setEndRes(t); + } + } + } + } + + for (int nsq = 0; nsq < aln.length; nsq++) + { + for (int g = 0; g < nvg; g++) + { + if (nsg[g] != null + && sequences[nsq].isMemberOf(scGroups.elementAt(g))) + { + nsg[g].addSequence(aln[nsq], false); + } + } + } + for (int g = 0; g < nvg; g++) + { + if (nsg[g] != null && nsg[g].getSize() > 0) + { + vcal.addGroup(nsg[g]); + } + nsg[g] = null; + } + } + } + } + } + + /** + * generate sequence array corresponding to the visible parts of the + * alignment. + * + * @param c + * @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]); + } + return aln; } + + /** + * creates new alignment objects for all contiguous visible segments + * + * @param c + * @param start + * @param end + * @param regionOfInterest + * specify which sequences to include (or null to include all + * sequences) + * @return AlignmentI[] - all alignments where each sequence is a subsequence + * constructed from visible contig regions of view + */ + public AlignmentI[] getVisibleContigAlignments(char c) + { + int nvc = 0; + int[] vcontigs = getVisibleContigs(); + SequenceI[][] contigviews = getVisibleContigs(c); + AlignmentI[] vcals = new AlignmentI[contigviews.length]; + for (nvc = 0; nvc < contigviews.length; nvc++) + { + vcals[nvc] = new Alignment(contigviews[nvc]); + if (scGroups != null && scGroups.size() > 0) + { + addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2], + vcontigs[nvc * 2 + 1], true); + } + } + return vcals; + } + /** - * getSequenceStrings - * - * @param c char + * get an array of visible sequence strings for a view on an alignment using + * the given gap character + * + * @param c + * char * @return String[] */ public String[] getSequenceStrings(char c) { - String[] seqs=new String[sequences.length]; - for (int n=0; n 0) { int start = 0; @@ -136,11 +568,12 @@ public class AlignmentView int fwidth = width; for (int contig = 0; contig < contigs.length; contig += 3) { - if ( (contigs[contig + 1] - start) > 0) + if ((contigs[contig + 1] - start) > 0) { njobs++; } - fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) + fwidth += contigs[contig + 2]; // end up with full region width + // (including hidden regions) start = contigs[contig + 1] + contigs[contig + 2]; } if (start < fwidth) @@ -157,8 +590,8 @@ public class AlignmentView SequenceI mseq[] = new SequenceI[sequences.length]; for (int s = 0; s < mseq.length; s++) { - mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, - contigs[contig + 1]); + mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence( + start, contigs[contig + 1]); } smsa[j] = mseq; j++; @@ -171,7 +604,7 @@ public class AlignmentView for (int s = 0; s < mseq.length; s++) { mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, - fwidth + 1); + fwidth + 1); } smsa[j] = mseq; j++; @@ -188,20 +621,29 @@ public class AlignmentView } return smsa; } + /** - * return full msa and hidden regions with visible blocks replaced with new sub alignments - * @param nvismsa SequenceI[][] - * @param orders AlignmentOrder[] corresponding to each SequenceI[] block. + * return full msa and hidden regions with visible blocks replaced with new + * sub alignments + * + * @param nvismsa + * SequenceI[][] + * @param orders + * AlignmentOrder[] corresponding to each SequenceI[] block. * @return Object[] */ - public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders, char gapCharacter) { + public Object[] getUpdatedView(SequenceI[][] nvismsa, + AlignmentOrder[] orders, char gapCharacter) + { if (sequences == null || width <= 0) { throw new Error("empty view cannot be updated."); } if (nvismsa == null) + { throw new Error( - "nvismsa==null. use getAlignmentAndColumnSelection() instead."); + "nvismsa==null. use getAlignmentAndColumnSelection() instead."); + } if (contigs != null && contigs.length > 0) { SequenceI[] alignment = new SequenceI[sequences.length]; @@ -221,11 +663,18 @@ public class AlignmentView if (nvismsa[j] != null) { SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order=(orders==null) ? null : orders[j]; + AlignmentOrder order = (orders == null) ? null : orders[j]; j++; - if (mseq.length!=sequences.length) - throw new Error("Mismatch between number of sequences in block "+j+" ("+mseq.length+") and the original view ("+sequences.length+")"); - swidth = mseq[0].getLength(); // JBPNote: could ensure padded here. + if (mseq.length != sequences.length) + { + throw new Error( + "Mismatch between number of sequences in block " + + j + " (" + mseq.length + + ") and the original view (" + + sequences.length + ")"); + } + swidth = mseq[0].getLength(); // JBPNote: could ensure padded + // here. for (int s = 0; s < mseq.length; s++) { if (alignment[s] == null) @@ -234,13 +683,15 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s].getSequence() + - mseq[s].getSequence()); + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + mseq[s].getSequenceAsString()); if (mseq[s].getStart() <= mseq[s].getEnd()) { alignment[s].setEnd(mseq[s].getEnd()); } - if (order!=null) { + if (order != null) + { order.updateSequence(mseq[s], alignment[s]); } } @@ -254,8 +705,8 @@ public class AlignmentView // recover input data for (int s = 0; s < sequences.length; s++) { - SequenceI oseq = sequences[s].getSeq(gapCharacter).getSubSequence(start, - contigs[contig + 1]); + SequenceI oseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(start, contigs[contig + 1]); if (swidth < oseq.getLength()) { swidth = oseq.getLength(); @@ -266,8 +717,9 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s].getSequence() + - oseq.getSequence()); + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + oseq.getSequenceAsString()); if (oseq.getEnd() >= oseq.getStart()) { alignment[s].setEnd(oseq.getEnd()); @@ -285,16 +737,16 @@ public class AlignmentView // add hidden segment to right of next region for (int s = 0; s < sequences.length; s++) { - SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence(contigs[contig + - 1], start); + SequenceI hseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(contigs[contig + 1], start); if (alignment[s] == null) { alignment[s] = hseq; } else { - alignment[s].setSequence(alignment[s].getSequence() + - hseq.getSequence()); + alignment[s].setSequence(alignment[s].getSequenceAsString() + + hseq.getSequenceAsString()); if (hseq.getEnd() >= hseq.getStart()) { alignment[s].setEnd(hseq.getEnd()); @@ -302,7 +754,8 @@ public class AlignmentView } } // mark hidden segment as hidden in the new alignment - columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1); + columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] + - 1); nwidth += contigs[contig + 2]; } // Do final segment - if it exists @@ -312,7 +765,7 @@ public class AlignmentView if (nvismsa[j] != null) { SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order = (orders!=null) ? orders[j] : null; + AlignmentOrder order = (orders != null) ? orders[j] : null; swidth = mseq[0].getLength(); for (int s = 0; s < mseq.length; s++) { @@ -322,13 +775,14 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s].getSequence() + - mseq[s].getSequence()); + alignment[s].setSequence(alignment[s].getSequenceAsString() + + mseq[s].getSequenceAsString()); if (mseq[s].getEnd() >= mseq[s].getStart()) { alignment[s].setEnd(mseq[s].getEnd()); } - if (order!=null) { + if (order != null) + { order.updateSequence(mseq[s], alignment[s]); } } @@ -344,8 +798,8 @@ public class AlignmentView // recover input data for (int s = 0; s < sequences.length; s++) { - SequenceI oseq = sequences[s].getSeq(gapCharacter).getSubSequence(start, - owidth + 1); + SequenceI oseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(start, owidth + 1); if (swidth < oseq.getLength()) { swidth = oseq.getLength(); @@ -356,8 +810,9 @@ public class AlignmentView } else { - alignment[s].setSequence(alignment[s].getSequence() + - oseq.getSequence()); + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + oseq.getSequenceAsString()); if (oseq.getEnd() >= oseq.getStart()) { alignment[s].setEnd(oseq.getEnd()); @@ -375,22 +830,39 @@ public class AlignmentView } } } - return new Object[] { alignment, columnselection}; - } else { - if (nvismsa.length!=1) - throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks="+nvismsa.length); - if (nvismsa[0]!=null) - return new Object[] { nvismsa[0], new ColumnSelection()}; + return new Object[] + { alignment, columnselection }; + } + else + { + if (nvismsa.length != 1) + { + throw new Error( + "Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" + + nvismsa.length); + } + if (nvismsa[0] != null) + { + return new Object[] + { nvismsa[0], new ColumnSelection() }; + } else + { return getAlignmentAndColumnSelection(gapCharacter); + } } } + /** * returns simple array of start end positions of visible range on alignment. - * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment. + * vis_start and vis_end are inclusive - use + * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence + * from underlying alignment. + * * @return int[] { start_i, end_i } for 1 0) { int start = 0; @@ -398,37 +870,308 @@ public class AlignmentView int fwidth = width; for (int contig = 0; contig < contigs.length; contig += 3) { - if ( (contigs[contig + 1] - start) > 0) + if ((contigs[contig + 1] - start) > 0) { nvis++; } - fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions) + fwidth += contigs[contig + 2]; // end up with full region width + // (including hidden regions) start = contigs[contig + 1] + contigs[contig + 2]; } if (start < fwidth) { nvis++; } - int viscontigs[] = new int[nvis*2]; - nvis=0; - start=0; - for (int contig=0; contig 0) + int viscontigs[] = new int[nvis * 2]; + nvis = 0; + start = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ((contigs[contig + 1] - start) > 0) { viscontigs[nvis] = start; - viscontigs[nvis+1]=contigs[contig+1]-1; // end is inclusive - nvis+=2; + viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive + nvis += 2; } - start = contigs[contig + 1] + contigs[contig + 2]; + start = contigs[contig + 1] + contigs[contig + 2]; } - if (start