+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io.gff;
import jalview.datamodel.AlignedCodonFrame;
*/
SequenceI mapFromSequence = seq;
SequenceI mapToSequence = mappedSequence;
- if ((type == MappingType.NucleotideToPeptide && featureIsOnTarget)
- || (type == MappingType.PeptideToNucleotide && !featureIsOnTarget))
+ if ((MappingType.isDnaToPeptide(type) && featureIsOnTarget)
+ || (MappingType.isPeptideToDna(type) && !featureIsOnTarget))
{
mapFromSequence = mappedSequence;
mapToSequence = seq;
{
fromStart = alignToStart;
toStart = alignFromStart;
- toEnd = forwardStrand ? toStart + alignCount - 1 : toStart
- - (alignCount - 1);
+ toEnd = forwardStrand ? toStart + alignCount - 1
+ : toStart - (alignCount - 1);
int toLength = Math.abs(toEnd - toStart) + 1;
int fromLength = toLength * type.getFromRatio() / type.getToRatio();
fromEnd = fromStart + fromLength - 1;
}
/**
- * Returns a MappingType depending on the exonerate 'model' value.
+ * Returns a MappingType depending on the exonerate 'model' value
*
* @param model
* @return
{
MappingType result = null;
- if (model.contains(PROTEIN2DNA) || model.contains(PROTEIN2GENOME))
+ if (model.contains(PROTEIN2GENOME))
+ {
+ result = MappingType.PeptideToGenome;
+ }
+ else if (model.contains(PROTEIN2DNA))
+ {
+ result = MappingType.PeptideToCds;
+ }
+ else if (model.contains(CODING2GENOME))
{
- result = MappingType.PeptideToNucleotide;
+ result = MappingType.CdsToGenome;
}
- else if (model.contains(CODING2CODING) || model.contains(CODING2GENOME)
- || model.contains(CDNA2GENOME) || model.contains(GENOME2GENOME))
+ else if (model.contains(CDNA2GENOME))
{
- result = MappingType.NucleotideToNucleotide;
+ result = MappingType.CdnaToGenome;
+ }
+ else if (model.contains(CODING2CODING) || model.contains(GENOME2GENOME))
+ {
+ result = MappingType.GenomeToCdna;
}
return result;
}
return false;
}
+ /**
+ * An override to set feature group to "exonerate" instead of the default GFF
+ * source value (column 2)
+ */
@Override
protected SequenceFeature buildSequenceFeature(String[] gff,
Map<String, List<String>> set)
{
- SequenceFeature sf = super.buildSequenceFeature(gff, set);
- sf.setFeatureGroup("exonerate");
+ SequenceFeature sf = super.buildSequenceFeature(gff, TYPE_COL,
+ "exonerate", set);
return sf;
}