Exemplo n.º 1
0
  // decide whether we are currently processing SNPs, indels, neither, or both
  private List<GenotypeLikelihoodsCalculationModel.Model> getGLModelsToUse(
      final RefMetaDataTracker tracker,
      final ReferenceContext refContext,
      final AlignmentContext rawContext) {

    final List<GenotypeLikelihoodsCalculationModel.Model> models =
        new ArrayList<GenotypeLikelihoodsCalculationModel.Model>(2);
    String modelPrefix = "";
    if (UAC.GLmodel.name().toUpperCase().contains("BOTH"))
      modelPrefix = UAC.GLmodel.name().toUpperCase().replaceAll("BOTH", "");

    if (!UAC.GLmodel.name().contains(GPSTRING)
        && UAC.samplePloidy != VariantContextUtils.DEFAULT_PLOIDY)
      modelPrefix = GPSTRING + modelPrefix;

    // if we're genotyping given alleles and we have a requested SNP at this position, do SNP
    if (UAC.GenotypingMode
        == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) {
      final VariantContext vcInput =
          getVCFromAllelesRod(
              tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
      if (vcInput == null) return models;

      if (vcInput.isSNP()) {
        // ignore SNPs if the user chose INDEL mode only
        if (UAC.GLmodel.name().toUpperCase().contains("BOTH")
            || UAC.GLmodel.name().toUpperCase().contains("SNP"))
          models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix + "SNP"));
      } else if (vcInput.isIndel() || vcInput.isMixed()) {
        // ignore INDELs if the user chose SNP mode only
        if (UAC.GLmodel.name().toUpperCase().contains("BOTH")
            || UAC.GLmodel.name().toUpperCase().contains("INDEL"))
          models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix + "INDEL"));
      }
      // No support for other types yet
    } else {
      if (UAC.GLmodel.name().toUpperCase().contains("BOTH")) {
        models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix + "SNP"));
        models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix + "INDEL"));
      } else {
        models.add(
            GenotypeLikelihoodsCalculationModel.Model.valueOf(
                modelPrefix + UAC.GLmodel.name().toUpperCase()));
      }
    }

    return models;
  }
Exemplo n.º 2
0
 /**
  * Compute genotypes at a given locus.
  *
  * @param vc the GL-annotated variant context
  * @return the VariantCallContext object
  */
 public VariantCallContext calculateGenotypes(VariantContext vc) {
   return calculateGenotypes(
       null, null, null, null, vc, GenotypeLikelihoodsCalculationModel.Model.valueOf("SNP"), null);
 }