From 6e6e20937740248155f8eea8cf17d73cadd33311 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 10 May 2016 09:01:03 +0100 Subject: [PATCH] JAL-2103 proof of concept - patch to retrieve full width MSA. --- src/jalview/ws/jws1/JPredThread.java | 61 ++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java index 7d60860..7176163 100644 --- a/src/jalview/ws/jws1/JPredThread.java +++ b/src/jalview/ws/jws1/JPredThread.java @@ -179,10 +179,38 @@ class JPredThread extends JWS1Thread implements WSClientI } else { - al = new Alignment(preds); - FirstSeq = prediction.getQuerySeqPosition(); + AlignmentI fullAlignment = null; + try + { + // locate full alignment + // http://www.compbio.dundee.ac.uk/jpred/results/jp_GuygEzV/jp_GuygEzV.full_MSA.fasta + String jobid = getJobId().substring( + getJobId().lastIndexOf("/") + 1); + String job_alignment = "http://www.compbio.dundee.ac.uk/jpred/results/" + + jobid + "/" + jobid + ".full_MSA.fasta"; + fullAlignment = new FormatAdapter().readFile(job_alignment, + FormatAdapter.URL, "FASTA"); + } catch (Exception q) + { + + } finally + { + if (fullAlignment != null) + { + al = fullAlignment; + FirstSeq = 0; + } + else + { + al = new Alignment(preds); + FirstSeq = prediction.getQuerySeqPosition(); + } + } + if (predMap != null) { + // map the prediction onto the query sequence, excluding positions + // corresponding to hidden regions in the original input. char gc = getGapChar(); SequenceI[] sqs = (SequenceI[]) input .getAlignmentAndColumnSelection(gc)[0]; @@ -192,16 +220,18 @@ class JPredThread extends JWS1Thread implements WSClientI MessageManager .getString("error.implementation_error_invalid_msa_index_for_job")); } - - // /// - // Uses RemoveGapsCommand - // /// - new jalview.commands.RemoveGapsCommand( - MessageManager.getString("label.remove_gaps"), - new SequenceI[] { sqs[msaIndex] }, currentView); - - SequenceI profileseq = al.getSequenceAt(FirstSeq); - profileseq.setSequence(sqs[msaIndex].getSequenceAsString()); + if (fullAlignment == null) + { + // /// + // Uses RemoveGapsCommand + // /// + // new jalview.commands.RemoveGapsCommand( + // MessageManager.getString("label.remove_gaps"), + // new SequenceI[] { sqs[msaIndex] }, currentView); + + SequenceI profileseq = al.getSequenceAt(FirstSeq); + profileseq.setSequence(sqs[msaIndex].getSequenceAsString()); + } } if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash( @@ -225,8 +255,11 @@ class JPredThread extends JWS1Thread implements WSClientI jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, true, predMap); SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps. - alignToProfileSeq(al, profileseq); - if (predMap != null) + if (fullAlignment == null) + { + alignToProfileSeq(al, profileseq); + } + if (fullAlignment == null && predMap != null) { // Adjust input view for gaps // propagate insertions into profile -- 1.7.10.2