*/
package jalview.analysis;
-import static jalview.io.gff.GffConstants.CLINICAL_SIGNIFICANCE;
-
import jalview.commands.RemoveGapColCommand;
import jalview.datamodel.AlignedCodon;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.datamodel.features.SequenceFeatures;
-import jalview.io.gff.Gff3Helper;
import jalview.io.gff.SequenceOntologyI;
import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
import jalview.util.IntRangeComparator;
import jalview.util.MapList;
import jalview.util.MappingUtils;
-import jalview.util.StringUtils;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
cdsSeqs.add(cdsSeq);
- if (!dataset.getSequences().contains(cdsSeqDss))
- {
- // check if this sequence is a newly created one
- // so needs adding to the dataset
- dataset.addSequence(cdsSeqDss);
- }
-
/*
- * add a mapping from CDS to the (unchanged) mapped to range
+ * build the mapping from CDS to protein
*/
List<int[]> cdsRange = Collections
.singletonList(new int[]
MapList cdsToProteinMap = new MapList(cdsRange,
mapList.getToRanges(), mapList.getFromRatio(),
mapList.getToRatio());
- AlignedCodonFrame cdsToProteinMapping = new AlignedCodonFrame();
- cdsToProteinMapping.addMap(cdsSeqDss, proteinProduct,
- cdsToProteinMap);
- /*
- * guard against duplicating the mapping if repeating this action
- */
- if (!mappings.contains(cdsToProteinMapping))
+ if (!dataset.getSequences().contains(cdsSeqDss))
{
- mappings.add(cdsToProteinMapping);
+ /*
+ * if this sequence is a newly created one, add it to the dataset
+ * and made a CDS to protein mapping (if sequence already exists,
+ * CDS-to-protein mapping _is_ the transcript-to-protein mapping)
+ */
+ dataset.addSequence(cdsSeqDss);
+ AlignedCodonFrame cdsToProteinMapping = new AlignedCodonFrame();
+ cdsToProteinMapping.addMap(cdsSeqDss, proteinProduct,
+ cdsToProteinMap);
+
+ /*
+ * guard against duplicating the mapping if repeating this action
+ */
+ if (!mappings.contains(cdsToProteinMapping))
+ {
+ mappings.add(cdsToProteinMapping);
+ }
}
propagateDBRefsToCDS(cdsSeqDss, dnaSeq.getDatasetSequence(),
{
List<SequenceI> alignedSequences = alignedDatasets
.get(seq.getDatasetSequence());
+ if (alignedSequences.isEmpty())
+ {
+ /*
+ * defensive check - shouldn't happen! (JAL-3536)
+ */
+ continue;
+ }
SequenceI alignedSeq = alignedSequences.get(0);
/*