Package com.affymetrix.genoviz.bioviews

Examples of com.affymetrix.genoviz.bioviews.GlyphI


     * @return a GlyphI
     * @see     com.affymetrix.genoviz.glyph.StretchContainerGlyph
     * @see     com.affymetrix.genoviz.bioviews.GlyphI
     */
    GlyphI getSummaryGlyph(Collection<GlyphI> glyphsToSummarize) {
        GlyphI summaryGlyph = new StretchContainerGlyph();
    int[] transitions = determineTransitions(glyphsToSummarize);
    int[] unique_transitions = determineUniqueTransitions(transitions);
        int segCount = unique_transitions.length - 1;
        for (int i = 0; i < segCount; i++) {
            /**
             * Construct a glyph summarySegment for every sequential pair of transition points,
             *    with x = array[i] and width = array[i+1] - array[i],
             *    and y = FLOAT_MIN/2 and height = FLOAT_MAX (???)
             */
            int segStart = unique_transitions[i];
            int segEnd = unique_transitions[i + 1];

            GlyphI newgl = new FillRectGlyph();
            newgl.setColor(glyph_color);

      int hitCount = determineGlyphHits(glyphsToSummarize, segEnd, segStart);

            /**
             * reset y = 0 and height = # of hits
             */
            //      newgl.setCoords(segStart, 0, segEnd - segStart, hitCount);
            // just hardwiring height multiple till get normalization code implemented
            //      newgl.setCoords(segStart, 0, segEnd - segStart, hitCount*10);
            // if want to filter out regions with no hits, uncomment out conditional
            newgl.setCoords(segStart, -hitCount * scale_factor, segEnd - segStart, hitCount * scale_factor);
      summaryGlyph.addChild(newgl);
        }

        /**
         * 5) normalize height somehow...
View Full Code Here


        ExpandedTierPacker epack = (ExpandedTierPacker) sumTier.getExpandedPacker();
        epack.setMoveType(ExpandedTierPacker.DOWN);
        GlyphSummarizer summer = new GlyphSummarizer(col_exon_summary);
        if (exonGlyphs.size() > 0) {
            GlyphI gl = summer.getSummaryGlyph(exonGlyphs);
            sumTier.addChild(gl);
        }
        seqmap.addTier(sumTier);
        seqmap.repack();
View Full Code Here

        MutableSeqSymmetry annot2genome = new SimpleMutableSeqSymmetry();
        copyToMutable(mrna2genome, annot2genome);

        SeqUtils.transformSymmetry(annot2genome, path2view);
    GlyphI tGlyph = glyphifyExons(mrna2genome, annot2genome, childcount);
        tier.addChild(tGlyph);
    BioSeq mrna = SeqUtils.getOtherSpan(mrna2genome, mrna2genome.getSpan(gseq)).getBioSeq();
    displayAssociatedmRNAforTranscript(mrna, path2view, mrna2genome, tier, tGlyph);
    }
View Full Code Here

   * @param childcount - exon count
   * @return
   */
  private GlyphI glyphifyExons(
      SeqSymmetry mrna2genome, MutableSeqSymmetry annot2genome, int childcount) {
    GlyphI tGlyph = new LineContainerGlyph();
    seqmap.setDataModel(tGlyph, mrna2genome);
    SeqSpan tSpan = annot2genome.getSpan(vseq);
    tGlyph.setCoords(tSpan.getMin(), 0, tSpan.getLength(), 20);
    tGlyph.setColor(col_ts);
    for (int i = 0; i < childcount; i++) {
      SeqSymmetry exon2genome = annot2genome.getChild(i);
      SeqSpan gSpan = exon2genome.getSpan(vseq);
      GlyphI cglyph = new OutlineRectGlyph();
      seqmap.setDataModel(cglyph, exon2genome);
      // can't give this a type and therefore signal
      // to the selection logic that this is first class selectable
      // object
      // so let's put it in a list
      exonList.add(exon2genome);
      cglyph.setColor(col_ts);
      cglyph.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
      exonGlyphs.add(cglyph);
      tGlyph.addChild(cglyph);
      //  testing display of "exon segments" for transcripts that have
      //     base inserts relative to the genomic sequence
      //  haven't dealt with display of base deletions in transcript relative to genomic yet
      //  if exon is segmented by inserts, then it will have children
      //     that specify this segmentation
      for (int seg_index = 0; seg_index < exon2genome.getChildCount(); seg_index++) {
        SeqSymmetry eseg2genome = exon2genome.getChild(seg_index);
        SeqSpan seg_gspan = eseg2genome.getSpan(vseq);
        if (seg_gspan.getLength() == 0) {
          // only mark the inserts (those whose genomic extent is zero
          GlyphI segGlyph = new OutlineRectGlyph();
          segGlyph.setColor(col_bg);
          segGlyph.setCoords(seg_gspan.getMin(), 0, seg_gspan.getLength(), 25);
          tGlyph.addChild(segGlyph);
        }
      }
    }
    return tGlyph;
View Full Code Here

      amino_acid = protein.getResidues(0, protein.getLength());
    }catch(Exception ex){
      System.out.println("*** Warning: No amino acid found ");
    }

        GlyphI aGlyph = new LineContainerGlyph();
        SeqSpan aSpan = annot2genome.getSpan(vseq);
        aGlyph.setCoords(aSpan.getMin(), 0, aSpan.getLength(), 20);
        aGlyph.setColor(col_ts);
        seqmap.setDataModel(aGlyph, annot2mrna);
    glyphifyCDSs(annot2genome, protein, aGlyph, amino_acid, vseq);
        trans_parent.addChild(aGlyph);
    displayAssociatedmRNAforProtein(protein, path2view, annot2mrna, tier);
    }
