import java.util.List;
import java.util.Map;
-import com.sun.xml.internal.ws.developer.ServerSideException;
import compbio.data.msa.SequenceAnnotation;
import compbio.data.sequence.FastaSequence;
import compbio.data.sequence.ScoreManager;
} catch (Exception x)
{
- if (x.getCause() instanceof ServerSideException)
+ if (x.getMessage().contains(
+ "Position in a file could not be negative!"))
{
- if (x.getMessage().contains("Position in a file could not be negative!"))
- {
- // squash index out of bounds exception- seems to happen for
- // disorder predictors which don't (apparently) produce any
- // progress information and JABA server throws an exception
- // because progress length is -1.
- stats = null;
- }
- else
- {
- throw x;
- }
+ // squash index out of bounds exception- seems to happen for
+ // disorder predictors which don't (apparently) produce any
+ // progress information and JABA server throws an exception
+ // because progress length is -1.
+ stats = null;
}
else
{
boolean nucleotidesAllowed = false;
boolean proteinAllowed = false;
-
+
/**
* record sequences for mapping result back to afterwards
*/
- protected boolean bySequence=false;
+ protected boolean bySequence = false;
+
+ Map<String, SequenceI> seqNames;
- Map<String,SequenceI> seqNames;
public List<FastaSequence> getInputSequences(AlignmentI alignment)
{
if (alignment == null || alignment.getWidth() <= 0
|| alignment.getSequences() == null
- || (alignedSeqs && !alignment.isAligned())
+// || (alignedSeqs && !alignment.isAligned() && !submitGaps)
|| alignment.isNucleotide() ? !nucleotidesAllowed
: !proteinAllowed)
{
List<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
int minlen = 10;
+ int ln=-1;
if (bySequence)
{
- seqNames=new HashMap<String,SequenceI>();
+ seqNames = new HashMap<String, SequenceI>();
}
for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
{
{
String newname = SeqsetUtils.unique_name(seqs.size() + 1);
// make new input sequence with or without gaps
- if (seqNames!=null) {
- seqNames.put(newname,sq);
+ if (seqNames != null)
+ {
+ 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<seqs.size();p++)
+ {
+ FastaSequence sq=seqs.get(p);
+ int l=sq.getSequence().length();
+ if (l<ln)
+ {
+ char[] padded=new char[ln];
+ System.arraycopy(sq.getSequence().toCharArray(),0,padded,0,sq.getSequence().length());
+ while (l<ln)
+ {
+ padded[l++]='-';
+ }
+ seqs.set(p, new compbio.data.sequence.FastaSequence(sq.getId(), new String(padded)));
+ }
}
+
}
return seqs;
}