Exemplo n.º 1
0
 private List<ClusteredResult> filterClusteredResult(List<ClusteredResult> crList) {
   List<ClusteredResult> filteredList = new ArrayList<ClusteredResult>();
   for (ClusteredResult cr : crList)
     if (!cr.updatedResult.isEmpty())
       if (cr.updatedResult.get(0).confidence >= minconf
           && cr.score >= minClusterScore
           && (minClusterFragRatio == -1 || cr.getFragRatio() >= minClusterFragRatio)
           && (minClusterMapSigRatio == -1 || cr.getMapSigRatio() >= minClusterMapSigRatio))
         filteredList.add(cr);
   return filteredList;
 }
Exemplo n.º 2
0
  private List<ClusteredResult> standardnocluster(List<OptMapResultNode> mapList) {
    List<ClusteredResult> clusteredResultList = new ArrayList<ClusteredResult>();
    //		VirtualMapProcessor vmProcessor1 = new VirtualMapProcessor(optrefmap, indelPenalty,
    // inversionPenalty, translocationPenalty, indelFilter, inversionFilter, match, fpp, fnp,
    // localPenalty);

    for (OptMapResultNode result : mapList) {
      List<OptMapResultNode> rmapList = new ArrayList<OptMapResultNode>();
      rmapList.add(result);
      ClusteredResult cr = new ClusteredResult();
      //			cr.importOriginalResult(rmapList);
      cr.importUpdatedResult(rmapList);
      cr.score = result.mappedscore;
      //			cr.process();
      //			if (cr.score < mins)
      //				mins = cr.score;

      clusteredResultList.add(cr);
    }
    return clusteredResultList;
  }
Exemplo n.º 3
0
  /**
   * Cluster the results by using 1. Path builder filter which limits indel, inversion and
   * translocation 2. vmProcessor to calculate the score
   *
   * <p>The logic includes two steps 1. Grouping 2. Build paths between partial maps (which may
   * undergo trimming) 3. Link paths to paths (not partial maps to partial maps) 4. Get the path
   * with best score and convert it back to partial maps
   *
   * @param mapList
   * @param pbFilter
   * @param vmProcessor
   * @return
   */
  private List<ClusteredResult> cluster(
      List<OptMapResultNode> mapList, PathBuilderFilter pbFilter, VirtualMapProcessor vmProcessor) {
    // exit if no result is input
    if (mapList == null || mapList.size() == 0) return new ArrayList<ClusteredResult>();

    // Pre-update the results
    for (OptMapResultNode result : mapList) vmProcessor.calcScore(result);

    List<ClusteredResult> clusteredResultList = new ArrayList<ClusteredResult>();

    // Grouping close results to be 1. clustered effectively 2. output one clustered result per
    // group
    List<List<OptMapResultNode>> groupedMapList =
        group(mapList, pbFilter.sameStrand, pbFilter.closeReference, pbFilter.closeFragment);

    // In each result group
    for (List<OptMapResultNode> groupedMap : groupedMapList) {
      // Build a path whenever the results can be joined
      // Please see ClusterPathNode for details
      List<ClusterPathNode> clusterPathList = buildPath(groupedMap, pbFilter, vmProcessor);
      // Link the paths
      linkPath(clusterPathList, vmProcessor);
      // Get the best path and extract the final result maps
      List<OptMapResultNode> clusteredGroupMap =
          convertPathToMapList(getBestPath(clusterPathList), vmProcessor);
      //			if (false)
      //			{
      //				for (ClusterPathNode cp : clusterPathList) {
      //					if (cp.currentScore < 0)
      //						continue;
      //					if (cp.secondMap != null)
      //						continue;
      //					List<ClusterPathNode> bestPath = new ArrayList<ClusterPathNode>();
      //					ClusterPathNode recentPath = cp;
      //					while (recentPath != null)
      //					{
      //						bestPath.add(recentPath);
      //						recentPath = recentPath.previousPath;
      //					}
      //					Collections.reverse(bestPath);
      //					if (convertPathToMapList(bestPath).isEmpty())
      //						continue;
      //					System.out.println("PATH - " + cp.currentScore);
      //					for (OptMapResultNode result : convertPathToMapList(bestPath))
      //						System.out.println(result);
      //				}
      //			}
      ClusteredResult cr = new ClusteredResult();
      // We want to retain the original alignments
      List<OptMapResultNode> expandedGroupedMap =
          new ArrayList<OptMapResultNode>(); // Saving the original results
      for (OptMapResultNode map : groupedMap) expandedGroupedMap.addAll(map.getRealMap());

      // We want to import the modified alignments
      List<OptMapResultNode> expandedClusterGroupMap =
          new ArrayList<OptMapResultNode>(); // Saving the updated results
      for (OptMapResultNode map : clusteredGroupMap)
        expandedClusterGroupMap.addAll(map.getRealMap());

      //			checkDirectLink(expandedClusterGroupMap, vmProcessor);
      cr.importUpdatedResult(expandedClusterGroupMap);
      if (cr.updatedResult.size() > 0) {

        cr.process(vmProcessor);
        clusteredResultList.add(cr);
      }
    }
    return clusteredResultList;
  }