View Full Code Here

    int prev_amino_end = 0;
    int prev_add = 0;
    for (int j = 0; j < cdsCount; j++) {
      SeqSymmetry cds2genome = annot2genome.getChild(j);
      SeqSpan gSpan = cds2genome.getSpan(vseq);
      GlyphI cglyph = new FillRectGlyph();
      //SeqSpan protSpan = cds2genome.getSpan(protein);
      // coloring based on frame
      colorByFrame(cglyph, gSpan.getMin() + prev_add);
      prev_add += 3 - (gSpan.getLength() % 3)//Keep a track of no of complete amino acid added.
      cglyph.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
      aGlyph.addChild(cglyph);
      if (amino_acid != null) {
        SequenceGlyph sg = new ColoredResiduesGlyph(false);
        int start = prev_amino_end;
        int end = start + gSpan.getLength();
        String sub_amino_acid = amino_acid.substring(start, end);
        prev_amino_end += gSpan.getLength();
        sg.setResidues(sub_amino_acid);
        sg.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
        sg.setForegroundColor(col_amino_acid);
        sg.setBackgroundColor(cglyph.getBackgroundColor());
        aGlyph.addChild(sg);
      }
    }
  }
View Full Code Here

        SeqUtils.transformSymmetry(annot2genome, path2view);
        if (DEBUG_PROTEIN_ANNOTS) {
            SeqUtils.printSymmetry(annot2genome);
        }

        GlyphI aGlyph = new LineContainerGlyph();
        seqmap.setDataModel(aGlyph, annot2protein);

        SeqSpan aSpan = annot2genome.getSpan(vseq);
        aGlyph.setCoords(aSpan.getMin(), 0, aSpan.getLength(), 20);
        // will return a color from the prefs for the protein annotation
        // span -- or else the default - col_domain
        Color color = pick_color_for_domain(aSpan, prefs_hash);
        aGlyph.setColor(color);

        // for now, need to descend two levels because that is depth of path --
        //    eventually will use some sort of flattening method (probably
        //    first set up as part of SeqUtils)
        int count1 = annot2genome.getChildCount();
        for (int i = 0; i < count1; i++) {

            SeqSymmetry child = annot2genome.getChild(i);
            int count2 = child.getChildCount();

            // reach "back" and get actual symmetry (rather than transformed symmetry)
            //   really need some sort of tracking in transform mechanism to associate calculated
            //   symmetries with original symmetries that they map back to...
            SymWithProps original_child = (SymWithProps) annot2protein.getChild(i);

            for (int j = 0; j < count2; j++) {
                SeqSymmetry grandchild = child.getChild(j);
                SeqSpan gSpan = grandchild.getSpan(vseq);
                LabelledRectGlyph cglyph = new LabelledRectGlyph();
        if(i%2 == 0) {
          cglyph.setColor(color);
        }
        else {
          cglyph.setColor(color.darker());
        }

        String spanno = "Span " + String.valueOf(i+1) + " of ";
        String interpro = (String) ((SymWithProps)annot2protein).getProperty("InterPro Name");
        if(interpro != null){
          spanno += interpro;
        }
        cglyph.setText(spanno);
                cglyph.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
                aGlyph.addChild(cglyph);
                seqmap.setDataModel(cglyph, original_child);
                original_child.setProperty("type", "protspan");
            }
        }
        tier.addChild(aGlyph);
View Full Code Here

            filterGlyphs(candidates, prev_glyphs);
        }
    filterGlyphs(candidates, clicked_glyphs);

        List<GlyphI> to_return = new ArrayList<GlyphI>();
        GlyphI champion = null;
        Rectangle2D candidate_box;
        double champion_end = 0;
        double champion_start = 0;
        double candidate_end = 0;
        double candidate_start = 0;
        for (GlyphI candidate : candidates) {
            // we want everything
            if (multiselect) {
                to_return.add(candidate);
            } // we just want the topmost GlyphI
            // to figure out what Glyph is on top we have to think about geometry
            else {
                candidate_box = candidate.getCoordBox();
                candidate_start = candidate_box.getX();
                candidate_end = candidate_box.getX() + candidate_box.getWidth();
                // note: if champion is null, we're on the first Glyph - so let the
                // candidate be the champion for now
                if (champion == null
                        || (candidate_end < champion_end && candidate_start >= champion_start)
                        || (candidate_end <= champion_end && candidate_start > champion_start)
                        || // we leave the most computationally intensive test for last
                        (champion.getChildren() != null && champion.getChildren().contains(candidate))) {
                    champion = candidate;
                    champion_start = candidate_start;
                    champion_end = candidate_end;
                }
            }
View Full Code Here

TOP

Related Classes of com.affymetrix.genoviz.bioviews.GlyphI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.