public Color getBackgroundBoxColor() {
   Color c = bgColorMap.get(state);
   if (state == State.TRANSLATION_START && transcript != null) {
     c = DrawableUtil.getStartCodonColor(transcript);
   }
   return c;
 }
  public Color getBackgroundBoxColor() {
    if (pos == targetNucleotide && tier == targetTier) return targetColor;
    int lowSeqSelect;
    int highSeqSelect;
    if (baseEditor instanceof BaseEditorPanel) {
      lowSeqSelect = ((BaseEditorPanel) baseEditor).selectLowPos();
      highSeqSelect = ((BaseEditorPanel) baseEditor).selectHighPos();
    } else {
      lowSeqSelect = -1;
      highSeqSelect = -1;
    }

    if (lowSeqSelect != -1 && highSeqSelect != -1 && pos >= lowSeqSelect && pos <= highSeqSelect) {
      return seqSelectColor;
    }

    int basePos = baseEditor.posToBasePair(pos);

    if (((BaseEditorPanel) baseEditor).isSequencingErrorPosition(basePos)) return shiftColor;

    if (isExon) {
      ExonI exon = null;
      if (currentFeature instanceof ExonI) exon = (ExonI) currentFeature;
      else if (currentFeature instanceof DrawableSeqFeature)
        exon = (ExonI) ((DrawableSeqFeature) currentFeature).getFeature();
      if (exon != null && exon.getTranscript() != null) {
        Transcript transcript = exon.getTranscript();
        int tss = (int) exon.getTranscript().getTranslationStart();
        if (basePos == tss
            || basePos == (tss + exon.getStrand())
            || basePos == (tss + (2 * exon.getStrand())))
          return DrawableUtil.getStartCodonColor(transcript);
        else {
          int tes = (int) transcript.getTranslationEnd();
          if (basePos == tes
              || basePos == (tes + exon.getStrand())
              || basePos == (tes + (2 * exon.getStrand()))) return Color.red;
          else {
            int shift_pos = (int) transcript.plus1FrameShiftPosition();
            if (basePos == shift_pos) return shiftColor;
            else {
              shift_pos = (int) transcript.minus1FrameShiftPosition();
              if (basePos == shift_pos) return shiftColor;
              else {
                int stop_pos = (int) transcript.readThroughStopPosition();
                if (basePos == stop_pos
                    || basePos == (stop_pos + exon.getStrand())
                    || basePos == (stop_pos + (2 * exon.getStrand()))) return Color.pink;
              }
            }
          }
        }
      }
      return transcriptColorList[transcriptColorIndex][exonColorIndex];
    }
    return null;
  }
Exemplo n.º 3
0
 public Vector collectShadows() {
   Vector shadowBoxes = new Vector();
   if (visibleDrawables == null) visibleDrawables = getVisibleDrawables();
   for (int i = 0; i < visibleDrawables.size(); i++) {
     Vector curVis = (Vector) visibleDrawables.elementAt(i);
     for (int j = 0; j < curVis.size(); j++) {
       Drawable dsf = (Drawable) curVis.elementAt(j);
       DrawableUtil.setBoxBounds(dsf, transformer, manager);
       shadowBoxes.addElement(dsf.getBoxBounds());
     }
   }
   return shadowBoxes;
 }