*/
public SequenceI findAlignedSequence(SequenceI seq, AlignmentI al)
{
+ return findAlignedSequence(seq, al, null);
+ }
+ /**
+ * Convenience method to return the first aligned sequence in the given
+ * alignment whose dataset has a mapping with the given (aligned or dataset)
+ * sequence, and optionally the mapping that relates them
+ *
+ * @param seq
+ * @param al
+ * @param map - list to add the mapping to
+ * @return sequence from al that maps to seq
+ */
+ public SequenceI findAlignedSequence(SequenceI seq, AlignmentI al,List<SequenceToSequenceMapping> map)
+ {
/*
* Search mapped protein ('to') sequences first.
*/
{
for (SequenceI sourceAligned : al.getSequences())
{
- if (ssm.mapping.to == sourceAligned.getDatasetSequence()
- || ssm.mapping.to == sourceAligned)
+ if (ssm.covers(sourceAligned,true))
{
+ if (map != null)
+ {
+ map.add(ssm);
+ }
return sourceAligned;
}
}
{
for (SequenceI sourceAligned : al.getSequences())
{
- if (ssm.fromSeq == sourceAligned.getDatasetSequence())
+ if (ssm.covers(sourceAligned,true))
{
+ if (map != null)
+ {
+ map.add(ssm);
+ }
return sourceAligned;
}
}