private ScanAnalysis.Result checkBootScan(PhyloClusterAnalysis pca, AbstractSequence s) throws AnalysisException { ScanAnalysis sa = null; try { sa = (ScanAnalysis) pca.getOwner().getAnalysis(pca.getId() + "-scan"); } catch (Exception e) { /* If not available */ return null; } return sa.run(s); }
/** * @param pca phylogenetic analysis to run * @param s sequence * @param blastResult genus matched * @param region region used for this analysis */ private void phyloAnalysis( PhyloClusterAnalysis pca, AbstractSequence s, Result blastResult, Region region) throws AnalysisException, IOException, ParameterProblemException, FileFormatException { PhyloClusterAnalysis.Result r = pca.run(s); ScanAnalysis.Result scanResult = checkBootScan(pca, s); if (r.haveSupport() && (scanResult == null || scanResult.haveSupport())) { conclude( r, new WString("Supported with phylogenetic analysis and bootstrap {1} (>= {2})") .arg(r.getConcludedSupport()) .arg(pca.getCutoff()), "type", region); subgenogroupPhyloAnalysis(s, blastResult, region, r.getConcludedCluster()); } else conclude("Could not assign", "Not supported by phylogenetic analysis", "type", region); }
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} (>= {2})") .arg(r.getConcludedSupport()) .arg(a.getCutoff()), "subtype", region); return true; }