--- /dev/null
+package jalview.ws2.actions.secstructpred;
+
+import java.util.List;
+import java.util.Map;
+
+import jalview.analysis.SeqsetUtils.SequenceInfo;
+import jalview.datamodel.SequenceI;
+import jalview.ws2.actions.BaseJob;
+
+public class SecStructPredJob extends BaseJob
+{
+ private final int[] delMap;
+
+ private final SequenceI refSeq;
+
+ final Map<String, SequenceInfo> seqNames;
+
+ SecStructPredJob(List<SequenceI> sequences, SequenceI refSeq, int[] delMap,
+ Map<String, SequenceInfo> seqNames)
+ {
+ super(sequences);
+ this.refSeq = refSeq;
+ this.delMap = delMap;
+ this.seqNames = seqNames;
+ }
+
+ @Override
+ public boolean isInputValid()
+ {
+ return true;
+ }
+}
package jalview.ws2.actions.secstructpred;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import jalview.analysis.AlignmentAnnotationUtils;
+import jalview.analysis.SeqsetUtils;
import jalview.api.AlignViewportI;
import jalview.bin.Console;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SeqCigar;
+import jalview.datamodel.SequenceI;
import jalview.io.AlignFile;
import jalview.io.JPredFile;
import jalview.io.JnetAnnotationMaker;
@Override
protected List<BaseJob> prepareJobs() throws ServiceInputInvalidException
{
- AlignmentI alignment = alignmentView
- .getVisibleAlignment(Comparison.GAP_DASH);
- var job = new BaseJob(alignment.getSequences())
- {
- @Override
- public boolean isInputValid()
- {
- return true;
- }
- };
+ SeqCigar[] msf = alignmentView.getSequences();
+ SequenceI referenceSeq = msf[0].getSeq('-');
+ int[] delMap = alignmentView.getVisibleContigMapFor(referenceSeq.gapMap());
+
+ // TODO: assume MSA for now
+ SequenceI[] sequences = new SequenceI[msf.length];
+ for (int i = 0; i < msf.length; i++)
+ sequences[i] = msf[i].getSeq('-');
+ var sequenceInfo = SeqsetUtils.uniquify(sequences, true);
+ referenceSeq.setSequence(alignmentView.getASequenceString('-', 0));
+ for (int i = 0; i < sequences.length; i++)
+ sequences[i].setSequence(alignmentView.getASequenceString('-', i));
+ var sequencesList = filterEmptySequences(sequences);
+ var job = new SecStructPredJob(sequencesList, referenceSeq, delMap,
+ sequenceInfo);
job.setStatus(JobStatus.READY);
return List.of(job);
}
+ private static List<SequenceI> filterEmptySequences(SequenceI[] seqs)
+ {
+ var filtered = new ArrayList<SequenceI>();
+ for (var seq : seqs)
+ if (seq.getEnd() - seq.getStart() > 0)
+ filtered.add(seq);
+ return filtered;
+ }
+
@Override
protected AlignmentI collectResult(List<BaseJob> jobs) throws IOException
{