package jalview.ext.ensembl;
+import jalview.analysis.AlignmentUtils;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
peptide = peptide.getDatasetSequence();
}
- mapExonFeaturesToProtein(dnaSeq, peptide, dnaToProtein);
+ AlignmentUtils.transferFeatures(dnaSeq, peptide, dnaToProtein,
+ SequenceOntology.EXON);
LinkedHashMap<Integer, String[][]> variants = buildDnaVariantsMap(
dnaSeq, dnaToProtein);
}
/**
- * Transfers exon features to the corresponding mapped regions of the protein
- * sequence. This is useful because it allows visualisation of exon boundaries
- * on the peptide (using 'colour by label' for the exon name). Returns the
- * number of features written.
- *
- * @param dnaSeq
- * @param peptide
- * @param dnaToProtein
- */
- static int mapExonFeaturesToProtein(SequenceI dnaSeq, SequenceI peptide,
- MapList dnaToProtein)
- {
- SequenceFeature[] sfs = dnaSeq.getSequenceFeatures();
- if (sfs == null)
- {
- return 0;
- }
-
- SequenceOntology so = SequenceOntology.getInstance();
- int count = 0;
-
- for (SequenceFeature sf : sfs)
- {
- if (so.isA(sf.getType(), SequenceOntology.EXON))
- {
- int start = sf.getBegin();
- int end = sf.getEnd();
- int[] mapsTo = dnaToProtein.locateInTo(start, end);
- if (mapsTo != null)
- {
- SequenceFeature copy = new SequenceFeature(SequenceOntology.EXON,
- sf.getDescription(), mapsTo[0], mapsTo[1], 0f, null);
- peptide.addSequenceFeature(copy);
- count++;
- }
- }
- }
- return count;
- }
-
- /**
* Builds a map whose key is position in the protein sequence, and value is an
* array of all variants for the coding codon positions
*