*/
package jalview.io;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-
import jalview.api.ComplexAlignFile;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
public class FileLoader implements Runnable
{
String file;
if ((al != null) && (al.getHeight() > 0))
{
+ // construct and register dataset sequences
for (SequenceI sq : al.getSequences())
{
while (sq.getDatasetSequence() != null)
{
for (PDBEntry pdbe : sq.getPDBId())
{
+ // register PDB entries with desktop's structure selection
+ // manager
StructureSelectionManager.getStructureSelectionManager(
Desktop.instance).registerPDBEntry(pdbe);
}
}
}
+
if (viewport != null)
{
+ // append to existing alignment
viewport.addAlignment(al, title);
}
else
{
- if (!protocol.equals(AppletFormatAdapter.PASTE))
- {
- alignFrame.setFileName(file, format);
- }
+ // otherwise construct the alignFrame
+
if (source instanceof ComplexAlignFile)
{
ColumnSelection colSel = ((ComplexAlignFile) source)
ColourSchemeI cs = ((ComplexAlignFile) source)
.getColourScheme();
alignFrame = new AlignFrame(al, hiddenSeqs, colSel,
- AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
alignFrame.getViewport().setShowSequenceFeatures(
showSeqFeatures);
alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
}
+ }
+ // add metadata and update ui
+ if (!protocol.equals(AppletFormatAdapter.PASTE))
+ {
+ alignFrame.setFileName(file, format);
+ }
- alignFrame.statusBar.setText(MessageManager.formatMessage(
- "label.successfully_loaded_file", new String[]
- { title }));
+ alignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_loaded_file", new String[]
+ { title }));
- if (raiseGUI)
- {
- // add the window to the GUI
- // note - this actually should happen regardless of raiseGUI
- // status in Jalview 3
- // TODO: define 'virtual desktop' for benefit of headless scripts
- // that perform queries to find the 'current working alignment'
- Desktop.addInternalFrame(alignFrame, title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
- }
+ if (raiseGUI)
+ {
+ // add the window to the GUI
+ // note - this actually should happen regardless of raiseGUI
+ // status in Jalview 3
+ // TODO: define 'virtual desktop' for benefit of headless scripts
+ // that perform queries to find the 'current working alignment'
+ Desktop.addInternalFrame(alignFrame, title,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ }
- try
- {
- alignFrame.setMaximum(jalview.bin.Cache.getDefault(
- "SHOW_FULLSCREEN", false));
- } catch (java.beans.PropertyVetoException ex)
- {
- }
+ try
+ {
+ alignFrame.setMaximum(jalview.bin.Cache.getDefault(
+ "SHOW_FULLSCREEN", false));
+ } catch (java.beans.PropertyVetoException ex)
+ {
}
}
else
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.gui.Jalview2XML;
+import jalview.io.AnnotationFile;
+import jalview.io.FormatAdapter;
+import jalview.io.StockholmFileTest;
+import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.jws2.RNAalifoldClient;
+import jalview.ws.jws2.SequenceAnnotationWSClient;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.AutoCalcSetting;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.JMenuItem;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import compbio.metadata.WrongParameterException;
-import jalview.datamodel.AlignmentI;
-import jalview.gui.Jalview2XML;
-import jalview.io.AnnotationFile;
-import jalview.io.FormatAdapter;
-import jalview.io.StockholmFileTest;
-import jalview.ws.jws2.Jws2Discoverer;
-import jalview.ws.jws2.RNAalifoldClient;
-import jalview.ws.jws2.SequenceAnnotationWSClient;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
-import jalview.ws.params.AutoCalcSetting;
-
public class RNAStructExportImport
{
- public static String testseqs = "examples/unfolded_RF00031.aln";
+ public static String testseqs = "examples/RF00031_folded.stk";
public static Jws2Discoverer disc;
assertNotNull("Couldn't load test data ('" + testseqs + "')", af);
+ // remove any existing annotation
+ List<AlignmentAnnotation> aal = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation rna : af.getViewport().getAlignment()
+ .getAlignmentAnnotation())
+ {
+ if (rna.isRNA())
+ {
+ aal.add(rna);
+ }
+ }
+ for (AlignmentAnnotation rna : aal)
+ {
+ af.getViewport().getAlignment().deleteAnnotation(rna);
+ }
+ af.getViewport().alignmentChanged(af.alignPanel); // why is af.alignPanel
+ // public?
}
@AfterClass
}
@Test
+ public void testRNAAliFoldValidStructure()
+ {
+
+ alifoldClient = new RNAalifoldClient(rnaalifoldws, af, null, null);
+
+ af.getViewport().getCalcManager().startWorker(alifoldClient);
+
+ do
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ } while (af.getViewport().getCalcManager().isWorking());
+
+ AlignmentI orig_alig = af.getViewport().getAlignment();
+ for (AlignmentAnnotation aa:orig_alig.getAlignmentAnnotation())
+ {
+ if (alifoldClient.involves(aa))
+ {
+ if (aa.isRNA())
+ {
+ Assert.assertTrue("Did not create valid structure from RNAALiFold prediction", aa.isValidStruc());
+ }
+ }
+ }
+ }
+
+ @Test
public void testRNAStructExport()
{