/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
package jalview.structure;
import jalview.analysis.AlignSeq;
-import jalview.api.AlignmentViewPanel;
import jalview.api.StructureSelectionManagerProvider;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
import jalview.io.AppletFormatAdapter;
import jalview.util.MappingUtils;
import jalview.util.MessageManager;
/*
* Set of any registered mappings between (dataset) sequences.
*/
- Set<AlignedCodonFrame> seqmappings = new LinkedHashSet<AlignedCodonFrame>();
+ public Set<AlignedCodonFrame> seqmappings = new LinkedHashSet<AlignedCodonFrame>();
private List<CommandListener> commandListeners = new ArrayList<CommandListener>();
resNum = tmp.resNumber;
if (tmp.alignmentMapping >= -1)
{
- // TODO (JAL-1836) address root cause: negative residue no in PDB file
+ // TODO (JAL-1836) address root cause: negative residue no in PDB
+ // file
mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
}
{
results = MappingUtils.buildSearchResults(seq, index,
seqmappings);
- }
+ }
if (handlingVamsasMo)
{
results.addResult(seq, index, index);
}
/**
- * Deregister each mapping in the set, unless there is still an alignment that
- * holds a reference to it. Note we do not update the set itself, as it may be
- * shared with an alignment view which is still open.
- *
- * @param set
- */
- public void deregisterMappings(Set<AlignedCodonFrame> set)
- {
- if (set != null)
- {
- for (AlignedCodonFrame acf : set)
- {
- deregisterMapping(acf);
- }
- }
- }
-
- /**
- * Remove the given mapping provided no alignment holds a reference to it
+ * Remove the given mapping
*
* @param acf
*/
public void deregisterMapping(AlignedCodonFrame acf)
{
- if (noReferencesTo(acf))
+ if (acf != null)
{
boolean removed = seqmappings.remove(acf);
if (removed && seqmappings.isEmpty())
}
/**
- * Answers true if no alignment holds a reference to the given mapping
- *
- * @param acf
- * @return
- */
- protected boolean noReferencesTo(AlignedCodonFrame acf)
- {
- AlignFrame[] frames = Desktop.getAlignFrames();
- if (frames == null)
- {
- return true;
- }
- for (AlignFrame af : frames)
- {
- for (AlignmentViewPanel ap : af.getAlignPanels())
- {
- AlignmentI al = ap.getAlignment();
- if (al != null && al.getCodonFrames().contains(acf))
- {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
* Add each of the given codonFrames to the stored set, if not aready present.
*
* @param set