import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceI;
-import jalview.schemes.ColourSchemeI;
/**
* This interface should be implemented by complex file parser with the ability
*
* @return
*/
- public ColourSchemeI getColourScheme();
+ public String getGlobalColourScheme();
/**
* Retrieves the Column selection/hidden column from a complex file parser
import jalview.io.IdentifyFile;
import jalview.io.NewickFile;
import jalview.io.TCoffeeScoreFile;
+import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TCoffeeColourScheme;
import jalview.util.MessageManager;
.getHiddenSequences();
boolean showSeqFeatures = ((ComplexAlignFile) source)
.isShowSeqFeatures();
- ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+ String colourSchemeName = ((ComplexAlignFile) source)
+ .getGlobalColourScheme();
af = new AlignFrame(al, hiddenSeqs, colSel,
alignFrame.viewport.applet, "Cut & Paste input - "
+ format, false);
af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures);
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, al);
af.changeColour(cs);
}
else
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
import jalview.jbgui.GCutAndPasteTransfer;
+import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.schemes.ColourSchemeI;
import jalview.util.MessageManager;
.getHiddenSequences();
boolean showSeqFeatures = ((ComplexAlignFile) source)
.isShowSeqFeatures();
- ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+ String colourSchemeName = ((ComplexAlignFile) source)
+ .getGlobalColourScheme();
FeaturesDisplayedI fd = ((ComplexAlignFile) source)
.getDisplayedFeatures();
af = new AlignFrame(al, hiddenSeqs, colSel,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
af.getViewport().setShowSequenceFeatures(showSeqFeatures);
af.getViewport().setFeaturesDisplayed(fd);
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, al);
af.changeColour(cs);
}
else
import jalview.gui.AlignViewport;
import jalview.gui.Desktop;
import jalview.gui.Jalview2XML;
+import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.schemes.ColourSchemeI;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
.getHiddenSequences();
boolean showSeqFeatures = ((ComplexAlignFile) source)
.isShowSeqFeatures();
- ColourSchemeI cs = ((ComplexAlignFile) source)
- .getColourScheme();
+ String colourSchemeName = ((ComplexAlignFile) source)
+ .getGlobalColourScheme();
FeaturesDisplayedI fd = ((ComplexAlignFile) source)
.getDisplayedFeatures();
alignFrame = new AlignFrame(al, hiddenSeqs, colSel,
alignFrame.getViewport().setShowSequenceFeatures(
showSeqFeatures);
alignFrame.getViewport().setFeaturesDisplayed(fd);
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, al);
alignFrame.changeColour(cs);
}
else
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceI;
-import jalview.schemes.ColourSchemeI;
import java.io.IOException;
import java.io.StringReader;
public static final String FILE_DESC = "HTML";
- private ColourSchemeI colourScheme;
+ private String globalColourScheme;
private boolean showSeqFeatures;
this.seqGroups = jsonFile.getSeqGroups();
this.annotations = jsonFile.getAnnotations();
this.showSeqFeatures = jsonFile.isShowSeqFeatures();
- this.colourScheme = jsonFile.getColourScheme();
+ this.globalColourScheme = jsonFile.getGlobalColourScheme();
this.hiddenSequences = jsonFile.getHiddenSequences();
this.columnSelection = jsonFile.getColumnSelection();
this.displayedFeatures = jsonFile.getDisplayedFeatures();
this.showSeqFeatures = showSeqFeatures;
}
- public ColourSchemeI getColourScheme()
+ public String getGlobalColourScheme()
{
- return colourScheme;
+ return globalColourScheme;
}
- public void setColourScheme(ColourSchemeI colourScheme)
+ public void setColourScheme(String globalColourScheme)
{
- this.colourScheme = colourScheme;
+ this.globalColourScheme = globalColourScheme;
}
public ColumnSelection getColumnSelection()
import jalview.api.FeatureRenderer;
import jalview.api.FeaturesDisplayedI;
import jalview.bin.BuildDetails;
-import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import jalview.json.binding.biojson.v1.SequenceFeaturesPojo;
import jalview.json.binding.biojson.v1.SequenceGrpPojo;
import jalview.json.binding.biojson.v1.SequencePojo;
-import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
public class JSONFile extends AlignFile implements ComplexAlignFile
{
- private ColourSchemeI colourScheme;
-
private static String version = new BuildDetails().getVersion();
private String webstartUrl = "http://www.jalview.org/services/launchApp";
public static final String FILE_DESC = "JSON";
- private String globalColorScheme;
+ private String globalColourScheme;
private boolean showSeqFeatures;
jsonSeqPojo.setSeq(seq.getSequenceAsString());
jsonAlignmentPojo.getSeqs().add(jsonSeqPojo);
}
- jsonAlignmentPojo.setGlobalColorScheme(globalColorScheme);
+ jsonAlignmentPojo.setGlobalColorScheme(globalColourScheme);
jsonAlignmentPojo.getAppSettings().put("application", application);
jsonAlignmentPojo.getAppSettings().put("version", version);
jsonAlignmentPojo.getAppSettings().put("webStartUrl", webstartUrl);
@SuppressWarnings("unchecked")
public JSONFile parse(Reader jsonAlignmentString)
{
- String jsColourScheme = null;
try
{
JSONParser jsonParser = new JSONParser();
if (jvSettingsJsonObj != null)
{
- jsColourScheme = (String) jvSettingsJsonObj
+ globalColourScheme = (String) jvSettingsJsonObj
.get("globalColorScheme");
Boolean showFeatures = Boolean.valueOf(jvSettingsJsonObj.get(
"showSeqFeatures").toString());
seqMap.put(seqUniqueId, seq);
}
- if (jsColourScheme != null)
- {
- setColourScheme(ColourSchemeMapper.getJalviewColourScheme(
- jsColourScheme,
- new Alignment(seqs.toArray(new SequenceI[0]))));
- }
+
parseFeatures(jsonSeqArray);
for (Iterator<JSONObject> seqGrpIter = seqGrpJsonArray.iterator(); seqGrpIter
.toString(), annotations);
this.annotations.add(alignAnnot);
}
-
} catch (Exception e)
{
e.printStackTrace();
}
}
- public String getGlobalColorScheme()
- {
- return globalColorScheme;
- }
-
- public void setGlobalColorScheme(String globalColorScheme)
- {
- this.globalColorScheme = globalColorScheme;
- }
-
- public ColourSchemeI getColourScheme()
+ public String getGlobalColourScheme()
{
- return colourScheme;
+ return globalColourScheme;
}
- public void setColourScheme(ColourSchemeI colourScheme)
+ public void setGlobalColorScheme(String globalColourScheme)
{
- this.colourScheme = colourScheme;
+ this.globalColourScheme = globalColourScheme;
}
@Override
annotations.add(annot);
}
}
- globalColorScheme = ColourSchemeProperty.getColourName(viewport
+ globalColourScheme = ColourSchemeProperty.getColourName(viewport
.getGlobalColourScheme());
setDisplayedFeatures(viewport.getFeaturesDisplayed());
showSeqFeatures = viewport.isShowSequenceFeatures();
public class ColourSchemeMapper
{
+ private static ColourSchemeI csZappo, csTaylor, csNucleotide, csPurine,
+ csHelix, csTurn, csStrand, csBuried, csHydro,
+ csRNAInteractionType, csPID, csBlosum62 = null;
+ static
+ {
+ csZappo = new ZappoColourScheme();
+ csTaylor = new TaylorColourScheme();
+ csNucleotide = new NucleotideColourScheme();
+ csPurine = new PurinePyrimidineColourScheme();
+ csHelix = new HelixColourScheme();
+ csTurn = new TurnColourScheme();
+ csStrand = new StrandColourScheme();
+ csBuried = new BuriedColourScheme();
+ csHydro = new HydrophobicColourScheme();
+ csRNAInteractionType = new RNAInteractionColourScheme();
+ csPID = new PIDColourScheme();
+ csBlosum62 = new Blosum62ColourScheme();
+ }
public static ColourSchemeI getJalviewColourScheme(
String colourSchemeName, AnnotatedCollectionI annotCol)
{
switch (colourSchemeName.toUpperCase())
{
case "ZAPPO":
- return new ZappoColourScheme();
+ return csZappo;
case "TAYLOR":
- return new TaylorColourScheme();
+ return csTaylor;
case "NUCLEOTIDE":
- return new NucleotideColourScheme();
+ return csNucleotide;
case "PURINE":
case "PURINE/PYRIMIDINE":
- return new PurinePyrimidineColourScheme();
+ return csPurine;
case "HELIX":
case "HELIX PROPENSITY":
- return new HelixColourScheme();
+ return csHelix;
case "TURN":
case "TURN PROPENSITY":
- return new TurnColourScheme();
+ return csTurn;
case "STRAND":
case "STRAND PROPENSITY":
- return new StrandColourScheme();
+ return csStrand;
case "BURIED":
case "BURIED INDEX":
- return new BuriedColourScheme();
+ return csBuried;
case "HYDRO":
case "HYDROPHOBIC":
- return new HydrophobicColourScheme();
+ return csHydro;
case "RNA INTERACTION TYPE":
- return new RNAInteractionColourScheme();
+ return csRNAInteractionType;
case "PID":
case "% IDENTITY":
- return new PIDColourScheme();
+ return csPID;
case "BLOSUM62":
- return new Blosum62ColourScheme();
+ return csBlosum62;
case "T-COFFEE SCORES":
return (annotCol != null) ? new TCoffeeColourScheme(annotCol) : null;
case "RNA HELICES":
import jalview.gui.AlignFrame;
import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.schemes.ColourSchemeI;
-import jalview.schemes.ZappoColourScheme;
import java.io.IOException;
import java.util.ArrayList;
jf.getColumnSelection(), AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
af.getViewport().setShowSequenceFeatures(jf.isShowSeqFeatures());
- af.changeColour(jf.getColourScheme());
+ String colourSchemeName = jf.getGlobalColourScheme();
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, alignment);
+ af.changeColour(cs);
af.getViewport().setFeaturesDisplayed(jf.getDisplayedFeatures());
formatAdapter = new AppletFormatAdapter(af.alignPanel, exportSettings);
@Test(groups = { "Functional" })
public void colorSchemeTest()
{
- Assert.assertNotNull(testJsonFile.getColourScheme(),
+ Assert.assertNotNull(testJsonFile.getGlobalColourScheme(),
"Colourscheme is null, parsing failed!");
- Assert.assertTrue(
- testJsonFile.getColourScheme() instanceof ZappoColourScheme,
+ Assert.assertEquals(testJsonFile.getGlobalColourScheme(), "Zappo",
"Zappo colour scheme expected!");
+ // Assert.assertTrue(
+ // testJsonFile.getGlobalColourScheme() instanceof ZappoColourScheme,
+ // "Zappo colour scheme expected!");
}
@Test(groups = { "Functional" })