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:
parent
902cf84448
commit
234bb71747
|
|
@ -66,7 +66,7 @@ public class IndelSubsets implements ConcordanceType {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// only deal with a valid indel
|
// 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
|
// we only deal with the first allele
|
||||||
int size = ( indel.getAlternateAlleleList().get(0).length() <= sizeCutoff ? 0 : 1 );
|
int size = ( indel.getAlternateAlleleList().get(0).length() <= sizeCutoff ? 0 : 1 );
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ public class SimpleVenn implements ConcordanceType {
|
||||||
return sample2 + "_only";
|
return sample2 + "_only";
|
||||||
|
|
||||||
// at this point we know that neither is null, so now we need to test for alternate allele concordance
|
// at this point we know that neither is null, so now we need to test for alternate allele concordance
|
||||||
Variation callV1 = call1.toVariation();
|
Variation callV1 = call1.toVariation(ref.getBase());
|
||||||
Variation callV2 = call2.toVariation();
|
Variation callV2 = call2.toVariation(ref.getBase());
|
||||||
|
|
||||||
// we can't really deal with multi-allelic variants
|
// we can't really deal with multi-allelic variants
|
||||||
if ( callV1.isBiallelic() && callV2.isBiallelic() ) {
|
if ( callV1.isBiallelic() && callV2.isBiallelic() ) {
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,9 @@ public class BasicGenotype implements Genotype {
|
||||||
* @return the variant
|
* @return the variant
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Variation toVariation() {
|
public Variation toVariation(char ref) {
|
||||||
if (!isVariant(this.mRef)) throw new IllegalStateException("this genotype is not a variant");
|
if (!isVariant(ref)) throw new IllegalStateException("this genotype is not a variant");
|
||||||
return new BasicVariation(this.getBases(), String.valueOf(mRef), this.getBases().length(), mLocation, mNegLog10PError);
|
return new BasicVariation(this.getBases(), String.valueOf(ref), this.getBases().length(), mLocation, mNegLog10PError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,9 @@ public interface Genotype {
|
||||||
/**
|
/**
|
||||||
* return this genotype as a variant
|
* return this genotype as a variant
|
||||||
*
|
*
|
||||||
|
* @param ref the reference base
|
||||||
* @return the variant
|
* @return the variant
|
||||||
*/
|
*/
|
||||||
public Variation toVariation();
|
public Variation toVariation(char ref);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ public class GeliGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked
|
||||||
* @return true if we're a variant
|
* @return true if we're a variant
|
||||||
*/
|
*/
|
||||||
public boolean isVariant(char ref) {
|
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
|
* @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()]);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public class GLFGenotypeCall implements Genotype, ReadBacked, LikelihoodsBacked
|
||||||
*
|
*
|
||||||
* @return return this genotype as a variant
|
* @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");
|
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);
|
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
|
* get the SAM records that back this genotype call
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ public class VCFGenotypeCall implements Genotype, ReadBacked, PosteriorsBacked,
|
||||||
* @return true if we're a variant
|
* @return true if we're a variant
|
||||||
*/
|
*/
|
||||||
public boolean isVariant(char ref) {
|
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
|
* @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()]);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue