import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.JalviewColourScheme;
+import jalview.schemes.RNAHelicesColour;
import jalview.schemes.TCoffeeColourScheme;
import jalview.structure.StructureImportSettings;
import jalview.viewmodel.AlignmentViewport;
public class Jalview2xmlTests extends Jalview2xmlBase
{
+ @Override
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
String inFile = "examples/RF00031_folded.stk";
String tfile = File.createTempFile("JalviewTest", ".jvp")
.getAbsolutePath();
- AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
- FormatAdapter.FILE);
- assertNotNull("Didn't read input file " + inFile, af);
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ inFile, DataSourceType.FILE);
+ assertTrue("Didn't read input file " + inFile, af != null);
int olddsann = countDsAnn(af.getViewport());
assertTrue("Didn't find any dataset annotations", olddsann > 0);
- af.rnahelicesColour_actionPerformed(null);
- assertTrue(
- "Couldn't apply RNA helices colourscheme",
- af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
+ af.changeColour_actionPerformed(JalviewColourScheme.RNAHelices
+ .toString());
+ assertTrue("Couldn't apply RNA helices colourscheme", af.getViewport()
+ .getGlobalColourScheme() instanceof RNAHelicesColour);
assertTrue("Failed to store as a project.",
- af.saveAlignment(tfile, "Jalview"));
+ af.saveAlignment(tfile, FileFormat.Jalview));
af.closeMenuItem_actionPerformed(true);
af = null;
- af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
- assertNotNull("Failed to import new project", af);
+ af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE);
+ assertTrue("Failed to import new project", af != null);
int newdsann = countDsAnn(af.getViewport());
assertTrue(
"Differing numbers of dataset sequence annotation\nOriginally "
+ olddsann + ")");
assertTrue(
"RNA helices colourscheme was not applied on import.",
- af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
+ af.getViewport().getGlobalColourScheme() instanceof RNAHelicesColour);
}
@Test(groups = { "Functional" })
String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii";
String tfile = File.createTempFile("JalviewTest", ".jvp")
.getAbsolutePath();
- AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
- FormatAdapter.FILE);
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ inFile, DataSourceType.FILE);
assertNotNull("Didn't read input file " + inFile, af);
- af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
+ af.loadJalviewDataFile(inAnnot, DataSourceType.FILE, null, null);
assertSame("Didn't set T-coffee colourscheme", af.getViewport()
.getGlobalColourScheme().getClass(), TCoffeeColourScheme.class);
assertNotNull("Recognise T-Coffee score from string",
- jalview.schemes.ColourSchemeProperty.getColour(af.getViewport()
- .getAlignment(), ColourSchemeProperty.getColourName(af
- .getViewport().getGlobalColourScheme())));
+ ColourSchemeProperty.getColourScheme(af.getViewport()
+ .getAlignment(), af.getViewport()
+ .getGlobalColourScheme().getSchemeName()));
assertTrue("Failed to store as a project.",
- af.saveAlignment(tfile, "Jalview"));
+ af.saveAlignment(tfile, FileFormat.Jalview));
af.closeMenuItem_actionPerformed(true);
af = null;
- af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
+ af = new FileLoader().LoadFileWaitTillLoaded(tfile,
+ DataSourceType.FILE);
assertNotNull("Failed to import new project", af);
assertSame("Didn't set T-coffee colourscheme for imported project.", af
.getViewport().getGlobalColourScheme().getClass(),
String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva";
String tfile = File.createTempFile("JalviewTest", ".jvp")
.getAbsolutePath();
- AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
- FormatAdapter.FILE);
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile, DataSourceType.FILE);
assertNotNull("Didn't read input file " + inFile, af);
- af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
+ af.loadJalviewDataFile(inAnnot, DataSourceType.FILE, null, null);
AlignmentAnnotation[] aa = af.getViewport().getAlignment()
.getSequenceAt(0).getAnnotation("IUPredWS (Short)");
assertTrue(
SequenceGroup sg = new SequenceGroup();
sg.setStartRes(57);
sg.setEndRes(92);
- sg.cs = gcs;
+ sg.cs.setColourScheme(gcs);
af.getViewport().getAlignment().addGroup(sg);
sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1), false);
sg.addSequence(af.getViewport().getAlignment().getSequenceAt(2), true);
af.alignPanel.alignmentChanged();
assertTrue("Failed to store as a project.",
- af.saveAlignment(tfile, "Jalview"));
+ af.saveAlignment(tfile, FileFormat.Jalview));
af.closeMenuItem_actionPerformed(true);
af = null;
- af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
- assertNotNull("Failed to import new project", af);
+ af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE);
+ assertTrue("Failed to import new project", af != null);
// check for group and alignment colourschemes
ColourSchemeI _rcs = af.getViewport().getGlobalColourScheme();
ColourSchemeI _rgcs = af.getViewport().getAlignment().getGroups()
- .get(0).cs;
+ .get(0).getColourScheme();
assertNotNull("Didn't recover global colourscheme", _rcs);
assertTrue("Didn't recover annotation colour global scheme",
_rcs instanceof AnnotationColourGradient);
for (int p = 0, pSize = af.getViewport().getAlignment().getWidth(); p < pSize
&& (!diffseqcols || !diffgseqcols); p++)
{
- if (_rcs.findColour(sqs[0].getCharAt(p), p, sqs[0]) != _rcs
- .findColour(sqs[5].getCharAt(p), p, sqs[5]))
+ if (_rcs.findColour(sqs[0].getCharAt(p), p, sqs[0], null, 0f) != _rcs
+ .findColour(sqs[5].getCharAt(p), p, sqs[5], null, 0f))
{
diffseqcols = true;
}
for (int p = 0, pSize = af.getViewport().getAlignment().getWidth(); p < pSize
&& (!diffseqcols || !diffgseqcols); p++)
{
- if (_rgcs.findColour(sqs[1].getCharAt(p), p, sqs[1]) != _rgcs
- .findColour(sqs[2].getCharAt(p), p, sqs[2]))
+ if (_rgcs.findColour(sqs[1].getCharAt(p), p, sqs[1], null, 0f) != _rgcs
+ .findColour(sqs[2].getCharAt(p), p, sqs[2], null, 0f))
{
diffgseqcols = true;
}
int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop
.getAlignFrames().length;
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ "examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
assertTrue("Didn't gather the views in the example file.",
Desktop.getAlignFrames().length == 1 + origCount);
StructureImportSettings.setProcessSecondaryStructure(true);
StructureImportSettings.setVisibleChainAnnotation(true);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ "examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
AlignmentViewPanel sps = null;
for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
public void testCopyViewSettings() throws Exception
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ "examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
AlignmentViewPanel sps = null, groups = null;
for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
Desktop.instance.closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ "examples/exampleFile_2_7.jar", DataSourceType.FILE);
Assert.assertEquals(Desktop.getAlignFrames().length, 1);
String afid = af.getViewport().getSequenceSetId();
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
}
- af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
- FormatAdapter.FILE);
+ af = new FileLoader().LoadFileWaitTillLoaded(
+ tfile.getAbsolutePath(), DataSourceType.FILE);
Assert.assertNotNull(af);
Assert.assertEquals(
Desktop.getAlignFrames().length,
Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
Assert.assertEquals(
- oldviews,
- Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
+ Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length,
+ oldviews);
}
/**
{
Desktop.instance.closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ "examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
String afid = af.getViewport().getSequenceSetId();
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
}
- af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
- FormatAdapter.FILE);
+ af = new FileLoader().LoadFileWaitTillLoaded(
+ tfile.getAbsolutePath(), DataSourceType.FILE);
afid = af.getViewport().getSequenceSetId();
for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
{
Desktop.instance.closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/uniref50.fa", FormatAdapter.FILE);
+ "examples/uniref50.fa", DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
String afid = af.getViewport().getSequenceSetId();
// make a second view of the alignment
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
}
-
- af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
- FormatAdapter.FILE);
+
+ af = new FileLoader().LoadFileWaitTillLoaded(
+ tfile.getAbsolutePath(), DataSourceType.FILE);
afid = af.getViewport().getSequenceSetId();
for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
Desktop.instance.closeAll_actionPerformed(null);
String exampleFile = "examples/3W5V.pdb";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(exampleFile,
- FormatAdapter.FILE);
+ DataSourceType.FILE);
assertNotNull("Didn't read in the example file correctly.", af);
String afid = af.getViewport().getSequenceSetId();
}
AlignFrame restoredFrame = new FileLoader().LoadFileWaitTillLoaded(
- tfile.getAbsolutePath(), FormatAdapter.FILE);
+ tfile.getAbsolutePath(), DataSourceType.FILE);
String rfid = restoredFrame.getViewport().getSequenceSetId();
AlignmentPanel[] rAlignPanels = Desktop.getAlignmentPanels(rfid);
AlignmentViewPanel rap = rAlignPanels[0];