import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.io.FastaFile;
import jalview.util.Comparison;
+import jalview.util.LinkedIdentityHashSet;
import jalview.util.MessageManager;
import java.util.ArrayList;
* @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
*/
@Override
- public SequenceGroup findGroup(SequenceI s)
+ public SequenceGroup findGroup(SequenceI seq, int position)
{
synchronized (groups)
{
- for (int i = 0; i < this.groups.size(); i++)
+ for (SequenceGroup sg : groups)
{
- SequenceGroup sg = groups.get(i);
-
- if (sg.getSequences(null).contains(s))
+ if (sg.getSequences(null).contains(seq))
{
- return sg;
+ if (position >= sg.getStartRes() && position <= sg.getEndRes())
+ {
+ return sg;
+ }
}
}
}
* jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
*/
@Override
- public int findIndex(SearchResults results)
+ public int findIndex(SearchResultsI results)
{
int i = 0;
private void resolveAndAddDatasetSeq(SequenceI currentSeq,
Set<SequenceI> seqs, boolean createDatasetSequence)
{
+ SequenceI alignedSeq = currentSeq;
if (currentSeq.getDatasetSequence() != null)
{
currentSeq = currentSeq.getDatasetSequence();
{
if (dbr.getMap() != null && dbr.getMap().getTo() != null)
{
+ if (dbr.getMap().getTo() == alignedSeq)
+ {
+ /*
+ * update mapping to be to the newly created dataset sequence
+ */
+ dbr.getMap().setTo(currentSeq);
+ }
if (dbr.getMap().getTo().getDatasetSequence() != null)
{
- throw new Error("Implementation error: Map.getTo() for dbref"
- + dbr + " is not a dataset sequence.");
- // TODO: if this happens, could also rewrite the reference to
- // point to new dataset sequence
+ throw new Error(
+ "Implementation error: Map.getTo() for dbref " + dbr
+ + " from " + curDs.getName()
+ + " is not a dataset sequence.");
}
// we recurse to add all forward references to dataset sequences via
// DBRefs/etc
return;
}
// try to avoid using SequenceI.equals at this stage, it will be expensive
- Set<SequenceI> seqs = new jalview.util.LinkedIdentityHashSet<SequenceI>();
+ Set<SequenceI> seqs = new LinkedIdentityHashSet<SequenceI>();
for (int i = 0; i < getHeight(); i++)
{
@Override
public String toString()
{
- return new FastaFile().print(getSequencesArray());
+ return new FastaFile().print(getSequencesArray(), true);
}
/**