final private int dnaWidth;
- final private Alignment dataset;
+ final private AlignmentI dataset;
/*
* Working variables for the translation.
*/
public class Alignment implements AlignmentI
{
- protected Alignment dataset;
+ private Alignment dataset;
protected List<SequenceI> sequences;
}
@Override
- public void setDataset(Alignment data)
+ public void setDataset(AlignmentI data)
{
if (dataset == null && data == null)
{
}
else if (dataset == null && data != null)
{
- dataset = data;
+ if (!(data instanceof Alignment))
+ {
+ throw new Error(
+ "Implementation Error: jalview.datamodel.Alignment does not yet support other implementations of AlignmentI as its dataset reference");
+ }
+ dataset = (Alignment) data;
for (int i = 0; i < getHeight(); i++)
{
SequenceI currentSeq = getSequenceAt(i);
* @return Alignment containing dataset sequences or null of this is a
* dataset.
*/
- Alignment getDataset();
+ AlignmentI getDataset();
/**
* Set the associated dataset for the alignment, or create one.
* @param dataset
* The dataset alignment or null to construct one.
*/
- void setDataset(Alignment dataset);
+ void setDataset(AlignmentI dataset);
/**
* pads sequences with gaps (to ensure the set looks like an alignment)
SequenceI[] orderedSeqs = tmpseqs
.toArray(new SequenceI[tmpseqs.size()]);
- Alignment al = new Alignment(orderedSeqs);
+ AlignmentI al = new Alignment(orderedSeqs);
// / Add the alignment properties
for (int i = 0; i < vamsasSet.getSequenceSetPropertiesCount(); i++)
}
AlignFrame loadViewport(String file, JSeq[] JSEQ,
- List<SequenceI> hiddenSeqs, Alignment al,
+ List<SequenceI> hiddenSeqs, AlignmentI al,
JalviewModelSequence jms, Viewport view, String uniqueSeqSetId,
String viewId, List<JvAnnotRow> autoAlan)
{
}
private ColourSchemeI constructAnnotationColour(
- AnnotationColours viewAnnColour, AlignFrame af, Alignment al,
+ AnnotationColours viewAnnColour, AlignFrame af, AlignmentI al,
JalviewModelSequence jms, boolean checkGroupAnnColour)
{
boolean propagateAnnColour = false;
return cs;
}
- private void reorderAutoannotation(AlignFrame af, Alignment al,
+ private void reorderAutoannotation(AlignFrame af, AlignmentI al,
List<JvAnnotRow> autoAlan)
{
// copy over visualization settings for autocalculated annotation in the
}
}
- private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al,
+ private void recoverDatasetFor(SequenceSet vamsasSet, AlignmentI al,
boolean ignoreUnrefed)
{
- jalview.datamodel.Alignment ds = getDatasetFor(vamsasSet.getDatasetId());
+ jalview.datamodel.AlignmentI ds = getDatasetFor(vamsasSet
+ .getDatasetId());
Vector dseqs = null;
if (ds == null)
{
* TODO use AlignmentI here and in related methods - needs
* AlignmentI.getDataset() changed to return AlignmentI instead of Alignment
*/
- Hashtable<String, Alignment> datasetIds = null;
+ Hashtable<String, AlignmentI> datasetIds = null;
- IdentityHashMap<Alignment, String> dataset2Ids = null;
+ IdentityHashMap<AlignmentI, String> dataset2Ids = null;
- private Alignment getDatasetFor(String datasetId)
+ private AlignmentI getDatasetFor(String datasetId)
{
if (datasetIds == null)
{
- datasetIds = new Hashtable<String, Alignment>();
+ datasetIds = new Hashtable<String, AlignmentI>();
return null;
}
if (datasetIds.containsKey(datasetId))
return null;
}
- private void addDatasetRef(String datasetId, Alignment dataset)
+ private void addDatasetRef(String datasetId, AlignmentI dataset)
{
if (datasetIds == null)
{
- datasetIds = new Hashtable<String, Alignment>();
+ datasetIds = new Hashtable<String, AlignmentI>();
}
datasetIds.put(datasetId, dataset);
}
* @param dataset
* @return
*/
- private String getDatasetIdRef(Alignment dataset)
+ private String getDatasetIdRef(AlignmentI dataset)
{
if (dataset.getDataset() != null)
{
// make a new datasetId and record it
if (dataset2Ids == null)
{
- dataset2Ids = new IdentityHashMap<Alignment, String>();
+ dataset2Ids = new IdentityHashMap<AlignmentI, String>();
}
else
{
package jalview.gui;
import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SeqCigar;
{
// AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]);
- Alignment al = new Alignment((SequenceI[]) alAndColsel[0]);
- Alignment dataset = (av != null && av.getAlignment() != null) ? av
+ AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]);
+ AlignmentI dataset = (av != null && av.getAlignment() != null) ? av
.getAlignment().getDataset() : null;
if (dataset != null)
{
{
// AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]);
- Alignment al = new Alignment((SequenceI[]) alAndColsel[0]);
- Alignment dataset = (av != null && av.getAlignment() != null) ? av
+ AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]);
+ AlignmentI dataset = (av != null && av.getAlignment() != null) ? av
.getAlignment().getDataset() : null;
if (dataset != null)
{
*/
package jalview.ws.jws1;
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
-import ext.vamsas.MuscleWS;
import ext.vamsas.MuscleWSServiceLocator;
import ext.vamsas.MuscleWSSoapBindingStub;
import ext.vamsas.ServiceHandle;
public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
- boolean preserveOrder, Alignment seqdataset,
+ boolean preserveOrder, AlignmentI seqdataset,
AlignFrame _alignFrame)
{
super();
}
private void startMsaWSClient(String altitle, AlignmentView msa,
- boolean submitGaps, boolean preserveOrder, Alignment seqdataset)
+ boolean submitGaps, boolean preserveOrder, AlignmentI seqdataset)
{
if (!locateWebService())
{
try
{
- this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));
+ this.server = loc.getMuscleWS(new java.net.URL(WsURL));
((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute
// timeout
} catch (Exception ex)
return (WebServiceName.indexOf("lustal") > -1); // cheat!
}
+ @Override
public void attachWSMenuEntry(JMenu msawsmenu,
final ServiceHandle serviceHandle, final AlignFrame alignFrame)
{
method.setToolTipText(WsURL);
method.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
methodR.setToolTipText(WsURL);
methodR.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
import jalview.analysis.AlignSeq;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
*
* @return true if getAlignment will return a valid alignment result.
*/
+ @Override
public boolean hasResults()
{
if (subjobComplete && result != null && result.isFinished()
*
* @return boolean true if job can be submitted.
*/
+ @Override
public boolean hasValidInput()
{
if (seqs.getSeqs() != null)
String alTitle; // name which will be used to form new alignment window.
- Alignment dataset; // dataset to which the new alignment will be
+ AlignmentI dataset; // dataset to which the new alignment will be
// associated.
MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,
WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
String wsname, String title, AlignmentView _msa, boolean subgaps,
- boolean presorder, Alignment seqset)
+ boolean presorder, AlignmentI seqset)
{
this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder);
OutputHeader = wsInfo.getProgressText();
}
}
+ @Override
public boolean isCancellable()
{
return true;
}
+ @Override
public void cancelJob()
{
if (!jobComplete && jobs != null)
}
}
+ @Override
public void pollJob(AWsJob job) throws Exception
{
((MsaWSJob) job).result = server.getResult(((MsaWSJob) job).getJobId());
}
+ @Override
public void StartJob(AWsJob job)
{
if (!(job instanceof MsaWSJob))
return msa;
}
+ @Override
public void parseResult()
{
int results = 0; // number of result sets received
wsInfo.showResultsNewFrame
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(true);
wsInfo.mergeResults
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(false);
while (j < l)
{
if (((AlignmentOrder) alorders.get(i))
- .equals(((AlignmentOrder) alorders.get(j))))
+ .equals((alorders.get(j))))
{
alorders.remove(j);
l--;
}
}
+ @Override
public boolean canMergeResults()
{
return false;
*/
package jalview.ws.jws1;
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
-import ext.vamsas.SeqSearchI;
import ext.vamsas.SeqSearchServiceLocator;
import ext.vamsas.SeqSearchServiceSoapBindingStub;
import ext.vamsas.ServiceHandle;
public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle,
jalview.datamodel.AlignmentView msa, String db,
- Alignment seqdataset, AlignFrame _alignFrame)
+ AlignmentI seqdataset, AlignFrame _alignFrame)
{
super();
alignFrame = _alignFrame;
}
private void startSeqSearchClient(String altitle, AlignmentView msa,
- String db, Alignment seqdataset)
+ String db, AlignmentI seqdataset)
{
if (!locateWebService())
{
try
{
- this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(
+ this.server = loc.getSeqSearchService(new java.net.URL(
WsURL));
((SeqSearchServiceSoapBindingStub) this.server).setTimeout(60000); // One
// minute
return dbs;
}
+ @Override
public void attachWSMenuEntry(JMenu wsmenu, final ServiceHandle sh,
final AlignFrame af)
{
method.setToolTipText(sh.getEndpointURL());
method.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
// use same input gatherer as for secondary structure prediction
final String searchdb = dbs[db];
method.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction();
import jalview.analysis.AlignSeq;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
*
* @return null or { Alignment(+features and annotation), NewickFile)}
*/
- public Object[] getAlignment(Alignment dataset,
+ public Object[] getAlignment(AlignmentI dataset,
Map<String, Object> featureColours)
{
String alTitle; // name which will be used to form new alignment window.
- Alignment dataset; // dataset to which the new alignment will be
+ AlignmentI dataset; // dataset to which the new alignment will be
// associated.
SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl,
WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
String wsname, String title, AlignmentView _msa, String db,
- Alignment seqset)
+ AlignmentI seqset)
{
this(server, wsUrl, wsinfo, alFrame, _msa, wsname, db);
OutputHeader = wsInfo.getProgressText();
*/
package jalview.ws.jws2;
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
public MsaWSClient(Jws2Instance sh, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
- boolean preserveOrder, Alignment seqdataset,
+ boolean preserveOrder, AlignmentI seqdataset,
AlignFrame _alignFrame)
{
this(sh, null, null, false, altitle, msa, submitGaps, preserveOrder,
public MsaWSClient(Jws2Instance sh, WsParamSetI preset, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
- boolean preserveOrder, Alignment seqdataset,
+ boolean preserveOrder, AlignmentI seqdataset,
AlignFrame _alignFrame)
{
this(sh, preset, null, false, altitle, msa, submitGaps, preserveOrder,
public MsaWSClient(Jws2Instance sh, WsParamSetI preset,
List<Argument> arguments, boolean editParams, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
- boolean preserveOrder, Alignment seqdataset,
+ boolean preserveOrder, AlignmentI seqdataset,
AlignFrame _alignFrame)
{
super(_alignFrame, preset, arguments);
}
private void startMsaWSClient(String altitle, AlignmentView msa,
- boolean submitGaps, boolean preserveOrder, Alignment seqdataset)
+ boolean submitGaps, boolean preserveOrder, AlignmentI seqdataset)
{
// if (!locateWebService())
// {
*
* @return true if getAlignment will return a valid alignment result.
*/
+ @Override
public boolean hasResults()
{
if (subjobComplete
*
* @return boolean true if job can be submitted.
*/
+ @Override
public boolean hasValidInput()
{
// TODO: get attributes for this MsaWS instance to check if it can do two
String alTitle; // name which will be used to form new alignment window.
- Alignment dataset; // dataset to which the new alignment will be
+ AlignmentI dataset; // dataset to which the new alignment will be
// associated.
String wsUrl, WebserviceInfo wsinfo,
jalview.gui.AlignFrame alFrame, String wsname, String title,
AlignmentView _msa, boolean subgaps, boolean presorder,
- Alignment seqset)
+ AlignmentI seqset)
{
this(server2, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder);
OutputHeader = wsInfo.getProgressText();
return validInput;
}
+ @Override
public boolean isCancellable()
{
return true;
}
+ @Override
public void cancelJob()
{
if (!jobComplete && jobs != null)
}
}
+ @Override
public void pollJob(AWsJob job) throws Exception
{
// TODO: investigate if we still need to cast here in J1.6
return changed;
}
+ @Override
public void StartJob(AWsJob job)
{
Exception lex = null;
}
}
+ @Override
public void parseResult()
{
long progbar = System.currentTimeMillis();
wsInfo.showResultsNewFrame
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(true);
wsInfo.mergeResults
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
displayResults(false);
}
}
+ @Override
public boolean canMergeResults()
{
return false;
// TODO promote this method to AlignmentI
((Alignment) protein).createDatasetAlignment();
- // TODO this method should return AlignmentI not Alignment !!
- Alignment ds = protein.getDataset();
+ AlignmentI ds = protein.getDataset();
// side-effect: dataset created on second sequence
assertNotNull(protein.getSequenceAt(1).getDatasetSequence());