Multi-sample calls now have associated meta-data (SLOD, allele freq), which wil

l soon actually be used...


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1820 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-10-13 20:08:43 +00:00
parent db642fd08b
commit b28446acac
7 changed files with 57 additions and 11 deletions

View File

@ -0,0 +1,47 @@
package org.broadinstitute.sting.utils.genotype;
/**
* @author ebanks
* <p/>
* Class GenotypeMetaData
* <p/>
* represents the meta data for a genotype object.
*/
public class GenotypeMetaData {
// the strand score lod
private double mSLOD;
// the allele frequency
private double mAlleleFrequency;
/**
* create a basic genotype meta data pbject, given the following fields
*
* @param strandLOD the strand score lod
* @param alleleFrequency the allele frequency
*/
public GenotypeMetaData(double strandLOD, double alleleFrequency) {
mSLOD = strandLOD;
mAlleleFrequency = alleleFrequency;
}
/**
* get the strand lod
*
* @return the strand lod
*/
public double getSLOD() {
return mSLOD;
}
/**
* get the allele frequency
*
* @return the allele frequency
*/
public double getAlleleFrequency() {
return mAlleleFrequency;
}
}

View File

@ -56,7 +56,7 @@ public interface GenotypeWriter {
* add a multi-sample call if we support it
* @param genotypes the list of genotypes, that are backed by sample information
*/
public void addMultiSampleCall(List<Genotype> genotypes);
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata);
/**
* @return true if we support multisample, false otherwise

View File

@ -161,7 +161,7 @@ public class GeliAdapter implements GenotypeWriter {
* @param genotypes the list of genotypes, that are backed by sample information
*/
@Override
public void addMultiSampleCall( List<Genotype> genotypes) {
public void addMultiSampleCall( List<Genotype> genotypes, GenotypeMetaData metadata) {
throw new UnsupportedOperationException("Geli binary doesn't support multisample calls");
}

View File

@ -124,7 +124,7 @@ public class GeliTextWriter implements GenotypeWriter {
* @param genotypes the list of genotypes, that are backed by sample information
*/
@Override
public void addMultiSampleCall(List<Genotype> genotypes) {
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
throw new UnsupportedOperationException("Geli text doesn't support multisample calls");
}

View File

@ -299,7 +299,7 @@ public class GLFWriter implements GenotypeWriter {
* @param genotypes the list of genotypes, that are backed by sample information
*/
@Override
public void addMultiSampleCall(List<Genotype> genotypes) {
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
throw new UnsupportedOperationException("GLF writer doesn't support multisample calls");
}

View File

@ -104,7 +104,7 @@ public class TabularLFWriter implements GenotypeWriter {
* @param genotypes the list of genotypes, that are backed by sample information
*/
@Override
public void addMultiSampleCall(List<Genotype> genotypes) {
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
throw new UnsupportedOperationException("Tabular LF doesn't support multisample calls");
}

View File

@ -2,10 +2,7 @@ package org.broadinstitute.sting.utils.genotype.vcf;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.genotype.Genotype;
import org.broadinstitute.sting.utils.genotype.GenotypeWriter;
import org.broadinstitute.sting.utils.genotype.ReadBacked;
import org.broadinstitute.sting.utils.genotype.SampleBacked;
import org.broadinstitute.sting.utils.genotype.*;
import java.io.File;
import java.io.OutputStream;
@ -91,7 +88,7 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
*/
@Override
public void addGenotypeCall(Genotype call) {
addMultiSampleCall(Arrays.asList(call));
addMultiSampleCall(Arrays.asList(call), null);
}
/**
@ -117,7 +114,7 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
* @param genotypes the list of genotypes, that are backed by sample information
*/
@Override
public void addMultiSampleCall(List<Genotype> genotypes) {
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
if (!mInitialized)
lazyInitialize(genotypes, mFile, mStream);
@ -150,6 +147,8 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
params.addAlternateBase(allele);
}
// TODO -- use the GenotypeMetaData object if it's not null
VCFGenotypeRecord record = new VCFGenotypeRecord(((SampleBacked) gtype).getSampleName(),
alleles,
VCFGenotypeRecord.PHASE.UNPHASED,