From 254be13beb547a2d5b59b096a5b3cf1653ce4ac9 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 14 Nov 2011 14:14:25 +0000 Subject: [PATCH] JAL-975 - ensure sequences are padded with gaps before submission --- src/jalview/ws/jws2/JabawsAlignCalcWorker.java | 31 ++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java index f47767c..a11cc35 100644 --- a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java @@ -304,7 +304,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker if (alignment == null || alignment.getWidth() <= 0 || alignment.getSequences() == null - || (alignedSeqs && !alignment.isAligned()) +// || (alignedSeqs && !alignment.isAligned() && !submitGaps) || alignment.isNucleotide() ? !nucleotidesAllowed : !proteinAllowed) { @@ -313,6 +313,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker List seqs = new ArrayList(); int minlen = 10; + int ln=-1; if (bySequence) { seqNames = new HashMap(); @@ -328,11 +329,37 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker { seqNames.put(newname, sq); } - seqs.add(new compbio.data.sequence.FastaSequence(newname, + FastaSequence seq; + seqs.add(seq=new compbio.data.sequence.FastaSequence(newname, (submitGaps) ? sq.getSequenceAsString() : AlignSeq .extractGaps(jalview.util.Comparison.GapChars, sq.getSequenceAsString()))); + if (seq.getSequence().length()>ln) + { + ln = seq.getSequence().length(); + } + } + } + if (alignedSeqs && submitGaps) + { + // try real hard to return something submittable + // TODO: some of AAcons measures need a minimum of two or three amino acids at each position, and aacons doesn't gracefully degrade. + for (int p=0; p