import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
+import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.schemabinding.version2.AlcodMap;
-import jalview.schemabinding.version2.Alcodon;
import jalview.schemabinding.version2.AlcodonFrame;
import jalview.schemabinding.version2.Annotation;
import jalview.schemabinding.version2.AnnotationColours;
for (ap = 0; ap < apSize; ap++)
{
- AlignmentPanel apanel = (AlignmentPanel) af.alignPanels
- .elementAt(ap);
+ AlignmentPanel apanel = af.alignPanels.get(ap);
String fileName = apSize == 1 ? shortName : ap + shortName;
if (!fileName.endsWith(".xml"))
{
Hashtable<String, AlignFrame> dsses = new Hashtable<String, AlignFrame>();
for (ap = 0; ap < apSize; ap++)
{
- AlignmentPanel apanel = (AlignmentPanel) af.alignPanels
- .elementAt(ap);
+ AlignmentPanel apanel = af.alignPanels
+ .get(ap);
String jfileName = apSize == 1 ? fileName : fileName + ap;
if (!jfileName.endsWith(".xml"))
{
for (String dssids : dsses.keySet())
{
AlignFrame _af = dsses.get(dssids);
- String jfileName = MessageManager.formatMessage("label.dataset_for", new String[]{fileName,_af.getTitle()});
+ String jfileName = fileName + " Dataset for " + _af.getTitle();
if (!jfileName.endsWith(".xml"))
{
jfileName = jfileName + ".xml";
jal = av.getAlignment();
}
// SAVE MAPPINGS
- if (jal.getCodonFrames() != null && jal.getCodonFrames().length > 0)
+ Set<AlignedCodonFrame> jac = jal.getCodonFrames();
+ if (jac != null)
{
- jalview.datamodel.AlignedCodonFrame[] jac = jal.getCodonFrames();
- for (int i = 0; i < jac.length; i++)
+ for (AlignedCodonFrame acf : jac)
{
AlcodonFrame alc = new AlcodonFrame();
vamsasSet.addAlcodonFrame(alc);
- for (int p = 0; p < jac[i].aaWidth; p++)
+ if (acf.getProtMappings() != null
+ && acf.getProtMappings().length > 0)
{
- Alcodon cmap = new Alcodon();
- if (jac[i].codons[p] != null)
- {
- // Null codons indicate a gapped column in the translated peptide
- // alignment.
- cmap.setPos1(jac[i].codons[p][0]);
- cmap.setPos2(jac[i].codons[p][1]);
- cmap.setPos3(jac[i].codons[p][2]);
- }
- alc.addAlcodon(cmap);
- }
- if (jac[i].getProtMappings() != null
- && jac[i].getProtMappings().length > 0)
- {
- SequenceI[] dnas = jac[i].getdnaSeqs();
- jalview.datamodel.Mapping[] pmaps = jac[i].getProtMappings();
+ SequenceI[] dnas = acf.getdnaSeqs();
+ jalview.datamodel.Mapping[] pmaps = acf.getProtMappings();
for (int m = 0; m < pmaps.length; m++)
{
AlcodMap alcmap = new AlcodMap();
for (int c = 0; c < av.getColumnSelection().getHiddenColumns()
.size(); c++)
{
- int[] region = (int[]) av.getColumnSelection()
- .getHiddenColumns().elementAt(c);
+ int[] region = av.getColumnSelection().getHiddenColumns()
+ .get(c);
HiddenColumns hc = new HiddenColumns();
hc.setStart(region[0]);
hc.setEnd(region[1]);
calcIdSet.add(aa[i].getCalcId());
an.setCalcId(aa[i].getCalcId());
}
-
+ if (aa[i].hasProperties())
+ {
+ for (String pr : aa[i].getProperties())
+ {
+ Property prop = new Property();
+ prop.setName(pr);
+ prop.setValue(aa[i].getProperty(pr));
+ an.addProperty(prop);
+ }
+ }
AnnotationElement ae;
if (aa[i].annotations != null)
{
}
ae.setPosition(a);
- if (aa[i].annotations[a].secondaryStructure != ' '
- && aa[i].annotations[a].secondaryStructure != '\0')
+ if (aa[i].annotations[a].secondaryStructure > ' ')
{
ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure
+ "");
}
else
{
- recoverDatasetFor(vamsasSet, al);
+ // recover dataset - passing on flag indicating if this a 'viewless'
+ // sequence set (a.k.a. a stored dataset for the project)
+ recoverDatasetFor(vamsasSet, al, object.getJalviewModelSequence()
+ .getViewportCount() == 0);
}
// ///////////////////////////////
AlcodonFrame[] alc = vamsasSet.getAlcodonFrame();
for (int i = 0; i < alc.length; i++)
{
- jalview.datamodel.AlignedCodonFrame cf = new jalview.datamodel.AlignedCodonFrame(
- alc[i].getAlcodonCount());
- if (alc[i].getAlcodonCount() > 0)
- {
- Alcodon[] alcods = alc[i].getAlcodon();
- for (int p = 0; p < cf.codons.length; p++)
- {
- if (alcods[p].hasPos1() && alcods[p].hasPos2()
- && alcods[p].hasPos3())
- {
- // translated codons require three valid positions
- cf.codons[p] = new int[3];
- cf.codons[p][0] = (int) alcods[p].getPos1();
- cf.codons[p][1] = (int) alcods[p].getPos2();
- cf.codons[p][2] = (int) alcods[p].getPos3();
- }
- else
- {
- cf.codons[p] = null;
- }
- }
- }
+ AlignedCodonFrame cf = new AlignedCodonFrame();
if (alc[i].getAlcodMapCount() > 0)
{
AlcodMap[] maps = alc[i].getAlcodMap();
jaa.belowAlignment = an[i].isBelowAlignment();
}
jaa.setCalcId(an[i].getCalcId());
+ if (an[i].getPropertyCount() > 0)
+ {
+ for (jalview.schemabinding.version2.Property prop : an[i]
+ .getProperty())
+ {
+ jaa.setProperty(prop.getName(), prop.getValue());
+ }
+ }
if (jaa.autoCalculated)
{
autoAlan.add(new JvAnnotRow(i, jaa));
if (av != null)
{
// propagate shared settings to this new view
- af.viewport.historyList = av.historyList;
- af.viewport.redoList = av.redoList;
+ af.viewport.setHistoryList(av.getHistoryList());
+ af.viewport.setRedoList(av.getRedoList());
}
else
{
}
}
- private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al)
+ private void recoverDatasetFor(SequenceSet vamsasSet, Alignment al,
+ boolean ignoreUnrefed)
{
jalview.datamodel.Alignment ds = getDatasetFor(vamsasSet.getDatasetId());
Vector dseqs = null;
for (int i = 0, iSize = vamsasSet.getSequenceCount(); i < iSize; i++)
{
Sequence vamsasSeq = vamsasSet.getSequence(i);
- ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs);
+ ensureJalviewDatasetSequence(vamsasSeq, ds, dseqs, ignoreUnrefed);
}
// create a new dataset
if (ds == null)
addDatasetRef(vamsasSet.getDatasetId(), ds);
}
// set the dataset for the newly imported alignment.
- if (al.getDataset() == null)
+ if (al.getDataset() == null && !ignoreUnrefed)
{
al.setDataset(ds);
}
* vector to add new dataset sequence to
*/
private void ensureJalviewDatasetSequence(Sequence vamsasSeq,
- AlignmentI ds, Vector dseqs)
+ AlignmentI ds, Vector dseqs, boolean ignoreUnrefed)
{
// JBP TODO: Check this is called for AlCodonFrames to support recovery of
// xRef Codon Maps
{
dsq = sq.getDatasetSequence();
}
-
+ if (sq == null && ignoreUnrefed)
+ {
+ return;
+ }
String sqid = vamsasSeq.getDsseqid();
if (dsq == null)
{