*/
public class ViewDef
{
- public String viewname;
+ // TODO this class is not used - remove?
+ public final String viewname;
- public HiddenSequences hidseqs;
+ public final HiddenSequences hidseqs;
- public ColumnSelection hiddencols;
+ public final ColumnSelection hiddencols;
- public Vector visibleGroups;
+ // public final Vector visibleGroups;
- public Hashtable hiddenRepSeqs;
+ public final Hashtable hiddenRepSeqs;
- public ViewDef(String viewname, HiddenSequences hidseqs,
- ColumnSelection hiddencols, Hashtable hiddenRepSeqs)
+ public ViewDef(String vname, HiddenSequences hseqs,
+ ColumnSelection hcols, Hashtable hRepSeqs)
{
- this.viewname = viewname;
- this.hidseqs = hidseqs;
- this.hiddencols = hiddencols;
- this.hiddenRepSeqs = hiddenRepSeqs;
+ this.viewname = vname;
+ this.hidseqs = hseqs;
+ this.hiddencols = hcols;
+ this.hiddenRepSeqs = hRepSeqs;
}
}
}
if (list == null)
{
- list = view.visibleGroups;
+ // list = view.visibleGroups;
}
if (cs == null)
{
return false;
}
- public void printGroups(List<SequenceGroup> list)
+ protected void printGroups(List<SequenceGroup> list)
{
SequenceI seqrep = null;
for (SequenceGroup sg : list)
if (sg.cs != null)
{
text.append("colour=");
- text.append(sg.cs.toString());
+ text.append(ColourSchemeProperty.getColourName(sg.cs
+ .getColourScheme()));
text.append("\t");
if (sg.cs.getThreshold() != 0)
{
import jalview.json.binding.biojson.v1.SequenceGrpPojo;
import jalview.json.binding.biojson.v1.SequencePojo;
import jalview.renderer.seqfeatures.FeatureColourFinder;
+import jalview.schemes.ColourSchemeProperty;
import jalview.schemes.JalviewColourScheme;
import jalview.schemes.ResidueColourScheme;
import jalview.util.ColorUtils;
{
SequenceGrpPojo seqGrpPojo = new SequenceGrpPojo();
seqGrpPojo.setGroupName(seqGrp.getName());
- seqGrpPojo.setColourScheme(seqGrp.getColourScheme()
- .getSchemeName());
+ seqGrpPojo.setColourScheme(ColourSchemeProperty
+ .getColourName(seqGrp.getColourScheme()));
seqGrpPojo.setColourText(seqGrp.getColourText());
seqGrpPojo.setDescription(seqGrp.getDescription());
seqGrpPojo.setDisplayBoxes(seqGrp.getDisplayBoxes());
}
}
}
- globalColourScheme = (viewport.getGlobalColourScheme() == null) ? ResidueColourScheme.NONE
- : viewport.getGlobalColourScheme().getSchemeName();
+ globalColourScheme = ColourSchemeProperty.getColourName(viewport
+ .getGlobalColourScheme());
setDisplayedFeatures(viewport.getFeaturesDisplayed());
showSeqFeatures = viewport.isShowSequenceFeatures();
expectedSeqs.put(seq.getName(), seq);
}
- // create and add sequence groups
- ArrayList<SequenceI> grpSeqs = new ArrayList<SequenceI>();
+ // create and add a sequence group
+ List<SequenceI> grpSeqs = new ArrayList<SequenceI>();
grpSeqs.add(seqs[1]);
grpSeqs.add(seqs[2]);
grpSeqs.add(seqs[3]);
grpSeqs.add(seqs[4]);
- SequenceGroup seqGrp = new SequenceGroup(grpSeqs, "JGroup:1883305585",
+ SequenceGroup seqGrp = new SequenceGroup(grpSeqs,
+ "JGroup:1883305585",
null, true, true, false, 21, 29);
ColourSchemeI scheme = ColourSchemeMapper.getJalviewColourScheme(
"zappo", seqGrp);
"Zappo colour scheme expected!");
}
- @Test(groups = { "Functional" })
/**
- * Test for bug JAL-2489, NPE when exporting BioJSON with global colour scheme set as 'None'
+ * Test for bug JAL-2489, NPE when exporting BioJSON with global colour
+ * scheme, and a group colour scheme, set as 'None'
*/
- public void testBioJSONRoundTripWithGlobalColourSchemeSetAsNone()
+ @Test(groups = { "Functional" })
+ public void testBioJSONRoundTripWithColourSchemeNone()
{
AppletFormatAdapter formatAdapter = new AppletFormatAdapter();
bioJsonFile.getHiddenSequences(),
bioJsonFile.getColumnSelection(), AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
- // Change colour scheme to 'None' and perform round trip
+
+ /*
+ * Create a group on the alignment;
+ * Change global and group colour scheme to 'None' and perform round trip
+ */
+ SequenceGroup sg = new SequenceGroup();
+ sg.addSequence(_alignment.getSequenceAt(0), false);
+ sg.setColourScheme(null);
ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
ResidueColourScheme.NONE, _alignment);
alignFrame.changeColour(cs);
// System.out.println(">>>>>>>>>>>>>> features matched : " + matched);
return matched;
}
+
+ /**
+ * Test group roundtrip with null (None) group colour scheme
+ *
+ * @throws IOException
+ */
+ @Test(groups = { "Functional" })
+ public void testGrpParsed_colourNone() throws IOException
+ {
+ AlignmentI copy = new Alignment(testAlignment);
+ SequenceGroup sg = testAlignment.getGroups().get(0);
+ SequenceGroup copySg = new SequenceGroup(new ArrayList<SequenceI>(),
+ sg.getName(),
+ null, sg.getDisplayBoxes(), sg.getDisplayText(),
+ sg.getColourText(), sg.getStartRes(), sg.getEndRes());
+ for (SequenceI seq : sg.getSequences())
+ {
+ int seqIndex = testAlignment.findIndex(seq);
+ copySg.addSequence(copy.getSequenceAt(seqIndex), false);
+ }
+ copy.addGroup(copySg);
+
+ AlignFrame af = new AlignFrame(copy, copy.getWidth(), copy.getHeight());
+ AppletFormatAdapter formatAdapter = new AppletFormatAdapter(
+ af.alignPanel);
+ String jsonOutput = formatAdapter.formatSequences(FileFormat.Json,
+ copy, false);
+ formatAdapter = new AppletFormatAdapter();
+ AlignmentI newAlignment = formatAdapter.readFile(jsonOutput,
+ DataSourceType.PASTE, FileFormat.Json);
+
+ Assert.assertNotNull(newAlignment.getGroups());
+ for (SequenceGroup seqGrp : newAlignment.getGroups())
+ {
+ SequenceGroup expectedGrp = expectedGrps.get(seqGrp.getName());
+ AssertJUnit.assertTrue(
+ "Failed SequenceGroup Test for >>> " + seqGrp.getName(),
+ isGroupMatched(expectedGrp, seqGrp));
+ passedCount++;
+ }
+ AssertJUnit.assertEquals("Some SequenceGroups did not pass the test",
+ TEST_GRP_HEIGHT, passedCount);
+ }
}