return findMappingsForSequenceAndOthers(sequence, mappings, null);
}
+ /**
+ * Returns a list of any mappings that are from or to the given (aligned or
+ * dataset) sequence, optionally limited to mappings involving one of a given
+ * list of sequences.
+ *
+ * @param sequence
+ * @param mappings
+ * @param filterList
+ * @return
+ */
public static List<AlignedCodonFrame> findMappingsForSequenceAndOthers(
SequenceI sequence, List<AlignedCodonFrame> mappings,
- AlignmentI alignment)
+ List<SequenceI> filterList)
{
List<AlignedCodonFrame> result = new ArrayList<AlignedCodonFrame>();
if (sequence == null || mappings == null)
{
if (mapping.involvesSequence(sequence))
{
- if (alignment != null)
+ if (filterList != null)
{
- for (SequenceI otherseq : alignment.getSequences())
+ for (SequenceI otherseq : filterList)
{
+ SequenceI otherDataset = otherseq.getDatasetSequence();
if (otherseq == sequence
- || (otherseq.getDatasetSequence() != null && (otherseq
- .getDatasetSequence() == sequence || otherseq
- .getDatasetSequence() == sequence
+ || otherseq == sequence.getDatasetSequence()
+ || (otherDataset != null && (otherDataset == sequence || otherDataset == sequence
.getDatasetSequence())))
{
// skip sequences in subset which directly relate to sequence