import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.FeatureProperties;
import jalview.datamodel.GraphLine;
import jalview.datamodel.Mapping;
for (s = 0; s < sSize; s++)
{
SequenceI newseq = translateCodingRegion(cdnaseqs.get(s),
- seqstring[s], viscontigs, acf, alignedCodons, gapCharacter,
+ seqstring[s], viscontigs, acf, alignedCodons, pepseqs,
+ gapCharacter,
false);
if (newseq != null)
* @param acf
* Definition of global ORF alignment reference frame
* @param alignedCodons
+ * @param proteinSeqs
* @param gapCharacter
* @param starForStop
* when true stop codons will translate as '*', otherwise as 'X'
*/
protected static SequenceI translateCodingRegion(SequenceI selection,
String seqstring, int[] viscontigs, AlignedCodonFrame acf,
- int[][] alignedCodons, char gapCharacter,
+ int[][] alignedCodons, List<SequenceI> proteinSeqs,
+ char gapCharacter,
final boolean starForStop)
{
List<int[]> skip = new ArrayList<int[]>();
final int compareCodonPos = Dna.compareCodonPos(cdp,
alignedCodons[aspos]);
// debug
- // System.out.println(seq + "/" + aa + " codons: "
- // + Arrays.deepToString(alignedCodons));
- // System.out
- // .println(("Compare " + Arrays.toString(cdp) + " at pos "
- // + aspos + " with "
- // + Arrays.toString(alignedCodons[aspos]) + " got " +
- // compareCodonPos));
+ System.out.println(seq + "/" + aa + " codons: "
+ + Arrays.deepToString(alignedCodons));
+ System.out
+ .println(("Compare " + Arrays.toString(cdp) + " at pos "
+ + aspos + " with "
+ + Arrays.toString(alignedCodons[aspos]) + " got " + compareCodonPos));
// end debug
switch (compareCodonPos)
{
* This codon should precede the mapped positions - need to insert a
* gap in all prior sequences.
*/
- acf.insertAAGap(aspos, gapCharacter);
+ insertAAGap(aspos, gapCharacter, alignedCodons, proteinSeqs);
findpos = false;
break;
// update maximum alignment width
// (we can do this without calling checkCodonFrameWidth because it was
// already done above)
+ System.out.println("aspos " + aspos + " >= " + acf.aaWidth);
acf.setAaWidth(aspos);
}
// ready for next translated reading frame alignment position (if any)
{ 1, resSize }, 3, 1);
transferCodedFeatures(selection, newseq, map, null, null);
- SequenceI rseq = newseq.deriveSequence(); // construct a dataset
- // sequence for our new
- // peptide, regardless.
- // store a mapping (this actually stores a mapping between the dataset
- // sequences for the two sequences
+
+ /*
+ * Construct a dataset sequence for our new peptide.
+ */
+ SequenceI rseq = newseq.deriveSequence();
+
+ /*
+ * Store a mapping (between the dataset sequences for the two
+ * sequences).
+ */
+ // SIDE-EFFECT: acf stores the aligned sequence reseq; to remove!
acf.addMap(selection, rseq, map);
return rseq;
}
}
/**
+ * Insert a gap into the aligned proteins and the codon mapping array.
+ *
+ * @param pos
+ * @param gapCharacter
+ * @param alignedCodons
+ * @param proteinSeqs
+ */
+ protected static void insertAAGap(int pos, char gapCharacter,
+ int[][] alignedCodons, List<SequenceI> proteinSeqs)
+ {
+ System.out.println("insertAAGap " + pos + "/" + proteinSeqs.size());
+ // aaWidth++;
+ for (SequenceI seq : proteinSeqs)
+ {
+ seq.insertCharAt(pos, gapCharacter);
+ }
+
+ // if (pos < aaWidth)
+ // {
+ // aaWidth++;
+ System.arraycopy(alignedCodons, pos, alignedCodons, pos + 1,
+ alignedCodons.length - pos - 1);
+ alignedCodons[pos] = null; // clear so new codon position can be marked.
+ // }
+ }
+
+ /**
* Check the codons array is big enough to accommodate the given position, if
* not resize it.
*
SequenceFeature[] sf = (dna.getDatasetSequence() != null ? dna
.getDatasetSequence() : dna).getSequenceFeatures();
Boolean fgstate;
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
- .selectRefs(dna.getDBRef(),
- jalview.datamodel.DBRefSource.DNACODINGDBS);
+ DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(),
+ DBRefSource.DNACODINGDBS);
if (dnarefs != null)
{
// intersect with pep