Skip to content
Snippets Groups Projects
Commit 3930aaa1 authored by tjc's avatar tjc
Browse files

fix/revert for speed when zoomed out and changing the window size

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@10152 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 4252d77b
No related branches found
No related tags found
No related merge requests found
......@@ -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/plot/AGWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/plot/AGWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
*/
package uk.ac.sanger.artemis.plot;
......@@ -37,7 +37,7 @@ import uk.ac.sanger.artemis.sequence.*;
* constructor.
*
* @author Kim Rutherford
* @version $Id: AGWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* @version $Id: AGWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
**/
public class AGWindowAlgorithm extends BaseAlgorithm {
......@@ -59,18 +59,18 @@ public class AGWindowAlgorithm extends BaseAlgorithm {
* this array.
**/
public void getValues (int start, int end, final float [] values) {
final char[] sequence;
final String sequence;
try {
sequence = getStrand ().getBases().getSubSequenceC (new Range (start, end), getStrand().getDirection());
sequence = getStrand ().getSubSequence (new Range (start, end));
} catch (OutOfRangeException e) {
throw new Error ("internal error - unexpected exception: " + e);
}
float gc_count = 0;
for (int i = 0 ; i < sequence.length ; ++i) {
final char this_char = sequence[i];
for (int i = 0 ; i < sequence.length () ; ++i) {
final char this_char = sequence.charAt (i);
// System.out.println (this_char);
if (this_char == 'g' || this_char == 'a') {
......@@ -80,7 +80,7 @@ public class AGWindowAlgorithm extends BaseAlgorithm {
// System.out.println ("start: " + start + " end: " + end + " returning: " + gc_count/sequence.length ());
values[0] = gc_count/sequence.length * 100;
values[0] = gc_count/sequence.length () * 100;
}
/**
......
......@@ -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/plot/GCSDWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/plot/GCSDWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
*/
package uk.ac.sanger.artemis.plot;
......@@ -39,7 +39,7 @@ import uk.ac.sanger.artemis.sequence.*;
* to use is set in the constructor.
*
* @author Kim Rutherford
* @version $Id: GCSDWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* @version $Id: GCSDWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
**/
public class GCSDWindowAlgorithm extends BaseAlgorithm {
......@@ -82,18 +82,18 @@ public class GCSDWindowAlgorithm extends BaseAlgorithm {
}
}
final char[] sequence;
final String sequence;
try {
sequence = getStrand ().getBases().getSubSequenceC (new Range (start, end), getStrand().getDirection());
sequence = getStrand ().getSubSequence (new Range (start, end));
} catch (OutOfRangeException e) {
throw new Error ("internal error - unexpected exception: " + e);
}
float gc_count = 0;
for (int i = 0 ; i < sequence.length ; ++i) {
final char this_char = sequence[i];
for (int i = 0 ; i < sequence.length () ; ++i) {
final char this_char = sequence.charAt (i);
// System.out.println (this_char);
if (this_char == 'g' || this_char == 'c') {
......@@ -101,7 +101,7 @@ public class GCSDWindowAlgorithm extends BaseAlgorithm {
}
}
final float gc_content = gc_count/sequence.length * 100;
final float gc_content = gc_count/sequence.length () * 100;
final float gc_average =
getStrand ().getBases ().getAverageGCPercent ();
......@@ -122,17 +122,8 @@ public class GCSDWindowAlgorithm extends BaseAlgorithm {
final int sequence_length = getStrand ().getBases ().getLength ();
//final String bases = getStrand ().getBases ().toString ();
char[] bases = null;
try
{
bases = getStrand ().getBases ().getSubSequenceC(new Range(1,sequence_length), Strand.FORWARD);
}
catch(OutOfRangeException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
final String bases = getStrand ().getBases ().toString ();
// the number of windows to search
final int window_count = sequence_length - window_size;
......@@ -150,14 +141,14 @@ public class GCSDWindowAlgorithm extends BaseAlgorithm {
for (int i = - window_size ; i < window_count ; ++i) {
if (i > 0) {
final char previous_char = bases[i - 1];
final char previous_char = bases.charAt (i - 1);
if (previous_char == 'g' || previous_char == 'c') {
--current_gc_count;
}
}
final char new_char = bases[i + window_size];
final char new_char = bases.charAt (i + window_size);
if (new_char == 'g' || new_char == 'c') {
++current_gc_count;
......
......@@ -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/plot/GCWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/plot/GCWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
**/
package uk.ac.sanger.artemis.plot;
......@@ -37,7 +37,7 @@ import uk.ac.sanger.artemis.sequence.*;
* constructor.
*
* @author Kim Rutherford
* @version $Id: GCWindowAlgorithm.java,v 1.3 2009-03-13 20:39:37 tjc Exp $
* @version $Id: GCWindowAlgorithm.java,v 1.4 2009-03-17 17:47:42 tjc Exp $
**/
public class GCWindowAlgorithm extends BaseAlgorithm {
......@@ -59,27 +59,28 @@ public class GCWindowAlgorithm extends BaseAlgorithm {
* this array.
**/
public void getValues (int start, int end, final float [] values) {
final char[] sequence;
final String sequence;
try {
sequence = getStrand ().getBases().getSubSequenceC(
new Range (start, end), getStrand ().getDirection());
sequence = getStrand ().getSubSequence (new Range (start, end));
} catch (OutOfRangeException e) {
throw new Error ("internal error - unexpected exception: " + e);
}
float gc_count = 0;
final int sequence_length = sequence.length;
for (int i = 0 ; i < sequence_length ; ++i)
{
if (sequence[i] == 'g' || sequence[i] == 'c')
for (int i = 0 ; i < sequence.length () ; ++i) {
final char this_char = sequence.charAt (i);
// System.out.println (this_char);
if (this_char == 'g' || this_char == 'c') {
++gc_count;
}
}
// System.out.println ("start: " + start + " end: " + end + " returning: " + gc_count/sequence.length ());
values[0] = gc_count/sequence_length * 100;
values[0] = gc_count/sequence.length () * 100;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment