X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=326cc4ea6c8e5c921d0accd877acf2ed47042a6d;hb=02d6aa2077a261d41db77a0158f2b4b779a36398;hp=a4b99bfe453cecd5d0e6fc7b78190c83d92dc408;hpb=5cc7268518b8689fe212c481ea962a8afacc6d61;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index a4b99bf..326cc4e 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -128,6 +128,21 @@ public class AlignedCodonFrame */ public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map) { + addMap(dnaseq, aaseq, map, null); + } + + /** + * Adds a mapping between the dataset sequences for the associated dna and + * protein sequence objects + * + * @param dnaseq + * @param aaseq + * @param map + * @param mapFromId + */ + public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map, + String mapFromId) + { // JBPNote DEBUG! THIS ! // dnaseq.transferAnnotation(aaseq, mp); // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse())); @@ -155,6 +170,7 @@ public class AlignedCodonFrame * otherwise, add a new sequence mapping */ Mapping mp = new Mapping(toSeq, map); + mp.setMappedFromId(mapFromId); mappings.add(new SequenceToSequenceMapping(fromSeq, mp)); } @@ -472,7 +488,8 @@ public class AlignedCodonFrame for (SequenceToSequenceMapping ssm : mappings) { - if (ssm.mapping.to == protein) + if (ssm.mapping.to == protein + && ssm.mapping.getMap().getFromRatio() == 3) { ml = ssm.mapping.map; dnaSeq = ssm.fromSeq; @@ -702,7 +719,7 @@ public class AlignedCodonFrame } /** - * Returns the first mapping found that is from 'fromSeq' to 'toSeq', or null + * Returns the first mapping found that is between 'fromSeq' and 'toSeq', or null * if none found * * @param fromSeq @@ -713,12 +730,17 @@ public class AlignedCodonFrame */ public Mapping getMappingBetween(SequenceI fromSeq, SequenceI toSeq) { + SequenceI dssFrom = fromSeq.getDatasetSequence() == null ? fromSeq + : fromSeq.getDatasetSequence(); + SequenceI dssTo = toSeq.getDatasetSequence() == null ? toSeq : toSeq + .getDatasetSequence(); + for (SequenceToSequenceMapping mapping : mappings) { SequenceI from = mapping.fromSeq; SequenceI to = mapping.mapping.to; - if ((from == fromSeq || from == fromSeq.getDatasetSequence()) - && (to == toSeq || to == toSeq.getDatasetSequence())) + if ((from == dssFrom && to == dssTo) + || (from == dssTo && to == dssFrom)) { return mapping.mapping; }