/**
* Return the corresponding aligned or dataset dna sequence for given amino
- * acid sequence, or null if not found. returns the sequence from
- * the first mapping found that involves the protein sequence.
+ * acid sequence, or null if not found. returns the sequence from the first
+ * mapping found that involves the protein sequence.
*
* @param aaSeqRef
* @return
* Two AlignedCodonFrame objects are equal if they hold the same ordered list
* of mappings
*
- * @see SequenceToSequenceMapping#
+ * @see SequenceToSequenceMapping#equals
*/
@Override
public boolean equals(Object obj)
return mappings;
}
- public SequenceToSequenceMapping getCoveringMapping(SequenceI cds,
- SequenceI peptide)
+ /**
+ * Returns the first mapping found which is between the two given sequences,
+ * and covers the full extent of both.
+ *
+ * @param seq1
+ * @param seq2
+ * @return
+ */
+ public SequenceToSequenceMapping getCoveringMapping(SequenceI seq1,
+ SequenceI seq2)
{
for (SequenceToSequenceMapping mapping : mappings)
{
- if (mapping.covers(peptide) && mapping.covers(cds))
+ if (mapping.covers(seq2) && mapping.covers(seq1))
{
return mapping;
}
import jalview.analysis.AlignmentSorter;
import jalview.api.AlignViewportI;
+import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
action = action.getUndoAction();
}
// TODO write this
- System.err.println("MappingUtils.mapCutOrPaste not yet implemented");
+ Cache.log.error("MappingUtils.mapCutOrPaste not yet implemented");
}
/**
{
for (AlignedCodonFrame acf : mappings)
{
- SequenceI mappedSeq = mappingToNucleotide ? acf.getDnaForAaSeq(seq)
- : acf.getAaForDnaSeq(seq);
- if (mappedSeq != null)
- {
for (SequenceI seq2 : mapTo.getSequences())
{
- if (seq2.getDatasetSequence() == mappedSeq)
+ /*
+ * the corresponding peptide / CDS is the one for which there is
+ * a complete ('covering') mapping to 'seq'
+ */
+ SequenceI peptide = mappingToNucleotide ? seq2 : seq;
+ SequenceI cds = mappingToNucleotide ? seq : seq2;
+ SequenceToSequenceMapping s2s = acf.getCoveringMapping(cds,
+ peptide);
+ if (s2s != null)
{
mappedOrder.add(seq2);
j++;
break;
}
}
- }
}
}