/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
import jalview.structure.StructureSelectionManager;
/**
- * Write out the current jalview desktop state
- * as a Jalview XML stream.
+ * Write out the current jalview desktop state as a Jalview XML stream.
+ *
+ * Note: the vamsas objects referred to here are primitive versions of the
+ * VAMSAS project schema elements - they are not the same and most likely never
+ * will be :)
*
- * Note: the vamsas objects referred to here are primitive
- * versions of the VAMSAS project schema elements - they are
- * not the same and most likely never will be :)
- *
* @author $author$
* @version $Revision$
*/
{
/**
* create/return unique hash string for sq
+ *
* @param sq
* @return new or existing unique string for sq
*/
String seqHash(SequenceI sq)
{
- if (seqsToIds==null)
+ if (seqsToIds == null)
{
initSeqRefs();
}
if (seqsToIds.containsKey(sq))
{
return (String) seqsToIds.get(sq);
- } else {
- // create sequential key
- String key = "sq"+(seqsToIds.size()+1);
+ }
+ else
+ {
+ // create sequential key
+ String key = "sq" + (seqsToIds.size() + 1);
seqsToIds.put(sq, key);
return key;
}
}
+
void clearSeqRefs()
{
seqRefIds.clear();
seqsToIds.clear();
}
+
void initSeqRefs()
{
- if (seqsToIds==null)
+ if (seqsToIds == null)
{
seqsToIds = new IdentityHashMap();
}
- if (seqRefIds==null)
+ if (seqRefIds == null)
{
seqRefIds = new Hashtable();
}
}
+
java.util.IdentityHashMap seqsToIds = null; // SequenceI->key resolution
+
java.util.Hashtable seqRefIds = null; // key->SequenceI resolution
Vector frefedSequence = null;
+
boolean raiseGUI = true; // whether errors are raised in dialog boxes or not
+
public Jalview2XML()
{
}
+
public Jalview2XML(boolean raiseGUI)
{
this.raiseGUI = raiseGUI;
}
else
{
- System.err
- .println("IMPLEMENTATION ERROR: Unimplemented forward sequence references for "
- + ref[1].getClass() + " type objects.");
+ if (ref[1] instanceof jalview.datamodel.AlignedCodonFrame)
+ {
+ SequenceI seq = (SequenceI) seqRefIds.get(sref);
+ while (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ if (ref[2] != null
+ && ref[2] instanceof jalview.datamodel.Mapping)
+ {
+ jalview.datamodel.Mapping mp = (jalview.datamodel.Mapping) ref[2];
+ ((jalview.datamodel.AlignedCodonFrame) ref[1]).addMap(
+ seq, mp.getTo(), mp.getMap());
+ }
+ else
+ {
+ System.err
+ .println("IMPLEMENTATION ERROR: Unimplemented forward sequence references for AlcodonFrames involving "
+ + ref[2].getClass() + " type objects.");
+ }
+ }
+ else
+ {
+ System.err
+ .println("IMPLEMENTATION ERROR: Unimplemented forward sequence references for "
+ + ref[1].getClass() + " type objects.");
+ }
+ frefedSequence.remove(r);
+ rSize--;
}
- frefedSequence.remove(r);
- rSize--;
}
else
{
+ System.err
+ .println("IMPLEMENTATION WARNING: Unresolved forward reference for hash string "
+ + ref[0]
+ + " with objecttype "
+ + ref[1].getClass());
r++;
}
}
}
/**
- * This maintains a list of viewports, the key being the
- * seqSetId. Important to set historyItem and redoList
- * for multiple views
+ * This maintains a list of viewports, the key being the seqSetId. Important
+ * to set historyItem and redoList for multiple views
*/
Hashtable viewportsAdded;
FileOutputStream fos = new FileOutputStream(statefile);
JarOutputStream jout = new JarOutputStream(fos);
- //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS
- ////////////////////////////////////////////////////
- //NOTE ALSO new PrintWriter must be used for each new JarEntry
+ // NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS
+ // //////////////////////////////////////////////////
+ // NOTE ALSO new PrintWriter must be used for each new JarEntry
PrintWriter out = null;
Vector shortNames = new Vector();
- //REVERSE ORDER
+ // REVERSE ORDER
for (int i = frames.length - 1; i > -1; i--)
{
if (frames[i] instanceof AlignFrame)
}
}
}
- try { jout.flush(); } catch (Exception foo) {};
+ try
+ {
+ jout.flush();
+ } catch (Exception foo)
+ {
+ }
+ ;
jout.close();
} catch (Exception ex)
{
- //TODO: inform user of the problem - they need to know if their data was not saved !
+ // TODO: inform user of the problem - they need to know if their data was
+ // not saved !
ex.printStackTrace();
}
}
SaveState(apanel, jfileName, jout);
}
- try { jout.flush(); } catch (Exception foo) {};
+ try
+ {
+ jout.flush();
+ } catch (Exception foo)
+ {
+ }
+ ;
jout.close();
return true;
} catch (Exception ex)
}
/**
- * create a JalviewModel from an algnment view and marshall it
- * to a JarOutputStream
- *
- * @param ap panel to create jalview model for
- * @param fileName name of alignment panel written to output stream
- * @param jout jar output stream
- * @param out jar entry name
+ * create a JalviewModel from an algnment view and marshall it to a
+ * JarOutputStream
+ *
+ * @param ap
+ * panel to create jalview model for
+ * @param fileName
+ * name of alignment panel written to output stream
+ * @param jout
+ * jar output stream
+ * @param out
+ * jar entry name
*/
public JalviewModel SaveState(AlignmentPanel ap, String fileName,
JarOutputStream jout)
{
initSeqRefs();
-
+
Vector userColours = new Vector();
AlignViewport av = ap.av;
JSeq jseq;
- //SAVE SEQUENCES
+ // SAVE SEQUENCES
String id = "";
jalview.datamodel.SequenceI jds;
for (int i = 0; i < jal.getHeight(); i++)
if (seqRefIds.get(id) != null)
{
- // This happens for two reasons: 1. multiple views are being serialised. 2. the hashCode has collided with another sequence's code. This DOES HAPPEN! (PF00072.15.stk does this)
- // JBPNote: Uncomment to debug writing out of files that do not read back in due to ArrayOutOfBoundExceptions.
- //System.err.println("vamsasSeq backref: "+id+"");
- //System.err.println(jds.getName()+" "+jds.getStart()+"-"+jds.getEnd()+" "+jds.getSequenceAsString());
- //System.err.println("Hashcode: "+seqHash(jds));
- //SequenceI rsq = (SequenceI) seqRefIds.get(id + "");
- //System.err.println(rsq.getName()+" "+rsq.getStart()+"-"+rsq.getEnd()+" "+rsq.getSequenceAsString());
- //System.err.println("Hashcode: "+seqHash(rsq));
+ // This happens for two reasons: 1. multiple views are being serialised.
+ // 2. the hashCode has collided with another sequence's code. This DOES
+ // HAPPEN! (PF00072.15.stk does this)
+ // JBPNote: Uncomment to debug writing out of files that do not read
+ // back in due to ArrayOutOfBoundExceptions.
+ // System.err.println("vamsasSeq backref: "+id+"");
+ // System.err.println(jds.getName()+"
+ // "+jds.getStart()+"-"+jds.getEnd()+" "+jds.getSequenceAsString());
+ // System.err.println("Hashcode: "+seqHash(jds));
+ // SequenceI rsq = (SequenceI) seqRefIds.get(id + "");
+ // System.err.println(rsq.getName()+"
+ // "+rsq.getStart()+"-"+rsq.getEnd()+" "+rsq.getSequenceAsString());
+ // System.err.println("Hashcode: "+seqHash(rsq));
}
else
{
pdb.setType(entry.getType());
AppJmol jmol;
- //This must have been loaded, is it still visible?
+ // This must have been loaded, is it still visible?
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int f = frames.length - 1; f > -1; f--)
{
}
}
- //SAVE TREES
- ///////////////////////////////////
+ // SAVE TREES
+ // /////////////////////////////////
if (av.currentTree != null)
{
// FIND ANY ASSOCIATED TREES
}
}
- //SAVE ANNOTATIONS
+ // SAVE ANNOTATIONS
if (jal.getAlignmentAnnotation() != null)
{
jalview.datamodel.AlignmentAnnotation[] aa = jal
}
}
- //SAVE GROUPS
+ // SAVE GROUPS
if (jal.getGroups() != null)
{
JGroup[] groups = new JGroup[jal.getGroups().size()];
jms.setJGroup(groups);
}
- ///////////SAVE VIEWPORT
+ // /////////SAVE VIEWPORT
Viewport view = new Viewport();
view.setTitle(ap.alignFrame.getTitle());
view.setSequenceSetId(av.getSequenceSetId());
settingsAdded.addElement(renderOrder[ro]);
}
- //Make sure we save none displayed feature settings
+ // Make sure we save none displayed feature settings
Enumeration en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours
.keys();
while (en.hasMoreElements())
object.setJalviewModelSequence(jms);
object.getVamsasModel().addSequenceSet(vamsasSet);
- if (jout!=null && fileName!=null)
+ if (jout != null && fileName != null)
{
- //We may not want to write the object to disk,
- //eg we can copy the alignViewport to a new view object
- //using save and then load
+ // We may not want to write the object to disk,
+ // eg we can copy the alignViewport to a new view object
+ // using save and then load
try
{
JarEntry entry = new JarEntry(fileName);
jout.putNextEntry(entry);
PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout,
- "UTF-8"));
- org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(pout);
+ "UTF-8"));
+ org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(
+ pout);
marshaller.marshal(object);
pout.flush();
jout.closeEntry();
}
else
{
- vamsasSeq.setDsseqid(id); // so we can tell which sequences really are dataset sequences only
+ vamsasSeq.setDsseqid(id); // so we can tell which sequences really are
+ // dataset sequences only
dbrefs = jds.getDBRef();
}
if (dbrefs != null)
&& (parentseq != jmp.getTo() || parentseq
.getDatasetSequence() != jmp.getTo()))
{
- mpc.setSequence(createVamsasSequence(false, seqHash(jmp.getTo())
- , jmp.getTo(), jds));
+ mpc.setSequence(createVamsasSequence(false, seqHash(jmp.getTo()),
+ jmp.getTo(), jds));
}
else
{
/**
* DOCUMENT ME!
- *
- * @param file DOCUMENT ME!
+ *
+ * @param file
+ * DOCUMENT ME!
*/
public AlignFrame LoadJalviewAlign(final String file)
{
try
{
- //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING
+ // UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING
URL url = null;
if (file.startsWith("http://"))
}
else if (jarentry != null)
{
- //Some other file here.
+ // Some other file here.
entryCount++;
}
} while (jarentry != null);
{
System.err.println("Parsing as Jalview Version 2 file failed.");
ex.printStackTrace(System.err);
-
- //Is Version 1 Jar file?
- try {
+
+ // Is Version 1 Jar file?
+ try
+ {
af = new Jalview2XML_V1(raiseGUI).LoadJalviewAlign(file);
- } catch (Exception ex2) {
+ } catch (Exception ex2)
+ {
System.err.println("Exception whilst loading as jalviewXMLV1:");
ex2.printStackTrace();
af = null;
{
final String finalErrorMessage = errorMessage;
if (raiseGUI)
- {
+ {
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
- {
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- finalErrorMessage, "Error loading Jalview file",
- JOptionPane.WARNING_MESSAGE);
- }
- });
- } else {
- System.err.println("Problem loading Jalview file: "+errorMessage);
- }
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ finalErrorMessage, "Error loading Jalview file",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ });
+ }
+ else
+ {
+ System.err.println("Problem loading Jalview file: " + errorMessage);
+ }
}
return af;
{
out.println(data);
}
- try { out.flush(); } catch (Exception foo) {};
+ try
+ {
+ out.flush();
+ } catch (Exception foo)
+ {
+ }
+ ;
out.close();
alreadyLoadedPDB.put(pdbId, outFile.getAbsolutePath());
Viewport view = jms.getViewport(0);
- //////////////////////////////////
- //LOAD SEQUENCES
+ // ////////////////////////////////
+ // LOAD SEQUENCES
Vector hiddenSeqs = null;
jalview.datamodel.Sequence jseq;
boolean multipleView = false;
JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
- int vi=0; // counter in vamsasSeq array
+ int vi = 0; // counter in vamsasSeq array
for (int i = 0; i < JSEQ.length; i++)
{
String seqId = JSEQ[i].getId() + "";
jseq.setStart(JSEQ[i].getStart());
jseq.setEnd(JSEQ[i].getEnd());
jseq.setVamsasId(uniqueSetSuffix + seqId);
- seqRefIds.put(vamsasSeq[vi].getId()+"", jseq);
+ seqRefIds.put(vamsasSeq[vi].getId() + "", jseq);
tmpseqs.add(jseq);
vi++;
}
}
- ///
+ // /
// Create the alignment object from the sequence set
- /////////////////////////////////
+ // ///////////////////////////////
jalview.datamodel.Sequence[] orderedSeqs = new jalview.datamodel.Sequence[tmpseqs
.size()];
jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(
orderedSeqs);
- /// Add the alignment properties
+ // / Add the alignment properties
for (int i = 0; i < vamsasSet.getSequenceSetPropertiesCount(); i++)
{
SequenceSetProperties ssp = vamsasSet.getSequenceSetProperties(i);
al.setProperty(ssp.getKey(), ssp.getValue());
}
- ///
+ // /
// SequenceFeatures are added to the DatasetSequence,
// so we must create or recover the dataset before loading features
- /////////////////////////////////
+ // ///////////////////////////////
if (vamsasSet.getDatasetId() == null || vamsasSet.getDatasetId() == "")
{
// older jalview projects do not have a dataset id.
{
recoverDatasetFor(vamsasSet, al);
}
- /////////////////////////////////
+ // ///////////////////////////////
Hashtable pdbloaded = new Hashtable();
if (!multipleView)
}
}
- /////////////////////////////////
+ // ///////////////////////////////
// LOAD SEQUENCE MAPPINGS
if (vamsasSet.getAlcodonFrameCount() > 0)
{
SequenceI dnaseq = (SequenceI) seqRefIds
.get(maps[m].getDnasq());
// Load Mapping
+ jalview.datamodel.Mapping mapping = null;
// attach to dna sequence reference.
+ if (maps[m].getMapping() != null)
+ {
+ mapping = addMapping(maps[m].getMapping());
+ }
if (dnaseq != null)
{
- if (maps[m].getMapping() != null)
- {
- jalview.datamodel.Mapping mapping = addMapping(maps[m]
- .getMapping());
- cf.addMap(dnaseq, mapping.getTo(), mapping.getMap());
- }
+ cf.addMap(dnaseq, mapping.getTo(), mapping.getMap());
+ }
+ else
+ {
+ // defer to later
+ frefedSequence.add(new Object[]
+ { maps[m].getDnasq(), cf, mapping });
}
}
}
}
- //////////////////////////////////
- //LOAD ANNOTATIONS
+ // ////////////////////////////////
+ // LOAD ANNOTATIONS
boolean hideQuality = true, hideConservation = true, hideConsensus = true;
if (vamsasSet.getAnnotationCount() > 0)
.getSecondaryStructure() == null || ae[aa]
.getSecondaryStructure().length() == 0) ? ' ' : ae[aa]
.getSecondaryStructure().charAt(0), ae[aa].getValue()
-
+
);
- // JBPNote: Consider verifying dataflow for IO of secondary structure annotation read from Stockholm files
- // this was added to try to ensure that
- //if (anot[ae[aa].getPosition()].secondaryStructure>' ')
- //{
- // anot[ae[aa].getPosition()].displayCharacter = "";
- //}
+ // JBPNote: Consider verifying dataflow for IO of secondary
+ // structure annotation read from Stockholm files
+ // this was added to try to ensure that
+ // if (anot[ae[aa].getPosition()].secondaryStructure>' ')
+ // {
+ // anot[ae[aa].getPosition()].displayCharacter = "";
+ // }
anot[ae[aa].getPosition()].colour = new java.awt.Color(ae[aa]
.getColour());
}
}
}
- /////////////////////////
- //LOAD GROUPS
+ // ///////////////////////
+ // LOAD GROUPS
if (jms.getJGroupCount() > 0)
{
JGroup[] groups = jms.getJGroup();
}
}
- /////////////////////////////////
+ // ///////////////////////////////
// LOAD VIEWPORT
AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());
new java.awt.Color(JSEQ[i].getColour()));
}
- //If we just load in the same jar file again, the sequenceSetId
- //will be the same, and we end up with multiple references
- //to the same sequenceSet. We must modify this id on load
- //so that each load of the file gives a unique id
+ // If we just load in the same jar file again, the sequenceSetId
+ // will be the same, and we end up with multiple references
+ // to the same sequenceSet. We must modify this id on load
+ // so that each load of the file gives a unique id
String uniqueSeqSetId = view.getSequenceSetId() + uniqueSetSuffix;
af.viewport.gatherViewsHere = view.getGatheredViews();
}
else if (view.getBgColour().startsWith("Annotation"))
{
- //int find annotation
+ // int find annotation
for (int i = 0; i < af.viewport.alignment.getAlignmentAnnotation().length; i++)
{
if (af.viewport.alignment.getAlignmentAnnotation()[i].label
continue;
}
- /* if (view.getAnnotationColours().getColourScheme().equals("None"))
- {
- sg.cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
- new java.awt.Color(view.getAnnotationColours().
- getMinColour()),
- new java.awt.Color(view.getAnnotationColours().
- getMaxColour()),
- view.getAnnotationColours().getAboveThreshold());
- }
- else*/
+ /*
+ * if
+ * (view.getAnnotationColours().getColourScheme().equals("None")) {
+ * sg.cs = new AnnotationColourGradient(
+ * af.viewport.alignment.getAlignmentAnnotation()[i], new
+ * java.awt.Color(view.getAnnotationColours(). getMinColour()),
+ * new java.awt.Color(view.getAnnotationColours().
+ * getMaxColour()),
+ * view.getAnnotationColours().getAboveThreshold()); } else
+ */
{
sg.cs = new AnnotationColourGradient(
af.viewport.alignment.getAlignmentAnnotation()[i],
for (int c = 0; c < view.getHiddenColumnsCount(); c++)
{
af.viewport.hideColumns(view.getHiddenColumns(c).getStart(), view
- .getHiddenColumns(c).getEnd() //+1
+ .getHiddenColumns(c).getEnd() // +1
);
}
}
Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view
.getHeight());
- //LOAD TREES
- ///////////////////////////////////////
+ // LOAD TREES
+ // /////////////////////////////////////
if (loadTreesAndStructures && jms.getTreeCount() > 0)
{
try
}
}
- ////LOAD STRUCTURES
+ // //LOAD STRUCTURES
if (loadTreesAndStructures)
{
for (int i = 0; i < JSEQ.length; i++)
int height = ids[p].getStructureState(s).getHeight();
java.awt.Component comp = null;
-
+
JInternalFrame[] frames = null;
- do {
- try {
+ do
+ {
+ try
+ {
frames = Desktop.desktop.getAllFrames();
- }
- catch (ArrayIndexOutOfBoundsException e)
+ } catch (ArrayIndexOutOfBoundsException e)
{
// occasional No such child exceptions are thrown here...
frames = null;
- try {
+ try
+ {
Thread.sleep(10);
- } catch (Exception f) {};
+ } catch (Exception f)
+ {
+ }
+ ;
}
- } while (frames==null);
+ } while (frames == null);
for (int f = 0; f < frames.length; f++)
{
if (frames[f] instanceof AppJmol)
al.setDataset(ds);
}
}
-
/**
*
- * @param vamsasSeq sequence definition to create/merge dataset sequence for
- * @param ds dataset alignment
- * @param dseqs vector to add new dataset sequence to
+ * @param vamsasSeq
+ * sequence definition to create/merge dataset sequence for
+ * @param ds
+ * dataset alignment
+ * @param dseqs
+ * vector to add new dataset sequence to
*/
- private void ensureJalviewDatasetSequence(Sequence vamsasSeq, AlignmentI ds, Vector dseqs)
+ private void ensureJalviewDatasetSequence(Sequence vamsasSeq,
+ AlignmentI ds, Vector dseqs)
{
- jalview.datamodel.Sequence sq = (jalview.datamodel.Sequence) seqRefIds.get(vamsasSeq.getId());
+ // JBP TODO: Check this is called for AlCodonFrames to support recovery of
+ // xRef Codon Maps
+ jalview.datamodel.Sequence sq = (jalview.datamodel.Sequence) seqRefIds
+ .get(vamsasSeq.getId());
jalview.datamodel.SequenceI dsq = null;
- if (sq!=null && sq.getDatasetSequence()!=null)
+ if (sq != null && sq.getDatasetSequence() != null)
{
dsq = (jalview.datamodel.SequenceI) sq.getDatasetSequence();
}
-
+
String sqid = vamsasSeq.getDsseqid();
- if (dsq==null)
+ if (dsq == null)
{
// need to create or add a new dataset sequence reference to this sequence
if (sqid != null)
seqRefIds.put(sqid, dsq);
if (ds == null)
{
- if (dseqs!=null)
+ if (dseqs != null)
{
dseqs.addElement(dsq);
}
{
ds.addSequence(dsq);
}
- } else {
- if (sq!=dsq)
- { // make this dataset sequence sq's dataset sequence
+ }
+ else
+ {
+ if (sq != dsq)
+ { // make this dataset sequence sq's dataset sequence
sq.setDatasetSequence(dsq);
}
}
}
// TODO: refactor this as a merge dataset sequence function
- // now check that sq (the dataset sequence) sequence really is the union of all references to it
- //boolean pre = sq.getStart() < dsq.getStart();
- //boolean post = sq.getEnd() > dsq.getEnd();
- //if (pre || post)
- if (sq!=dsq)
+ // now check that sq (the dataset sequence) sequence really is the union of
+ // all references to it
+ // boolean pre = sq.getStart() < dsq.getStart();
+ // boolean post = sq.getEnd() > dsq.getEnd();
+ // if (pre || post)
+ if (sq != dsq)
{
StringBuffer sb = new StringBuffer();
String newres = jalview.analysis.AlignSeq.extractGaps(
jalview.util.Comparison.GapChars, sq.getSequenceAsString());
- if (!newres.equalsIgnoreCase(dsq.getSequenceAsString()) && newres.length()>dsq.getLength())
+ if (!newres.equalsIgnoreCase(dsq.getSequenceAsString())
+ && newres.length() > dsq.getLength())
{
// Update with the longer sequence.
synchronized (dsq)
{
- /*if (pre)
- {
- sb.insert(0, newres
- .substring(0, dsq.getStart() - sq.getStart()));
- dsq.setStart(sq.getStart());
- }
- if (post)
- {
- sb.append(newres.substring(newres.length() - sq.getEnd()
- - dsq.getEnd()));
- dsq.setEnd(sq.getEnd());
- }
- */
- dsq.setSequence(sb.toString());
+ /*
+ * if (pre) { sb.insert(0, newres .substring(0, dsq.getStart() -
+ * sq.getStart())); dsq.setStart(sq.getStart()); } if (post) {
+ * sb.append(newres.substring(newres.length() - sq.getEnd() -
+ * dsq.getEnd())); dsq.setEnd(sq.getEnd()); }
+ */
+ dsq.setSequence(sb.toString());
}
- //TODO: merges will never happen if we 'know' we have the real dataset sequence - this should be detected when id==dssid
- System.err
- .println("DEBUG Notice: Merged dataset sequence"); // ("
- // + (pre ? "prepended" : "") + " "
- //+ (post ? "appended" : ""));
+ // TODO: merges will never happen if we 'know' we have the real dataset
+ // sequence - this should be detected when id==dssid
+ System.err.println("DEBUG Notice: Merged dataset sequence"); // ("
+ // + (pre ? "prepended" : "") + " "
+ // + (post ? "appended" : ""));
}
}
}
* local sequence definition
*/
Sequence ms = mc.getSequence();
- jalview.datamodel.Sequence djs=null;
+ jalview.datamodel.Sequence djs = null;
String sqid = ms.getDsseqid();
- if (sqid!=null && sqid.length()>0)
+ if (sqid != null && sqid.length() > 0)
{
/*
* recover dataset sequence
*/
djs = (jalview.datamodel.Sequence) seqRefIds.get(sqid);
- } else {
- System.err.println("Warning - making up dataset sequence id for DbRef sequence map reference");
- sqid = ((Object)ms).toString(); // make up a new hascode for undefined dataset sequence hash (unlikely to happen)
}
-
- if (djs==null) {
+ else
+ {
+ System.err
+ .println("Warning - making up dataset sequence id for DbRef sequence map reference");
+ sqid = ((Object) ms).toString(); // make up a new hascode for
+ // undefined dataset sequence hash
+ // (unlikely to happen)
+ }
+
+ if (djs == null)
+ {
/**
* make a new dataset sequence and add it to refIds hash
*/
- djs = new jalview.datamodel.Sequence(ms
- .getName(), ms.getSequence());
+ djs = new jalview.datamodel.Sequence(ms.getName(), ms
+ .getSequence());
djs.setStart(jmap.getMap().getToLowest());
djs.setEnd(jmap.getMap().getToHighest());
djs.setVamsasId(uniqueSetSuffix + sqid);
jmap.setTo(djs);
seqRefIds.put(sqid, djs);
-
+
}
jalview.bin.Cache.log.debug("about to recurse on addDBRefs.");
addDBRefs(djs, ms);
-
+
}
}
return (jmap);
public jalview.gui.AlignmentPanel copyAlignPanel(AlignmentPanel ap,
boolean keepSeqRefs)
{
- jalview.schemabinding.version2.JalviewModel jm =
- SaveState(ap, null, null);
+ jalview.schemabinding.version2.JalviewModel jm = SaveState(ap, null,
+ null);
if (!keepSeqRefs)
{
af.alignPanels.clear();
af.closeMenuItem_actionPerformed(true);
- /* if(ap.av.alignment.getAlignmentAnnotation()!=null)
- {
- for(int i=0; i<ap.av.alignment.getAlignmentAnnotation().length; i++)
- {
- if(!ap.av.alignment.getAlignmentAnnotation()[i].autoCalculated)
- {
- af.alignPanel.av.alignment.getAlignmentAnnotation()[i] =
- ap.av.alignment.getAlignmentAnnotation()[i];
- }
- }
- } */
+ /*
+ * if(ap.av.alignment.getAlignmentAnnotation()!=null) { for(int i=0; i<ap.av.alignment.getAlignmentAnnotation().length;
+ * i++) { if(!ap.av.alignment.getAlignmentAnnotation()[i].autoCalculated) {
+ * af.alignPanel.av.alignment.getAlignmentAnnotation()[i] =
+ * ap.av.alignment.getAlignmentAnnotation()[i]; } } }
+ */
return af.alignPanel;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable
this.seqsToIds = null;
super.finalize();
}
-
+
}