Now supports multiple records in allele at sites that genotype as reference
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5796 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
66c8fa5c48
commit
db1f9af679
|
|
@ -54,6 +54,23 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
|
||||||
useAlleleFromVCF = UAC.GenotypingMode == GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES;
|
useAlleleFromVCF = UAC.GenotypingMode == GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VariantContext getSNPVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, boolean requireSNP, Logger logger) {
|
||||||
|
VariantContext vc = null;
|
||||||
|
|
||||||
|
// search for usable record
|
||||||
|
for( final VariantContext vc_input : tracker.getVariantContexts(ref, "alleles", null, ref.getLocus(), true, false) ) {
|
||||||
|
if ( vc_input != null && ! vc_input.isFiltered() && (! requireSNP || vc_input.isSNP() )) {
|
||||||
|
if ( vc == null ) {
|
||||||
|
vc = vc_input;
|
||||||
|
} else {
|
||||||
|
logger.warn("Multiple valid VCF records detected at site " + ref.getLocus() + ", only considering alleles from first record only");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vc;
|
||||||
|
}
|
||||||
|
|
||||||
public Allele getLikelihoods(RefMetaDataTracker tracker,
|
public Allele getLikelihoods(RefMetaDataTracker tracker,
|
||||||
ReferenceContext ref,
|
ReferenceContext ref,
|
||||||
Map<String, AlignmentContext> contexts,
|
Map<String, AlignmentContext> contexts,
|
||||||
|
|
@ -73,18 +90,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
|
||||||
if ( alternateAlleleToUse != null ) {
|
if ( alternateAlleleToUse != null ) {
|
||||||
bestAlternateAllele = alternateAlleleToUse.getBases()[0];
|
bestAlternateAllele = alternateAlleleToUse.getBases()[0];
|
||||||
} else if ( useAlleleFromVCF ) {
|
} else if ( useAlleleFromVCF ) {
|
||||||
VariantContext vc = null;
|
VariantContext vc = getSNPVCFromAllelesRod(tracker, ref, true, logger);
|
||||||
|
|
||||||
// search for usable record
|
|
||||||
for( final VariantContext vc_input : tracker.getVariantContexts(ref, "alleles", null, ref.getLocus(), true, false) ) {
|
|
||||||
if ( vc_input != null && ! vc_input.isFiltered() && vc_input.isSNP() ) {
|
|
||||||
if ( vc == null ) {
|
|
||||||
vc = vc_input;
|
|
||||||
} else {
|
|
||||||
logger.warn("Multiple valid VCF records detected at site " + ref.getLocus() + ", only considering alleles from first record only");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore places where we don't have a variant
|
// ignore places where we don't have a variant
|
||||||
if ( vc == null )
|
if ( vc == null )
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,8 @@ public class UnifiedGenotyperEngine {
|
||||||
private VariantCallContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
|
private VariantCallContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
|
||||||
VariantContext vc;
|
VariantContext vc;
|
||||||
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
||||||
final VariantContext vcInput = tracker.getVariantContext(ref, "alleles", null, ref.getLocus(), true);
|
VariantContext vcInput = SNPGenotypeLikelihoodsCalculationModel.getSNPVCFromAllelesRod(tracker, ref, false, logger);
|
||||||
if ( vcInput == null || vcInput.isFiltered() )
|
if ( vcInput == null )
|
||||||
return null;
|
return null;
|
||||||
vc = new VariantContext("UG_call", vcInput.getChr(), vcInput.getStart(), vcInput.getEnd(), vcInput.getAlleles());
|
vc = new VariantContext("UG_call", vcInput.getChr(), vcInput.getStart(), vcInput.getEnd(), vcInput.getAlleles());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue