fix and then deprecate the rodGELI class (GELIs suck)

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1207 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-07-09 19:18:13 +00:00
parent 60a86fb34a
commit 99631cdaa1
1 changed files with 60 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import java.io.File;
import edu.mit.broad.picard.genotype.geli.GeliFileReader;
import edu.mit.broad.picard.genotype.geli.GenotypeLikelihoods;
import edu.mit.broad.picard.genotype.DiploidGenotype;
import edu.mit.broad.picard.variation.KnownVariant;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
@ -28,7 +30,9 @@ public class rodGELI extends BasicReferenceOrderedDatum {
public rodGELI(final String name, GenotypeLikelihoods gh) {
super(name);
this.gh = gh;
}
if ( true )
throw new RuntimeException("This class is no longer supported because of issues with GELIs");
}
@Override
public GenomeLoc getLocation() {
@ -46,7 +50,20 @@ public class rodGELI extends BasicReferenceOrderedDatum {
@Override
public String toString() {
return gh.toString();
final StringBuilder builder = new StringBuilder();
builder.append(gh.getSequenceName() + "\t");
builder.append(gh.getPosition() + "\t");
builder.append(Character.toString((char)(gh.getReferenceBase() & 0xff)) + "\t");
builder.append(gh.getNumReads() + "\t");
builder.append(gh.getMaxMappingQuality() + "\t");
builder.append(gh.getBestGenotype().name() + "\t");
builder.append(gh.getBestToReferenceLod() + "\t");
builder.append(gh.getBestToSecondBestLod() + "\t");
builder.append("\t"); // no dbSNP info in GenotypeLikelihoods class
for (final DiploidGenotype genotype : DiploidGenotype.values())
builder.append(gh.getLikelihood(genotype) + "\t");
builder.append("\n");
return builder.toString();
}
private static class rodGELIIterator implements Iterator<rodGELI> {
@ -78,4 +95,45 @@ public class rodGELI extends BasicReferenceOrderedDatum {
public static Iterator<rodGELI> createIterator(String name, File file) {
return new rodGELI.rodGELIIterator(name,file);
}
public static void main(String argv[]) {
String testFile = "NA12878.geli";
Iterator<rodGELI> it = createIterator("test-geli", new File(testFile));
net.sf.picard.reference.ReferenceSequenceFileWalker reference = new net.sf.picard.reference.ReferenceSequenceFileWalker(new File( "/seq/references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta"));
if ( reference.getSequenceDictionary() == null ) {
System.out.println("No reference sequence dictionary found. Abort.");
System.exit(1);
}
GenomeLocParser.setupRefContigOrdering(reference.getSequenceDictionary());
int counter = 0;
while ( it.hasNext() && counter < 500 ) {
rodGELI rg = it.next();
System.out.println(rg.toString());
/*
System.out.print(p.getLocation().toString());
System.out.print('\t');
if ( p.isIndel() && p.isSNP() ) { System.out.print("Indel+SNP"); }
else {
if ( p.isSNP() ) { System.out.print("SNP"); }
else {
if ( p.isIndel() ) { System.out.print("Indel"); }
else { System.out.print("REF"); }
}
}
System.out.print('\t');
System.out.print(p.getFWDAlleles().get(0)+"/"+p.getFWDAlleles().get(1));
System.out.print('\t');
System.out.println(p.getConsensusConfidence()+"\t"+p.getVariantConfidence());
*/
counter++;
}
}
}