Hacks for getting GLFs support in the Rod system working
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1268 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
0548026a2e
commit
107f42a01e
|
|
@ -1,21 +1,18 @@
|
|||
package org.broadinstitute.sting.gatk.refdata;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.utils.MalformedGenomeLocException;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.xReadLines;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||
import org.broadinstitute.sting.gatk.refdata.rodRefSeq;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.xReadLines;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.MalformedGenomeLocException;
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Class for representing arbitrary reference ordered data sets
|
||||
|
|
@ -53,8 +50,12 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
|
||||
public static HashMap<String, RODBinding> Types = new HashMap<String, RODBinding>();
|
||||
public static void addModule(final String name, final Class<? extends ReferenceOrderedDatum> rodType) {
|
||||
final String boundName = name.toLowerCase();
|
||||
if ( Types.containsKey(boundName) ) {
|
||||
throw new RuntimeException(String.format("GATK BUG: adding ROD module %s that is already bound", boundName));
|
||||
}
|
||||
System.out.printf("* Adding rod class %s%n", name);
|
||||
Types.put(name.toLowerCase(), new RODBinding(name, rodType));
|
||||
Types.put(boundName, new RODBinding(name, rodType));
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
@ -64,7 +65,6 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
addModule("HapMapAlleleFrequencies", HapMapAlleleFrequenciesROD.class);
|
||||
addModule("SAMPileup", rodSAMPileup.class);
|
||||
addModule("GELI", rodGELI.class);
|
||||
addModule("FLT", rodFLT.class);
|
||||
addModule("RefSeq", rodRefSeq.class);
|
||||
addModule("Table", TabularROD.class);
|
||||
addModule("PooledEM", PooledEMSNPROD.class);
|
||||
|
|
@ -73,6 +73,7 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
|||
addModule("HapMapGenotype", HapMapGenotypeROD.class);
|
||||
addModule("Intervals", IntervalRod.class);
|
||||
addModule("Variants", rodVariants.class);
|
||||
addModule("GLF", RodGLF.class);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.Iterator;
|
|||
* the rod class for GLF data.
|
||||
*/
|
||||
public class RodGLF extends BasicReferenceOrderedDatum {
|
||||
protected GLFRecord mRecord;
|
||||
public GLFRecord mRecord;
|
||||
private GenomeLoc mLoc;
|
||||
private static GLFRODIterator mWrap;
|
||||
private String contig;
|
||||
|
|
|
|||
|
|
@ -33,16 +33,15 @@ import java.util.Arrays;
|
|||
*/
|
||||
|
||||
public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVariant {
|
||||
private enum Genotype { AA, AC, AG, AT, CC, CG, CT, GG, GT, TT }
|
||||
|
||||
private GenomeLoc loc;
|
||||
private char refBase = 'N';
|
||||
private int depth;
|
||||
private int maxMappingQuality;
|
||||
private String bestGenotype = "NN";
|
||||
private float lodBtr;
|
||||
private float lodBtnb;
|
||||
private float[] genotypeLikelihoods = new float[10];
|
||||
public enum Genotype { AA, AC, AG, AT, CC, CG, CT, GG, GT, TT }
|
||||
public GenomeLoc loc;
|
||||
public char refBase = 'N';
|
||||
public int depth;
|
||||
public int maxMappingQuality;
|
||||
public String bestGenotype = "NN";
|
||||
public double lodBtr;
|
||||
public double lodBtnb;
|
||||
public double[] genotypeLikelihoods = new double[10];
|
||||
|
||||
public rodVariants(final String name) { super(name); }
|
||||
|
||||
|
|
@ -55,11 +54,11 @@ public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVa
|
|||
depth = Integer.valueOf(parts[3]);
|
||||
maxMappingQuality = Integer.valueOf(parts[4]);
|
||||
bestGenotype = parts[5];
|
||||
lodBtr = Float.valueOf(parts[6]);
|
||||
lodBtnb = Float.valueOf(parts[7]);
|
||||
lodBtr = Double.valueOf(parts[6]);
|
||||
lodBtnb = Double.valueOf(parts[7]);
|
||||
|
||||
for (int pieceIndex = 8, offset = 0; pieceIndex < 18; pieceIndex++, offset++) {
|
||||
genotypeLikelihoods[offset] = Float.valueOf(parts[pieceIndex]);
|
||||
genotypeLikelihoods[offset] = Double.valueOf(parts[pieceIndex]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -101,11 +100,11 @@ public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVa
|
|||
|
||||
public String getBestGenotype() { return bestGenotype; }
|
||||
|
||||
public float getLodBtr() { return lodBtr; }
|
||||
public double getLodBtr() { return lodBtr; }
|
||||
|
||||
public float getLodBtnb() { return lodBtnb; }
|
||||
public double getLodBtnb() { return lodBtnb; }
|
||||
|
||||
public float[] getGenotypeLikelihoods() { return genotypeLikelihoods; }
|
||||
public double[] getGenotypeLikelihoods() { return genotypeLikelihoods; }
|
||||
|
||||
public void adjustLikelihoods(double[] likelihoods) {
|
||||
for (int likelihoodIndex = 0; likelihoodIndex < likelihoods.length; likelihoodIndex++) {
|
||||
|
|
@ -139,8 +138,8 @@ public class rodVariants extends BasicReferenceOrderedDatum implements AllelicVa
|
|||
}
|
||||
|
||||
this.bestGenotype = bestGenotype;
|
||||
this.lodBtr = (float) (bestLikelihood - refLikelihood);
|
||||
this.lodBtnb = (float) (bestLikelihood - nextBestLikelihood);
|
||||
this.lodBtr = (bestLikelihood - refLikelihood);
|
||||
this.lodBtnb = (bestLikelihood - nextBestLikelihood);
|
||||
}
|
||||
|
||||
public String getRefBasesFWD() {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ package org.broadinstitute.sting.utils.genotype.glf;
|
|||
|
||||
import net.sf.samtools.util.BinaryCodec;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.gatk.refdata.AllelicVariant;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -40,6 +44,8 @@ import org.broadinstitute.sting.utils.StingException;
|
|||
* field values.
|
||||
*/
|
||||
public abstract class GLFRecord {
|
||||
public final static double LIKELIHOOD_SCALE_FACTOR = 1;
|
||||
|
||||
|
||||
// fields common to all records
|
||||
protected REF_BASE refBase;
|
||||
|
|
|
|||
Loading…
Reference in New Issue