changed the toVariation() method to take a reference base, instead of using the reference base loaded from the underlying data source (if it was reference aware). Also changed some isVariant() methods which weren't using the passed in ref base.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2034 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-11-13 06:54:38 +00:00
parent 902cf84448
commit 234bb71747
7 changed files with 15 additions and 23 deletions

View File

@ -66,7 +66,7 @@ public class IndelSubsets implements ConcordanceType {
return null;
// only deal with a valid indel
Variation indel = ( indel1 != null ? indel1.toVariation() : indel2.toVariation() );
Variation indel = ( indel1 != null ? indel1.toVariation(ref.getBase()) : indel2.toVariation(ref.getBase()) );
// we only deal with the first allele
int size = ( indel.getAlternateAlleleList().get(0).length() <= sizeCutoff ? 0 : 1 );

View File

@ -42,8 +42,8 @@ public class SimpleVenn implements ConcordanceType {
return sample2 + "_only";
// at this point we know that neither is null, so now we need to test for alternate allele concordance
Variation callV1 = call1.toVariation();
Variation callV2 = call2.toVariation();
Variation callV1 = call1.toVariation(ref.getBase());
Variation callV2 = call2.toVariation(ref.getBase());
// we can't really deal with multi-allelic variants
if ( callV1.isBiallelic() && callV2.isBiallelic() ) {

View File

@ -151,9 +151,9 @@ public class BasicGenotype implements Genotype {
* @return the variant
*/
@Override
public Variation toVariation() {
if (!isVariant(this.mRef)) throw new IllegalStateException("this genotype is not a variant");
return new BasicVariation(this.getBases(), String.valueOf(mRef), this.getBases().length(), mLocation, mNegLog10PError);
public Variation toVariation(char ref) {
if (!isVariant(ref)) throw new IllegalStateException("this genotype is not a variant");
return new BasicVariation(this.getBases(), String.valueOf(ref), this.getBases().length(), mLocation, mNegLog10PError);
}
/**

View File

@ -77,8 +77,9 @@ public interface Genotype {
/**
* return this genotype as a variant
*
* @param ref the reference base
* @return the variant
*/
public Variation toVariation();
public Variation toVariation(char ref);
}

View File

@ -201,7 +201,7 @@ public class GeliGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked
* @return true if we're a variant
*/
public boolean isVariant(char ref) {
return !Utils.dupString(this.getReference(), 2).equals(getBestGenotype().toString());
return !Utils.dupString(ref, 2).equals(getBestGenotype().toString());
}
/**
@ -217,9 +217,9 @@ public class GeliGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked
*
* @return return this genotype as a variant
*/
public Variation toVariation() {
public Variation toVariation(char ref) {
double bestRef = Math.abs(mPosteriors[getBestGenotype().ordinal()] - mPosteriors[getRefGenotype().ordinal()]);
return new BasicVariation(this.getBases(), String.valueOf(this.getReference()), 0, this.mLocation, bestRef);
return new BasicVariation(this.getBases(), String.valueOf(ref), 0, this.mLocation, bestRef);
}
/**

View File

@ -120,7 +120,7 @@ public class GLFGenotypeCall implements Genotype, ReadBacked, LikelihoodsBacked
*
* @return return this genotype as a variant
*/
public Variation toVariation() {
public Variation toVariation(char ref) {
throw new UnsupportedOperationException("GLF call doesn't support conversion to Variation");
}
@ -154,15 +154,6 @@ public class GLFGenotypeCall implements Genotype, ReadBacked, LikelihoodsBacked
return !Utils.dupString(mRefBase, 2).equals(mGenotype);
}
/**
* are we a variant? (non-ref)
*
* @return true if we're a variant
*/
public boolean isVariant() {
return isVariant(mRefBase);
}
/**
* get the SAM records that back this genotype call
*

View File

@ -207,7 +207,7 @@ public class VCFGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked,
* @return true if we're a variant
*/
public boolean isVariant(char ref) {
return !Utils.dupString(this.getReference(), 2).equals(getBestGenotype().toString());
return !Utils.dupString(ref, 2).equals(getBestGenotype().toString());
}
/**
@ -223,9 +223,9 @@ public class VCFGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked,
*
* @return return this genotype as a variant
*/
public Variation toVariation() {
public Variation toVariation(char ref) {
double bestRef = Math.abs(mPosteriors[getBestGenotype().ordinal()] - mPosteriors[getRefGenotype().ordinal()]);
return new BasicVariation(this.getBases(), String.valueOf(this.getReference()), 0, this.mLocation, bestRef);
return new BasicVariation(this.getBases(), String.valueOf(ref), 0, this.mLocation, bestRef);
}
/**