import static jalview.math.RotatableMatrix.Axis.Y;
import static jalview.math.RotatableMatrix.Axis.Z;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigInteger;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
import jalview.analysis.Conservation;
import jalview.analysis.PCA;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.Format;
+import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.StringUtils;
import jalview.xml.binding.jalview.ThresholdType;
import jalview.xml.binding.jalview.VAMSAS;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.io.BufferedReader;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.math.BigInteger;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Vector;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.SwingUtilities;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
/**
* Write out the current jalview desktop state as a Jalview XML stream.
*
else
{
vamsasSeq = createVamsasSequence(id, jds);
-// vamsasSet.addSequence(vamsasSeq);
+ // vamsasSet.addSequence(vamsasSeq);
vamsasSet.getSequence().add(vamsasSeq);
vamsasSetIds.put(id, vamsasSeq);
seqRefIds.put(id, jds);
if (colourScheme instanceof jalview.schemes.UserColourScheme)
{
- jGroup.setColour(
- setUserColourScheme(colourScheme, userColours,
- object));
+ jGroup.setColour(setUserColourScheme(colourScheme,
+ userColours, object));
}
else
{
}
}
- //jms.setJGroup(groups);
+ // jms.setJGroup(groups);
Object group;
for (JGroup grp : groups)
{
* save any filter for the feature type
*/
FeatureMatcherSetI filter = fr.getFeatureFilter(featureType);
- if (filter != null) {
- Iterator<FeatureMatcherI> filters = filter.getMatchers().iterator();
+ if (filter != null)
+ {
+ Iterator<FeatureMatcherI> filters = filter.getMatchers()
+ .iterator();
FeatureMatcherI firstFilter = filters.next();
- setting.setMatcherSet(Jalview2XML.marshalFilter(
- firstFilter, filters, filter.isAnded()));
+ setting.setMatcherSet(Jalview2XML.marshalFilter(firstFilter,
+ filters, filter.isAnded()));
}
/*
setting.setDisplay(
av.getFeaturesDisplayed().isVisible(featureType));
- float rorder = fr
- .getOrder(featureType);
+ float rorder = fr.getOrder(featureType);
if (rorder > -1)
{
setting.setOrder(rorder);
Group g = new Group();
g.setName(grp);
g.setDisplay(((Boolean) fr.checkGroupVisibility(grp, false))
- .booleanValue());
+ .booleanValue());
// fs.addGroup(g);
fs.getGroup().add(g);
groupsAdded.addElement(grp);
{
if (calcIdParam.getVersion().equals("1.0"))
{
- final String[] calcIds = calcIdParam.getServiceURL().toArray(new String[0]);
+ final String[] calcIds = calcIdParam.getServiceURL()
+ .toArray(new String[0]);
Jws2Instance service = Jws2Discoverer.getDiscoverer()
.getPreferredServiceFor(calcIds);
if (service != null)
return id;
}
- jalview.schemes.UserColourScheme getUserColourScheme(
- JalviewModel jm, String id)
+ jalview.schemes.UserColourScheme getUserColourScheme(JalviewModel jm,
+ String id)
{
List<UserColours> uc = jm.getUserColours();
UserColours colours = null;
-/*
+ /*
for (int i = 0; i < uc.length; i++)
{
if (uc[i].getId().equals(id))
break;
}
}
-*/
+ */
for (UserColours c : uc)
{
if (c.getId().equals(id))
newColours = new java.awt.Color[23];
for (int i = 0; i < 23; i++)
{
- newColours[i] = new java.awt.Color(Integer.parseInt(
- colours.getUserColourScheme().getColour().get(i + 24)
- .getRGB(),
- 16));
+ newColours[i] = new java.awt.Color(
+ Integer.parseInt(colours.getUserColourScheme().getColour()
+ .get(i + 24).getRGB(), 16));
}
ucs.setLowerCaseColours(newColours);
}
viewportsAdded.clear();
frefedSequence = null;
- if (file.startsWith("http://"))
+ if (HttpUtils.startsWithHttpOrHttps(file))
{
url = new URL(file);
}
XMLStreamReader streamReader = XMLInputFactory.newInstance()
.createXMLStreamReader(jin);
javax.xml.bind.Unmarshaller um = jc.createUnmarshaller();
- JAXBElement<JalviewModel> jbe = um
- .unmarshal(streamReader, JalviewModel.class);
+ JAXBElement<JalviewModel> jbe = um.unmarshal(streamReader,
+ JalviewModel.class);
JalviewModel object = jbe.getValue();
/*
AlignFrame loadFromObject(JalviewModel jalviewModel, String file,
boolean loadTreesAndStructures, jarInputStreamProvider jprovider)
{
- SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet().get(0);
+ SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet()
+ .get(0);
List<Sequence> vamsasSeqs = vamsasSet.getSequence();
// JalviewModelSequence jms = object.getJalviewModelSequence();
if (tmpSeq.getStart() != jseq.getStart()
|| tmpSeq.getEnd() != jseq.getEnd())
{
- System.err.println(
- String.format("Warning JAL-2154 regression: updating start/end for sequence %s from %d/%d to %d/%d",
- tmpSeq.getName(), tmpSeq.getStart(),
- tmpSeq.getEnd(), jseq.getStart(),
- jseq.getEnd()));
+ System.err.println(String.format(
+ "Warning JAL-2154 regression: updating start/end for sequence %s from %d/%d to %d/%d",
+ tmpSeq.getName(), tmpSeq.getStart(), tmpSeq.getEnd(),
+ jseq.getStart(), jseq.getEnd()));
}
}
else
else
{
// defer to later
- frefedSequence.add(
- newAlcodMapRef(map.getDnasq(), cf, mapping));
+ frefedSequence
+ .add(newAlcodMapRef(map.getDnasq(), cf, mapping));
}
}
}
jaa.setCalcId(annotation.getCalcId());
if (annotation.getProperty().size() > 0)
{
- for (Annotation.Property prop : annotation
- .getProperty())
+ for (Annotation.Property prop : annotation.getProperty())
{
jaa.setProperty(prop.getName(), prop.getValue());
}
sg.setShowNonconserved(safeBoolean(jGroup.isShowUnconserved()));
sg.thresholdTextColour = safeInt(jGroup.getTextColThreshold());
// attributes with a default in the schema are never null
- sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram());
- sg.setshowSequenceLogo(jGroup.isShowSequenceLogo());
- sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo());
+ sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram());
+ sg.setshowSequenceLogo(jGroup.isShowSequenceLogo());
+ sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo());
sg.setIgnoreGapsConsensus(jGroup.isIgnoreGapsinConsensus());
if (jGroup.getConsThreshold() != null
&& jGroup.getConsThreshold().intValue() != 0)
if (addAnnotSchemeGroup)
{
// reconstruct the annotation colourscheme
- sg.setColourScheme(constructAnnotationColour(
- jGroup.getAnnotationColours(), null, al, jalviewModel, false));
+ sg.setColourScheme(
+ constructAnnotationColour(jGroup.getAnnotationColours(),
+ null, al, jalviewModel, false));
}
}
}
* @param av
* @param ap
*/
- protected void loadTrees(JalviewModel jm, Viewport view,
- AlignFrame af, AlignViewport av, AlignmentPanel ap)
+ protected void loadTrees(JalviewModel jm, Viewport view, AlignFrame af,
+ AlignViewport av, AlignmentPanel ap)
{
// TODO result of automated refactoring - are all these parameters needed?
try
for (int s = 0; s < structureStateCount; s++)
{
// check to see if we haven't already created this structure view
- final StructureState structureState = pdbid
- .getStructureState().get(s);
+ final StructureState structureState = pdbid.getStructureState()
+ .get(s);
String sviewid = (structureState.getViewId() == null) ? null
: structureState.getViewId() + uniqueSetSuffix;
jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry();
colourByViewer &= structureState.isColourByJmol();
jmoldat.setColourByViewer(colourByViewer);
- if (jmoldat.getStateData().length() < structureState
- .getValue()/*Content()*/.length())
+ if (jmoldat.getStateData().length() < structureState.getValue()
+ /*Content()*/.length())
{
jmoldat.setStateData(structureState.getValue());// Content());
}
String reformatedOldFilename = oldfilenam.replaceAll("/", "\\\\");
filedat = oldFiles.get(new File(reformatedOldFilename));
}
- newFileLoc.append(Platform.escapeBackslashes(filedat.getFilePath()));
+ newFileLoc
+ .append(Platform.escapeBackslashes(filedat.getFilePath()));
pdbfilenames.add(filedat.getFilePath());
pdbids.add(filedat.getPdbId());
seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0]));
}
AlignFrame loadViewport(String file, List<JSeq> JSEQ,
- List<SequenceI> hiddenSeqs, AlignmentI al,
- JalviewModel jm, Viewport view, String uniqueSeqSetId,
- String viewId, List<JvAnnotRow> autoAlan)
+ List<SequenceI> hiddenSeqs, AlignmentI al, JalviewModel jm,
+ Viewport view, String uniqueSeqSetId, String viewId,
+ List<JvAnnotRow> autoAlan)
{
AlignFrame af = null;
af = new AlignFrame(al, safeInt(view.getWidth()),
viewport.setColourText(safeBoolean(view.isShowColourText()));
- viewport
- .setConservationSelected(
- safeBoolean(view.isConservationSelected()));
+ viewport.setConservationSelected(
+ safeBoolean(view.isConservationSelected()));
viewport.setIncrement(safeInt(view.getConsThreshold()));
viewport.setShowJVSuffix(safeBoolean(view.isShowFullId()));
viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds()));
af.changeColour(cs);
viewport.setColourAppliesToAllGroups(true);
- viewport
- .setShowSequenceFeatures(
- safeBoolean(view.isShowSequenceFeatures()));
+ viewport.setShowSequenceFeatures(
+ safeBoolean(view.isShowSequenceFeatures()));
viewport.setCentreColumnLabels(view.isCentreColumnLabels());
viewport.setIgnoreGapsConsensus(view.isIgnoreGapsinConsensus(), null);
.getFeatureRenderer();
FeaturesDisplayed fdi;
viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
- String[] renderOrder = new String[jm.getFeatureSettings()
- .getSetting().size()];
+ String[] renderOrder = new String[jm.getFeatureSettings().getSetting()
+ .size()];
Map<String, FeatureColourI> featureColours = new Hashtable<>();
Map<String, Float> featureOrder = new Hashtable<>();
- for (int fs = 0; fs < jm.getFeatureSettings()
- .getSetting().size(); fs++)
+ for (int fs = 0; fs < jm.getFeatureSettings().getSetting()
+ .size(); fs++)
{
Setting setting = jm.getFeatureSettings().getSetting().get(fs);
String featureType = setting.getType();
.getMatcherSet();
if (filters != null)
{
- FeatureMatcherSetI filter = Jalview2XML
- .parseFilter(featureType, filters);
+ FeatureMatcherSetI filter = Jalview2XML.parseFilter(featureType,
+ filters);
if (!filter.isEmpty())
{
fr.setFeatureFilter(featureType, filter);
float max = setting.getMax() == null ? 1f
: setting.getMax().floatValue();
FeatureColourI gc = new FeatureColour(maxColour, minColour,
- maxColour,
- noValueColour, min, max);
+ maxColour, noValueColour, min, max);
if (setting.getAttributeName().size() > 0)
{
gc.setAttributeName(setting.getAttributeName().toArray(
}
else
{
- featureColours.put(featureType,
- new FeatureColour(maxColour));
+ featureColours.put(featureType, new FeatureColour(maxColour));
}
renderOrder[fs] = featureType;
if (setting.getOrder() != null)
}
}
}
+
/**
*
* @param vamsasSeq
* @param fcol
* @return
*/
- public static Colour marshalColour(
- String featureType, FeatureColourI fcol)
+ public static Colour marshalColour(String featureType,
+ FeatureColourI fcol)
{
Colour col = new Colour();
if (fcol.isSimpleColour())
boolean and)
{
jalview.xml.binding.jalview.FeatureMatcherSet result = new jalview.xml.binding.jalview.FeatureMatcherSet();
-
+
if (filters.hasNext())
{
/*
}
result.setMatchCondition(matcherModel);
}
-
+
return result;
}
* @param matcherSetModel
* @return
*/
- public static FeatureMatcherSetI parseFilter(
- String featureType,
+ public static FeatureMatcherSetI parseFilter(String featureType,
jalview.xml.binding.jalview.FeatureMatcherSet matcherSetModel)
{
FeatureMatcherSetI result = new FeatureMatcherSet();
featureType, e.getMessage()));
// return as much as was parsed up to the error
}
-
+
return result;
}
* @throws IllegalStateException
* if AND and OR conditions are mixed
*/
- protected static void parseFilterConditions(
- FeatureMatcherSetI matcherSet,
+ protected static void parseFilterConditions(FeatureMatcherSetI matcherSet,
jalview.xml.binding.jalview.FeatureMatcherSet matcherSetModel,
boolean and)
{
else if (filterBy == FilterBy.BY_SCORE)
{
matchCondition = FeatureMatcher.byScore(cond, pattern);
-
+
}
else if (filterBy == FilterBy.BY_ATTRIBUTE)
{
matchCondition = FeatureMatcher.byAttribute(cond, pattern,
attNames);
}
-
+
/*
* note this throws IllegalStateException if AND-ing to a
* previously OR-ed compound condition, or vice versa
public static FeatureColourI parseColour(Colour colourModel)
{
FeatureColourI colour = null;
-
+
if (colourModel.getMax() != null)
{
Color mincol = null;
Color maxcol = null;
Color noValueColour = null;
-
+
try
{
mincol = new Color(Integer.parseInt(colourModel.getMinRGB(), 16));
{
Cache.log.warn("Couldn't parse out graduated feature color.", e);
}
-
+
NoValueColour noCol = colourModel.getNoValueColour();
if (noCol == NoValueColour.MIN)
{
{
noValueColour = maxcol;
}
-
+
colour = new FeatureColour(maxcol, mincol, maxcol, noValueColour,
safeFloat(colourModel.getMin()),
safeFloat(colourModel.getMax()));
Color color = new Color(Integer.parseInt(colourModel.getRGB(), 16));
colour = new FeatureColour(color);
}
-
+
return colour;
}
}