* entry names
*/
private Map<RnaModel, String> rnaSessions = new HashMap<>();
-
+
/**
* map from contact matrices to their XML ids
*/
- private Map<ContactMatrixI,String> contactMatrices = new HashMap<>();
+ private Map<ContactMatrixI, String> contactMatrices = new HashMap<>();
+
private Map<String, ContactMatrixI> contactMatrixRefs = new HashMap<>();
- private List<jalview.xml.binding.jalview.MatrixType> xmlMatrices= new ArrayList<>();
+
+ private List<jalview.xml.binding.jalview.MatrixType> xmlMatrices = new ArrayList<>();
/**
* A helper method for safely using the value of an optional attribute that
}
/**
- * base class for resolving forward references to an as-yet unmarshalled object referenced by already unmarshalled objects
+ * base class for resolving forward references to an as-yet unmarshalled
+ * object referenced by already unmarshalled objects
*
* @author jprocter
*
*/
- abstract class forwardRef {
+ abstract class forwardRef
+ {
String sref;
String type;
}
public abstract boolean isResolvable();
+
/**
* @return true if the forward reference was fully resolved
*/
return type + " reference to " + sref;
}
}
+
/**
* resolve forward references to sequences by their ID
+ *
* @author jprocter
*/
abstract class SeqFref extends forwardRef
{
super(_sref, type);
}
+
public SequenceI getSrefSeq()
{
return seqRefIds.get(sref);
};
return fref;
}
-
+
public forwardRef newMatrixFref(final String matRef,
final jalview.util.MapList mapping, final AlignmentAnnotation jaa)
{
view.setShowFullId(av.getShowJVSuffix());
view.setRightAlignIds(av.isRightAlignIds());
view.setIdWidth(av.getIdWidth());
- view.setIdWidthManuallyAdjusted(ap.getIdPanel().getIdCanvas().isManuallyAdjusted());
-
+ view.setIdWidthManuallyAdjusted(
+ ap.getIdPanel().getIdCanvas().isManuallyAdjusted());
+
view.setShowSequenceFeatures(av.isShowSequenceFeatures());
view.setShowText(av.getShowText());
view.setShowUnconserved(av.getShowUnconserved());
// jms.addViewport(view);
object.getViewport().add(view);
}
-
-
+
if (storeDS)
{
// store matrices referenced by any views or annotation in this dataset
- if (xmlMatrices!=null && xmlMatrices.size()>0)
+ if (xmlMatrices != null && xmlMatrices.size() > 0)
{
- Console.debug("Adding "+xmlMatrices.size()+" matrices to dataset.");
+ Console.debug(
+ "Adding " + xmlMatrices.size() + " matrices to dataset.");
vamsasSet.getMatrix().addAll(xmlMatrices);
xmlMatrices.clear();
}
}
-
// object.setJalviewModelSequence(jms);
// object.getVamsasModel().addSequenceSet(vamsasSet);
object.getVamsasModel().getSequenceSet().add(vamsasSet);
.getContactMatrixFor(annotation);
if (cm != null)
{
- storeMatrixFor(vamsasSet, an,annotation, cm);
+ storeMatrixFor(vamsasSet, an, annotation, cm);
}
}
}
}
- private void storeMatrixFor(SequenceSet root, Annotation an, AlignmentAnnotation annotation, ContactMatrixI cm)
+ private void storeMatrixFor(SequenceSet root, Annotation an,
+ AlignmentAnnotation annotation, ContactMatrixI cm)
{
String cmId = contactMatrices.get(cm);
- MatrixType xmlmat=null;
-
+ MatrixType xmlmat = null;
+
// first create an xml ref for the matrix data, if none exist
if (cmId == null)
{
{
xmlmat.setCutHeight(cm.getCutHeight());
}
- xmlmat.setId(cmId = "m"+contactMatrices.size()+System.currentTimeMillis());
- Console.trace("Matrix data stored :"+cmId);
+ xmlmat.setId(cmId = "m" + contactMatrices.size()
+ + System.currentTimeMillis());
+ Console.trace("Matrix data stored :" + cmId);
contactMatrices.put(cm, cmId);
contactMatrixRefs.put(cmId, cm);
xmlMatrices.add(xmlmat);
- } else {
- Console.trace("Existing Matrix stored :"+cmId);
+ }
+ else
+ {
+ Console.trace("Existing Matrix stored :" + cmId);
}
// now store mapping
MapOnAMatrixType xmlmatmapping = new MapOnAMatrixType();
xmlmatmapping.setMatrix(cmId);
-
+
// Pretty much all matrices currently managed in this way are
// mappableContactMatrixI implementations - but check anyway
if (cm instanceof MappableContactMatrixI)
initSeqRefs();
}
AlignFrame af = null, _af = null;
- List<AlignFrame> toRepaint=new ArrayList<AlignFrame>();
+ List<AlignFrame> toRepaint = new ArrayList<AlignFrame>();
IdentityHashMap<AlignmentI, AlignmentI> importedDatasets = new IdentityHashMap<>();
Map<String, AlignFrame> gatherToThisFrame = new HashMap<>();
final String file = jprovider.getFilename();
} while (jarentry != null);
jin.close();
resolveFrefedSequences();
- for (AlignFrame alignFrame:toRepaint)
+ for (AlignFrame alignFrame : toRepaint)
{
alignFrame.repaint();
}
// ////////////////////////////////
// LOAD MATRICES (IF ANY)
-
- if (vamsasSet.getMatrix()!=null && vamsasSet.getMatrix().size()>0)
+
+ if (vamsasSet.getMatrix() != null && vamsasSet.getMatrix().size() > 0)
{
importMatrixData(vamsasSet.getMatrix());
}
-
+
// ////////////////////////////////
// LOAD SEQUENCES
for (MapOnAMatrixType xmlmat : annotation.getContactmatrix())
{
restoreMatrixFor(jaa.sequenceRef, jaa, xmlmat);
- }
+ }
}
}
private void importMatrixData(List<MatrixType> xmlmatrices)
{
- for (MatrixType xmlmat:xmlmatrices)
+ for (MatrixType xmlmat : xmlmatrices)
{
if (!PAEContactMatrix.PAEMATRIX.equals(xmlmat.getType()))
{
- Console.error("Ignoring matrix '"+xmlmat.getId()+"' of type '"+xmlmat.getType());
+ Console.error("Ignoring matrix '" + xmlmat.getId() + "' of type '"
+ + xmlmat.getType());
continue;
}
continue;
}
- float[][] elements = ContactMatrix
- .fromFloatStringToContacts(xmlmat.getElements(),
- xmlmat.getCols().intValue(),
- xmlmat.getRows().intValue());
-
+ float[][] elements = ContactMatrix.fromFloatStringToContacts(
+ xmlmat.getElements(), xmlmat.getCols().intValue(),
+ xmlmat.getRows().intValue());
+
List<BitSet> newgroups = new ArrayList<BitSet>();
if (xmlmat.getGroups().size() > 0)
{
newgroups.add(deStringifyBitset(sgroup));
}
}
- String nwk = xmlmat.getNewick().size() > 0
- ? xmlmat.getNewick().get(0)
+ String nwk = xmlmat.getNewick().size() > 0 ? xmlmat.getNewick().get(0)
: null;
if (xmlmat.getNewick().size() > 1)
{
- Console.log.info(
- "Ignoring additional clusterings for contact matrix");
+ Console.log
+ .info("Ignoring additional clusterings for contact matrix");
}
String treeMethod = xmlmat.getTreeMethod();
- double thresh = xmlmat.getCutHeight() != null
- ? xmlmat.getCutHeight()
+ double thresh = xmlmat.getCutHeight() != null ? xmlmat.getCutHeight()
: 0;
GroupSet grpset = new GroupSet();
grpset.restoreGroups(newgroups, treeMethod, nwk, thresh);
-
+
FloatContactMatrix newcm = new FloatContactMatrix(elements, grpset);
contactMatrixRefs.put(xmlmat.getId(), newcm);
- Console.trace("Restored base contact matrix "+xmlmat.getId());
+ Console.trace("Restored base contact matrix " + xmlmat.getId());
}
}
private void restoreMatrixFor(SequenceI sequenceRef,
AlignmentAnnotation jaa, MapOnAMatrixType xmlmatmapping)
- {
+ {
// restore mapping data to matrix data
jalview.util.MapList mapping = null;
if (xmlmatmapping.getMapping() != null)
mapping = new jalview.util.MapList(fr, fto,
m.getMapFromUnit().intValue(), m.getMapToUnit().intValue());
}
-
+
// locate matrix data in project XML and import
ContactMatrixI cm = contactMatrixRefs.get(xmlmatmapping.getMatrix());
if (cm == null)
}
af.setBounds(safeInt(view.getXpos()), safeInt(view.getYpos()),
safeInt(view.getWidth()), safeInt(view.getHeight()));
-
- af.alignPanel.fontChanged(); // make sure font is updated *before* we set ID width
- if (view.getIdWidth()==null)
+
+ af.alignPanel.fontChanged(); // make sure font is updated *before* we set ID
+ // width
+ if (view.getIdWidth() == null)
{
- if (!isVersionStringLaterThan("2.11.3", jm.getVersion())) {
+ if (!isVersionStringLaterThan("2.11.3", jm.getVersion()))
+ {
// Pre 2.11.3 jalview projects do not store the id width
// idWidth was also calculated in a different way.
viewport.setIdWidth(af.alignPanel.getLegacyIdWidth());
af.alignPanel.getIdPanel().getIdCanvas().setManuallyAdjusted(true);
}
- } else {
+ }
+ else
+ {
viewport.setIdWidth(view.getIdWidth());
- af.alignPanel.getIdPanel().getIdCanvas().setManuallyAdjusted(view.isIdWidthManuallyAdjusted());
+ af.alignPanel.getIdPanel().getIdCanvas()
+ .setManuallyAdjusted(view.isIdWidthManuallyAdjusted());
}
-
+
// startSeq set in af.alignPanel.updateLayout below
af.alignPanel.updateLayout();
ColourSchemeI cs = null;