[Biojava-dev] [Bug 2107] New: LabelledSequenceRenderer

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Sep 25 09:52:56 UTC 2006


http://bugzilla.open-bio.org/show_bug.cgi?id=2107

           Summary: LabelledSequenceRenderer
           Product: BioJava
           Version: 1.4
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: bio
        AssignedTo: biojava-dev at biojava.org
        ReportedBy: jolyon.holdstock at ogt.co.uk


Using a LabelledSequenceRenderer works as expected in a SequencePanel, but not
in TranslatedSequencePanel. In the latter the label is not displayed. Also
while 
sequence is displayed from the correct start point the actual sequence is 
incorrect. 

Below is some example code that demonstrates the problem.

//Example code --------------------------------------------------
//Java libraries
import java.awt.Color;
import java.awt.BorderLayout;
//Java extension libraries
import javax.swing.JFrame;
//BioJava libraries
import org.biojava.bio.BioException;
import org.biojava.utils.ChangeVetoException;
import org.biojava.bio.symbol.RangeLocation;
import org.biojava.bio.gui.sequence.SymbolSequenceRenderer;
import org.biojava.bio.seq.Sequence;
import org.biojava.bio.seq.DNATools;
import org.biojava.bio.gui.sequence.SequencePanel;
import org.biojava.bio.gui.sequence.TranslatedSequencePanel;
import org.biojava.bio.gui.sequence.LabelledSequenceRenderer;

public class TestSequencePanel extends JFrame {

  private Sequence seq;
  private SequencePanel sp;
  private TranslatedSequencePanel tsp;

  public TestSequencePanel(){
    try {
      //Create the SequencePanel and TranslatedSequencePanel
      sp = new SequencePanel();
      tsp = new TranslatedSequencePanel();

      //Create a DNA sequence
      seq =
DNATools.createDNASequence("AGATAGCTAGCTAGATATGATAGATCGATAGCAAGCTAGCATCGACTACGATC","DNA");

      //Create a renderer for the sequence
      SymbolSequenceRenderer ssr = new SymbolSequenceRenderer();

      //Create the LabelledSequenceRenderer
      LabelledSequenceRenderer lsr = new LabelledSequenceRenderer(50, 50);
      lsr.setFillColor(Color.white);
      lsr.setRenderer(ssr);
      lsr.addLabelString("Seq");

      //Set up the SequencePanel
      sp.setSequence(seq);
      sp.setRenderer(lsr);
      sp.setRange(new RangeLocation(1,300));

      //Set up the TranslatedSequencePanel
      tsp.setSequence(seq);
      tsp.setRenderer(lsr);
      tsp.setScale(12);
    }
    catch(ChangeVetoException e){
      System.out.println("ChangeVetoException: " + e);
    }
    catch(BioException e){
      System.out.println("BioException: " + e);
    }

    //Add the panels to the frame
    this.getContentPane().setLayout(new BorderLayout());
    this.getContentPane().add(sp, BorderLayout.NORTH);
    this.getContentPane().add(tsp, BorderLayout.CENTER);

    setLocation(100,100);
    setSize(400,200);
    setVisible(true);
  }
  public static void main(String[] args) {
    new TestSequencePanel();
  }
}


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the biojava-dev mailing list