.findMappingsForSequence(cdsSeq, mappings);
for (AlignedCodonFrame mapping : dnaMappings)
{
- SequenceI peptide = mapping.findAlignedSequence(cdsSeq, protein);
+ List<SequenceToSequenceMapping> foundMap=new ArrayList<>();
+ SequenceI peptide = mapping.findAlignedSequence(cdsSeq, protein,foundMap);
if (peptide != null)
{
final int peptideLength = peptide.getLength();
- Mapping map = mapping.getMappingBetween(cdsSeq, peptide);
+ Mapping map = foundMap.get(0).getMapping();
if (map != null)
{
MapList mapList = map.getMap();
*/
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.
*/
{
if (ssm.covers(sourceAligned,true))
{
+ if (map != null)
+ {
+ map.add(ssm);
+ }
return sourceAligned;
}
}
{
if (ssm.covers(sourceAligned,true))
{
+ if (map != null)
+ {
+ map.add(ssm);
+ }
return sourceAligned;
}
}