X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FMsaWSThread.java;h=3fd5fbcf417324010e9d321e2f878eb1248e66a0;hb=8b73158ccaba69771fab1f386a27e9e0938c69d4;hp=62f076a284f9595aa0b31cb1ca549812bbf81b2e;hpb=6c83ae1da00ab89c8fc7b88fab32b2d4a8a05feb;p=jalview.git diff --git a/src/jalview/ws/MsaWSThread.java b/src/jalview/ws/MsaWSThread.java index 62f076a..3fd5fbc 100644 --- a/src/jalview/ws/MsaWSThread.java +++ b/src/jalview/ws/MsaWSThread.java @@ -1,3 +1,21 @@ +/* + * 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 + */ package jalview.ws; import java.util.*; @@ -321,88 +339,28 @@ class MsaWSThread OutputHeader = wsInfo.getProgressText(); alTitle = title; dataset = seqset; - SeqCigar[] msa = _msa.getSequences(); - int[] contigs = _msa.getContigs(); - int njobs = 1; - if (contigs != null && contigs.length > 0) + + SequenceI[][] conmsa = _msa.getVisibleContigs('-'); + if (conmsa != null) { - int start = 0; - njobs = 0; - int width = _msa.getWidth(); - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ( (contigs[contig + 1] - start) > 0) - { - njobs++; - } - width += contigs[contig + 2]; // end up with full region width (including hidden regions) - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < width) - { - njobs++; - } + int njobs = conmsa.length; jobs = new MsaWSJob[njobs]; - start = 0; - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) + for (int j = 0; j < njobs; j++) { - if (contigs[contig + 1] - start > 0) - { - SequenceI mseq[] = new SequenceI[msa.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = msa[s].getSeq('-').getSubSequence(start, - contigs[contig + 1]); - } - if (j != 0) - { - jobs[j] = new MsaWSJob(wsinfo.addJobPane(), mseq); - } - else - { - jobs[j] = new MsaWSJob(0, mseq); - } - wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); - wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); - j++; - } - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < width) - { - SequenceI mseq[] = new SequenceI[msa.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = msa[s].getSeq('-').getSubSequence(start, - width + 1); - } if (j != 0) { - jobs[j] = new MsaWSJob(wsinfo.addJobPane(), mseq); + jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]); } else { - jobs[j] = new MsaWSJob(0, mseq); + jobs[j] = new MsaWSJob(0, conmsa[j]); } - wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); + if (njobs > 0) + wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); - j++; } } - else - { - SequenceI mseq[] = new SequenceI[msa.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = msa[s].getSeq('-'); - } - jobs = new MsaWSJob[1]; - wsinfo.setProgressText(OutputHeader); // ensures default text - jobs[0] = new MsaWSJob(0, mseq); - } } - public boolean isCancellable() { return true; @@ -629,206 +587,48 @@ class MsaWSThread void displayResults(boolean newFrame) { // view input or result data for each block - // warn user if a block is input rather than aligned data ? - - int contigs[] = input.getContigs(); - SeqCigar[] seqs = input.getSequences(); - SequenceI[] alignment = new SequenceI[seqs.length]; - ColumnSelection columnselection = new ColumnSelection(); Vector alorders = new Vector(); - if (contigs != null && contigs.length > 0) - { - int start = 0; - int nwidth = 0; - int owidth = input.getWidth(); - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - owidth += contigs[contig + 2]; // recover final column width - if (contigs[contig + 1] - start > 0) - { - int width = 0; // subalignment width - if (jobs[j].hasResults()) - { - Object[] subalg = ((MsaWSJob) jobs[j++]).getAlignment(); - alorders.add(subalg[1]); - SequenceI mseq[] = (SequenceI[]) subalg[0]; - width = mseq[0].getLength(); - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s].getSequence() + - mseq[s].getSequence()); - if (mseq[s].getStart() <= mseq[s].getEnd()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - ( (AlignmentOrder) subalg[1]).updateSequence(mseq[s], - alignment[s]); - } - } - } - else - { - // recover input data or place gaps - if (true) - { - // recover input data - for (int s = 0; s < seqs.length; s++) - { - SequenceI oseq = seqs[s].getSeq('-').getSubSequence(start, - contigs[contig + 1]); - if (width < oseq.getLength()) - { - width = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequence() + - oseq.getSequence()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - - } - j++; - } - nwidth += width; - } - // advance to begining of visible region - start = contigs[contig + 1] + contigs[contig + 2]; - // add hidden segment to right of next region - for (int s = 0; s < seqs.length; s++) - { - SequenceI hseq = seqs[s].getSeq('-').getSubSequence(contigs[contig + - 1], start); - if (alignment[s] == null) - { - alignment[s] = hseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequence() + - hseq.getSequence()); - if (hseq.getEnd() >= hseq.getStart()) - { - alignment[s].setEnd(hseq.getEnd()); - } - } - } - // mark hidden segment as hidden in the new alignment - columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1); - nwidth += contigs[contig + 2]; - } - // Do final job - if it exists - if (j < jobs.length) - { - int width = 0; - if (jobs[j].hasResults()) - { - Object[] subalg = ((MsaWSJob) jobs[j]).getAlignment(); - alorders.add(subalg[1]); - SequenceI mseq[] = (SequenceI[]) subalg[0]; - width = mseq[0].getLength(); - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s].getSequence() + - mseq[s].getSequence()); - if (mseq[s].getEnd() >= mseq[s].getStart()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - ( (AlignmentOrder) subalg[1]).updateSequence(mseq[s], alignment[s]); - } - } - } - else - { - if (start < owidth) - { - // recover input data or place gaps - if (true) - { - // recover input data - for (int s = 0; s < seqs.length; s++) - { - SequenceI oseq = seqs[s].getSeq('-').getSubSequence(start, - owidth + 1); - if (width < oseq.getLength()) - { - width = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequence() + - oseq.getSequence()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - nwidth += width; - } - else - { - // place gaps. - throw new Error("Padding not yet implemented."); - } - } - } + SequenceI[][] results=new SequenceI[jobs.length][]; + AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; + + for (int j=0; j>>This is a fix for the moment, until a better solution is // found!!<<< af.getFeatureRenderer().transferSettings( alignFrame.getFeatureRenderer()); + // update orders if (alorders.size() > 0) { if (alorders.size() == 1) @@ -844,7 +644,7 @@ class MsaWSThread { String orderName = new String(" Region " + i); int j = i + 1; - int r = l; + while (j < l) { if ( ( (AlignmentOrder) alorders.get(i)).equals( ( ( @@ -880,8 +680,8 @@ class MsaWSThread } Desktop.addInternalFrame(af, alTitle, - AlignFrame.NEW_WINDOW_WIDTH, - AlignFrame.NEW_WINDOW_HEIGHT); + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); } else @@ -890,4 +690,9 @@ class MsaWSThread } } + + public boolean canMergeResults() + { + return false; + } }