bug fix for transitioning between chromosomes in GLF output

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1237 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-07-14 17:58:04 +00:00
parent 7d755a4c90
commit 99ddd8ab15
1 changed files with 5 additions and 24 deletions

View File

@ -156,6 +156,8 @@ public class GLFWriter implements GenotypeWriter {
/**
* add a GLF record to the output file
*
* @param contigName the contig name
* @param contigLength the contig length
* @param rec the GLF record to write.
*/
public void addGLFRecord(String contigName, int contigLength, GLFRecord rec) {
@ -183,8 +185,8 @@ public class GLFWriter implements GenotypeWriter {
/**
* check to see if we've jumped to a new contig
*
* @param sequenceName
* @param seqLength
* @param sequenceName the name for the sequence
* @param seqLength the sequence length
*/
private void checkSequence(String sequenceName, int seqLength) {
if ((referenceSequenceName == null) || (!referenceSequenceName.equals(sequenceName))) {
@ -193,6 +195,7 @@ public class GLFWriter implements GenotypeWriter {
}
referenceSequenceName = sequenceName;
referenceSequenceLength = seqLength;
lastPos = 1;
addSequence();
}
}
@ -220,28 +223,6 @@ public class GLFWriter implements GenotypeWriter {
outputBinaryCodec.close();
}
/**
* normalize the values to the range of a byte (0 - 255)
*
* @param values the floating point values to normalize
*
* @return a byte array containing the normalized values
*/
private byte[] normalizeToByte(double[] values) {
byte ret[] = new byte[values.length];
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
for (double d : values) {
min = (d < min) ? d : min;
max = (d > max) ? d : max;
}
double scale = max / 255.0;
for (int x = 0; x < values.length; x++) {
ret[x] = (byte) ((values[x] - min) / scale);
}
return ret;
}
/**
* get the reference sequence
*