diff --git a/uk/ac/sanger/artemis/components/FeatureDisplay.java b/uk/ac/sanger/artemis/components/FeatureDisplay.java index 195804790b7d8ad89a89ebadcc31a959663ec57e..fb681cc78a12b7f558587c8be6016698ae2cfce4 100644 --- a/uk/ac/sanger/artemis/components/FeatureDisplay.java +++ b/uk/ac/sanger/artemis/components/FeatureDisplay.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/FeatureDisplay.java,v 1.17 2004-12-22 13:28:31 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/FeatureDisplay.java,v 1.18 2004-12-23 10:19:05 tjc Exp $ */ package uk.ac.sanger.artemis.components; @@ -45,7 +45,7 @@ import javax.swing.JComponent; * This component is used for displaying an Entry. * * @author Kim Rutherford - * @version $Id: FeatureDisplay.java,v 1.17 2004-12-22 13:28:31 tjc Exp $ + * @version $Id: FeatureDisplay.java,v 1.18 2004-12-23 10:19:05 tjc Exp $ **/ public class FeatureDisplay extends EntryGroupPanel @@ -2128,6 +2128,11 @@ public class FeatureDisplay extends EntryGroupPanel // used to remember the position of the previously drawn codon int last_x_position = -1; + if(height_percent < 100) + g.setColor(start_codon_colour); + else + g.setColor(Color.black); + for(int i = 0 ; i < codon_positions.length ; ++i) { final int codon_base_start = codon_positions[i]; @@ -2150,12 +2155,8 @@ public class FeatureDisplay extends EntryGroupPanel // draw only if we haven't drawn on the position already if(last_x_position == -1 || draw_x_position != last_x_position) { - if(height_percent < 100) - drawOneCodonMark(g, draw_x_position, draw_y_position, - direction, mark_height, start_codon_colour); - else - drawOneCodonMark(g, draw_x_position, draw_y_position, - direction, mark_height, Color.black); + drawOneCodonMark(g, draw_x_position, draw_y_position, + direction, mark_height); last_x_position = draw_x_position; } @@ -2195,32 +2196,28 @@ public class FeatureDisplay extends EntryGroupPanel * @param direction If this is FORWARD the line is draw from the y position * to the right, otherwise it is drawn to the left. * @param height The height in pixels of the codon mark. - * @param colour The colour to use when drawing the mark. **/ private void drawOneCodonMark(final Graphics g, final int x_pos, final int y_pos, final int direction, - final int height, - final Color colour) + final int height) { - g.setColor(colour); - if(getScaleFactor() == 1) { // draw a line three pixels/bases wide if(direction == FORWARD) { g.drawLine(x_pos + 1, y_pos, - x_pos + 1, y_pos + height - 1); + x_pos + 1, y_pos + height - 1); g.drawLine(x_pos + 2, y_pos, - x_pos + 2, y_pos + height - 1); + x_pos + 2, y_pos + height - 1); } else { g.drawLine(x_pos - 1, y_pos, - x_pos - 1, y_pos + height - 1); + x_pos - 1, y_pos + height - 1); g.drawLine(x_pos - 2, y_pos, - x_pos - 2, y_pos + height - 1); + x_pos - 2, y_pos + height - 1); } } g.drawLine(x_pos, y_pos, x_pos, y_pos + height - 1); diff --git a/uk/ac/sanger/artemis/io/BioJavaSequence.java b/uk/ac/sanger/artemis/io/BioJavaSequence.java index 26c61d2cce33f9ea3f381755e0eea297a41b1939..2ef57069abc20762c2daf23807b7cd1c4d1381ef 100644 --- a/uk/ac/sanger/artemis/io/BioJavaSequence.java +++ b/uk/ac/sanger/artemis/io/BioJavaSequence.java @@ -99,6 +99,15 @@ public class BioJavaSequence implements Sequence return subSeq; } + public char[] getCharSubSequence (int start, int end) + { + char[] dst = new char[end-start]; + StringBuffer buff = new StringBuffer(getSubSequence(start,end)); + buff.getChars(start, end, dst, 0); + return dst; + } + + public void setFromString(String seqString) throws ReadOnlyException, IllegalSymbolException { diff --git a/uk/ac/sanger/artemis/io/CorbaSequence.java b/uk/ac/sanger/artemis/io/CorbaSequence.java index ecac29609f578608e41268c1bebd1c8edab82416..de196f82dd0cd817390c319b9d85ab57a74b0c5d 100644 --- a/uk/ac/sanger/artemis/io/CorbaSequence.java +++ b/uk/ac/sanger/artemis/io/CorbaSequence.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/CorbaSequence.java,v 1.1 2004-06-09 09:49:01 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/CorbaSequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ **/ package uk.ac.sanger.artemis.io; @@ -34,7 +34,7 @@ import java.io.IOException; * object. * * @author Kim Rutherford - * @version $Id: CorbaSequence.java,v 1.1 2004-06-09 09:49:01 tjc Exp $ + * @version $Id: CorbaSequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ **/ public class CorbaSequence implements Sequence { @@ -73,6 +73,15 @@ public class CorbaSequence implements Sequence { } } + public char[] getCharSubSequence (int start, int end) + { + char[] dst = new char[end-start+1]; + StringBuffer buff = new StringBuffer(sequence); + buff.getChars(start-1, end, dst, 0); + return dst; + } + + /** * Set this sequence to hold the bases in the given String - throws * ReadOnlyException for CorbaSequence objects. diff --git a/uk/ac/sanger/artemis/io/Sequence.java b/uk/ac/sanger/artemis/io/Sequence.java index 8a5b095725b16ebe27469fe279ce2ffddc117baa..6699f31a3e853cb95a49eb42b2135e5fc3ad7e5d 100644 --- a/uk/ac/sanger/artemis/io/Sequence.java +++ b/uk/ac/sanger/artemis/io/Sequence.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/Sequence.java,v 1.1 2004-06-09 09:50:27 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/Sequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ */ package uk.ac.sanger.artemis.io; @@ -32,7 +32,7 @@ import org.biojava.bio.symbol.IllegalSymbolException; * Sequence interface * * @author Kim Rutherford - * @version $Id: Sequence.java,v 1.1 2004-06-09 09:50:27 tjc Exp $ + * @version $Id: Sequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ * */ @@ -45,6 +45,8 @@ public interface Sequence **/ String getSubSequence(int start, int end); + char[] getCharSubSequence(int start, int end); + /** * Set this sequence to hold the bases in the given String. * @exception ReadOnlyException If this Sequence cannot be changed. diff --git a/uk/ac/sanger/artemis/io/StreamSequence.java b/uk/ac/sanger/artemis/io/StreamSequence.java index 3479a856924500b6b9d5cf8012fa8839b4373513..3ab163826fa236487572fbf82825a3df059d40f2 100644 --- a/uk/ac/sanger/artemis/io/StreamSequence.java +++ b/uk/ac/sanger/artemis/io/StreamSequence.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/StreamSequence.java,v 1.1 2004-06-09 09:50:37 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/StreamSequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ */ package uk.ac.sanger.artemis.io; @@ -33,7 +33,7 @@ import java.io.Writer; * stream. * * @author Kim Rutherford - * @version $Id: StreamSequence.java,v 1.1 2004-06-09 09:50:37 tjc Exp $ + * @version $Id: StreamSequence.java,v 1.2 2004-12-23 10:19:05 tjc Exp $ **/ public abstract class StreamSequence @@ -91,6 +91,14 @@ public abstract class StreamSequence } } + public char[] getCharSubSequence (int start, int end) + { + char[] dst = new char[end-start+1]; + StringBuffer buff = new StringBuffer(sequence); + buff.getChars(start-1, end, dst, 0); + return dst; + } + /** * Set this sequence to hold the bases in the given String. **/ diff --git a/uk/ac/sanger/artemis/sequence/Bases.java b/uk/ac/sanger/artemis/sequence/Bases.java index 4cfbc69b85fa9e3198ed81dd64bdc33e63ecf78f..5bf37e03a05db3a21c6c80ec817d297a66cecaf2 100644 --- a/uk/ac/sanger/artemis/sequence/Bases.java +++ b/uk/ac/sanger/artemis/sequence/Bases.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/sequence/Bases.java,v 1.5 2004-12-22 18:39:17 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/sequence/Bases.java,v 1.6 2004-12-23 10:19:05 tjc Exp $ */ package uk.ac.sanger.artemis.sequence; @@ -45,7 +45,7 @@ import java.util.Iterator; * non-base letter returns '@'. * * @author Kim Rutherford - * @version $Id: Bases.java,v 1.5 2004-12-22 18:39:17 tjc Exp $ */ + * @version $Id: Bases.java,v 1.6 2004-12-23 10:19:05 tjc Exp $ */ public class Bases { /** @@ -510,8 +510,12 @@ public class Bases { int current_return_array_index = 0; +// final char sequence_string[] = +// getSequence().getSubSequence(1, getLength()).toCharArray(); + final char sequence_string[] = - getSequence().getSubSequence(1, getLength()).toCharArray(); + getSequence().getCharSubSequence(1, getLength()); + final int sequence_string_length = sequence_string.length; final int range_start_index = real_range.getStart () - 1; final int range_end_index = real_range.getEnd () - 1;