import jalview.schemes.*;
-import jalview.gui.*;
-
import java.io.*;
import java.net.*;
*/
Hashtable viewportsAdded;
+ Hashtable annotationIds = new Hashtable();
+
String uniqueSetSuffix = "";
}
// USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW
- public void SaveAlignment(AlignFrame af, String jarFile,
+ public boolean SaveAlignment(AlignFrame af, String jarFile,
String fileName)
{
try
out.close();
jout.close();
+ return true;
}
catch (Exception ex)
{
ex.printStackTrace();
+ return false;
}
}
//SAVE SEQUENCES
int id = 0;
+ jalview.datamodel.SequenceI jds;
for (int i = 0; i < jal.getHeight(); i++)
{
- id = jal.getSequenceAt(i).hashCode();
+ jds = jal.getSequenceAt(i);
+ id = jds.hashCode();
if(seqRefIds.get(id+"")!=null)
{
{
vamsasSeq = new Sequence();
vamsasSeq.setId(id + "");
- vamsasSeq.setName(jal.getSequenceAt(i).getName());
- vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());
- vamsasSeq.setDescription(jal.getSequenceAt(i).getDescription());
+ vamsasSeq.setName(jds.getName());
+ vamsasSeq.setSequence(jds.getSequenceAsString());
+ vamsasSeq.setDescription(jds.getDescription());
- if (jal.getSequenceAt(i).getDatasetSequence().getDBRef() != null)
+ if (jds.getDatasetSequence().getDBRef() != null)
{
jalview.datamodel.DBRefEntry[] dbrefs =
- jal.getSequenceAt(i).getDatasetSequence().getDBRef();
+ jds.getDatasetSequence().getDBRef();
for (int d = 0; d < dbrefs.length; d++)
{
}
jseq = new JSeq();
- jseq.setStart(jal.getSequenceAt(i).getStart());
- jseq.setEnd(jal.getSequenceAt(i).getEnd());
- jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());
+ jseq.setStart(jds.getStart());
+ jseq.setEnd(jds.getEnd());
+ jseq.setColour( av.getSequenceColour(jds).getRGB());
jseq.setId(id);
if (av.hasHiddenRows)
{
- jseq.setHidden(av.alignment.getHiddenSequences().isHidden(
- jal.getSequenceAt(i)));
+ jseq.setHidden(av.alignment.getHiddenSequences().isHidden(jds));
- if(jal.getSequenceAt(i).getHiddenSequences()!=null)
+ if(av.hiddenRepSequences!=null
+ && av.hiddenRepSequences.containsKey(jal.getSequenceAt(i)))
{
- jalview.datamodel.SequenceI [] reps =
- jal.getSequenceAt(i).getHiddenSequences().getSequencesInOrder(jal);
+ jalview.datamodel.SequenceI[] reps =
+ ( (jalview.datamodel.SequenceGroup)
+ av.hiddenRepSequences.get(
+ jal.getSequenceAt(i))).getSequencesInOrder(jal);
for(int h=0; h<reps.length; h++)
{
- jseq.addHiddenSequences(
- jal.findIndex(reps[h])
- );
+ if (reps[h] != jal.getSequenceAt(i))
+ jseq.addHiddenSequences(
+ jal.findIndex(reps[h])
+ );
}
}
}
- if(jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures()!=null)
+ if(jds.getDatasetSequence().getSequenceFeatures()!=null)
{
jalview.datamodel.SequenceFeature[] sf
- = jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures();
+ = jds.getDatasetSequence().getSequenceFeatures();
int index = 0;
while(index < sf.length)
{
}
}
- if(jal.getSequenceAt(i).getDatasetSequence().getPDBId()!=null)
+ if(jds.getDatasetSequence().getPDBId()!=null)
{
- Enumeration en = jal.getSequenceAt(i).getDatasetSequence().getPDBId().elements();
+ Enumeration en = jds.getDatasetSequence().getPDBId().elements();
while(en.hasMoreElements())
{
Pdbids pdb = new Pdbids();
pdb.setId(entry.getId());
pdb.setType(entry.getType());
+
if(entry.getFile()!=null)
{
+ pdb.setFile(entry.getFile());
if(pdbfiles==null)
pdbfiles = new Vector();
-
if(!pdbfiles.contains(entry.getId()))
{
pdbfiles.addElement(entry.getId());
try
{
File file = new File(entry.getFile());
- if(file.exists())
+ if(file.exists() && jout!=null)
{
byte[] data = new byte[ (int) file.length()];
jout.putNextEntry(new JarEntry(entry.getId()));
{
Annotation an = new Annotation();
+ if(aa[i].annotationId!=null)
+ {
+ annotationIds.put(aa[i].annotationId, aa[i]);
+ }
+
+ an.setId(aa[i].annotationId);
+
if (aa[i].label.equals("Quality") ||
aa[i].label.equals("Conservation") ||
aa[i].label.equals("Consensus"))
groups[i].setDisplayBoxes(sg.getDisplayBoxes());
groups[i].setDisplayText(sg.getDisplayText());
groups[i].setColourText(sg.getColourText());
+ groups[i].setTextCol1(sg.textColour.getRGB());
+ groups[i].setTextCol2(sg.textColour2.getRGB());
+ groups[i].setTextColThreshold(sg.thresholdTextColour);
- for (int s = 0; s < sg.getSize(false); s++)
+ for (int s = 0; s < sg.getSize(); s++)
{
jalview.datamodel.Sequence seq =
(jalview.datamodel.Sequence) sg.getSequenceAt(s);
view.setShowBoxes(av.getShowBoxes());
view.setShowColourText(av.getColourText());
view.setShowFullId(av.getShowJVSuffix());
+ view.setRightAlignIds(av.rightAlignIds);
view.setShowSequenceFeatures(av.showSequenceFeatures);
view.setShowText(av.getShowText());
view.setWrapAlignment(av.getWrapAlignment());
+ view.setTextCol1(av.textColour.getRGB());
+ view.setTextCol2(av.textColour2.getRGB());
+ view.setTextColThreshold(av.thresholdTextColour);
+
if(av.featuresDisplayed!=null)
{
System.out.println("Successfully loaded archive file");
return af;
}
+ ex.printStackTrace();
System.err.println("Exception whilst loading jalview XML file : " +
ex + "\n");
String loadPDBFile(String file, String pdbId)
{
+ System.out.println(file +" "+pdbId);
try
{
JarInputStream jin = null;
ArrayList tmpseqs = new ArrayList();
-
boolean multipleView = false;
JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
jseq.setDescription(vamsasSeq[i].getDescription());
jseq.setStart(JSEQ[i].getStart());
jseq.setEnd(JSEQ[i].getEnd());
- jseq.setColor(new java.awt.Color(JSEQ[i].getColour()));
seqRefIds.put(vamsasSeq[i].getId(), jseq);
tmpseqs.add( jseq );
}
+
if (JSEQ[i].getHidden())
{
if (hiddenSeqs == null)
continue;
}
+ if (an[i].getId() != null
+ && annotationIds.containsKey(an[i].getId()))
+ {
+ al.addAnnotation(
+ (jalview.datamodel.AlignmentAnnotation)annotationIds.get(an[i].getId())
+ );
+
+ continue;
+ }
+
AnnotationElement[] ae = an[i].getAnnotationElement();
jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al.getWidth()];
- for (int aa = 0; aa < ae.length; aa++)
+ for (int aa = 0; aa < ae.length && aa<anot.length; aa++)
{
anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].getDisplayCharacter(),
ae[aa].getDescription(),
an[i].getDescription(), anot);
}
+ if(an[i].getId()!=null)
+ {
+ annotationIds.put(an[i].getId(), jaa);
+ jaa.annotationId = an[i].getId();
+ }
+
if(an[i].getSequenceRef()!=null)
{
jaa.createSequenceMapping(
sg.setOutlineColour(new java.awt.Color(
groups[i].getOutlineColour()));
+ sg.textColour = new java.awt.Color(groups[i].getTextCol1());
+ sg.textColour2 = new java.awt.Color(groups[i].getTextCol2());
+ sg.thresholdTextColour = groups[i].getTextColThreshold();
+
if (groups[i].getConsThreshold() != 0)
{
jalview.analysis.Conservation c = new jalview.analysis.Conservation("All",
- ResidueProperties.propHash, 3, sg.getSequences(false), 0,
+ ResidueProperties.propHash, 3, sg.getSequences(null), 0,
sg.getWidth() - 1);
c.calculate();
c.verdict(false, 25);
af.setFileName(file, "Jalview");
+ for (int i = 0; i < JSEQ.length; i++)
+ {
+ af.viewport.setSequenceColour(
+ af.viewport.alignment.getSequenceAt(i),
+ 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
{
for(int s=0; s<JSEQ.length; s++)
{
+ jalview.datamodel.SequenceGroup hidden =
+ new jalview.datamodel.SequenceGroup();
+
for(int r=0; r<JSEQ[s].getHiddenSequencesCount(); r++)
{
- al.getSequenceAt(s).addHiddenSequence(
- al.getSequenceAt( JSEQ[s].getHiddenSequences(r) )
+ hidden.addSequence(
+ al.getSequenceAt(JSEQ[s].getHiddenSequences(r))
+ , false
);
}
+ af.viewport.hideRepSequences(al.getSequenceAt(s), hidden);
}
jalview.datamodel.SequenceI [] hseqs = new
af.alignPanel.adjustAnnotationHeight();
}
- af.viewport.viewName = view.getViewName();
+ if(view.getViewName()!=null)
+ {
+ af.viewport.viewName = view.getViewName();
+ af.setInitialTabVisible();
+ }
af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),
view.getHeight());
- af.viewport.setStartRes(view.getStartRes());
- af.viewport.setStartSeq(view.getStartSeq());
+
af.viewport.setShowAnnotation(view.getShowAnnotation());
af.viewport.setAbovePIDThreshold(view.getPidSelected());
af.viewport.setConservationSelected(view.getConservationSelected());
af.viewport.setShowJVSuffix(view.getShowFullId());
+ af.viewport.rightAlignIds=view.getRightAlignIds();
af.viewport.setFont(new java.awt.Font(view.getFontName(),
view.getFontStyle(), view.getFontSize()));
af.alignPanel.fontChanged();
af.viewport.setShowText(view.getShowText());
+ af.viewport.textColour = new java.awt.Color(view.getTextCol1());
+ af.viewport.textColour2 = new java.awt.Color(view.getTextCol2());
+ af.viewport.thresholdTextColour = view.getTextColThreshold();
+
+ af.viewport.setStartRes(view.getStartRes());
+ af.viewport.setStartSeq(view.getStartSeq());
ColourSchemeI cs = null;
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];
+ }
+ }
+ } */
+
return af.alignPanel;
}
}