Exemple #1
0
def _allele_count_linear_selector(allele_counter, model_conf, region,
                                  expanded_region):
    """Returns a list of candidate positions.

  Candidate positions for realignment are generated by scoring each location.
  The score at a location is a weighted sum of the number of reads with each
  CIGAR operation at the location, where the weights are determined by the model
  coefficients. Locations whose score exceed the model decision boundary value
  are used to create realignment windows.

  Args:
    allele_counter: learning.genomics.deepvariant.realigner.AlleleCounter in the
      considered region.
    model_conf: learning.genomics.deepvariant.realigner
      .WindowSelectorOptions.AlleleCountLinearModel
      options determining the behavior of this window selector.
    region: nucleus.protos.Range. The region we are processing.
    expanded_region: nucleus.protos.Range. The region we are processing.

  Returns:
    A list. The elements are reference positions within region.
  """

    scores_vec = (
        cpp_window_selector.allele_count_linear_candidates_from_allele_counter(
            allele_counter, model_conf))

    return [
        expanded_region.start + i for i, score in enumerate(scores_vec)
        if score > model_conf.decision_boundary and ranges.position_overlaps(
            region.reference_name, expanded_region.start + i, region)
    ]
 def test_position_overlaps(self, interval, chrom, pos, expected):
   self.assertEqual(ranges.position_overlaps(chrom, pos, interval), expected)
 def passes_region_filter(variant):
   for r in regions:
     if ranges.position_overlaps(variant.reference_name, variant.start, r):
       return True
   return False