Пример #1
0
  private List<Region> findOverlappingRegions(Result blastResult) {
    List<Region> result = new ArrayList<Region>();
    for (BlastAnalysis.Region region : blastResult.getReference().getRegions())
      if (region.overlaps(blastResult.getStart(), blastResult.getEnd(), MINIMUM_REGION_OVERLAP))
        result.add(region);

    return result;
  }
Пример #2
0
  private boolean subgenogroupPhyloAnalysis(
      AbstractSequence s, Result blastResult, Region region, Cluster typeCluster)
      throws AnalysisException, IOException, ParameterProblemException, FileFormatException {
    PhyloClusterAnalysis a =
        getPhyloAnalysis(blastResult.getConcludedCluster().getId(), typeCluster.getId(), region);

    if (a == null) {
      if (region != null) {
        region = null;
        a =
            getPhyloAnalysis(
                blastResult.getConcludedCluster().getId(), typeCluster.getId(), region);

        if (a == null) return false;
      } else {
        List<Region> regions = Collections.emptyList();

        if (blastResult.getReference() != null)
          /*
           * Perhaps we have an analysis for the region covered by the input sequence ?
           */
          regions = findOverlappingRegions(blastResult);

        boolean result = false;
        for (Region r : regions)
          if (subgenogroupPhyloAnalysis(s, blastResult, r, typeCluster)) result = true;

        return result;
      }
    }

    if (region != null) s = cutRegion(s, blastResult, region);

    PhyloClusterAnalysis.Result r = a.run(s);
    ScanAnalysis.Result scanResult = checkBootScan(a, s);

    String phyloName = "phylogenetic subgenogroup analysis within " + typeCluster.getId();

    /*
     * If we are clustering with the outgroup, then clearly we could not identify a variant.
     *
     * WARNING: the following test is based on a variant cluster to start with the same
     * name as the genotype for which it is a variant!
     * This is to differentiate with the outgroup. It would be better to mark the
     * outgroup with some attribute ?
     */

    if (r == null
        || (scanResult != null && !scanResult.haveSupport())
        || r.getConcludedCluster() == null
        || !r.getConcludedCluster().getId().contains(typeCluster.getId())
        || !r.haveSupport())
      conclude("Could not assign", "Not supported by " + phyloName, "subtype", region);
    else
      conclude(
          r,
          new WString("Supported with " + phyloName + " and bootstrap {1} (&gt;= {2})")
              .arg(r.getConcludedSupport())
              .arg(a.getCutoff()),
          "subtype",
          region);

    return true;
  }