void CrossHypotheses::FillInPrediction(PersistingThreadObjects &thread_objects, ExtendedReadInfo &my_read, InputStructures &global_context) {

  // Check validity of input arguments
  if (my_read.start_flow < 0 or my_read.start_flow >= global_context.treePhaserFlowOrder.num_flows()) {
    cerr << "CrossHypotheses::FillInPrediction: Start flow needs to be be larger than zero and smaller than the number of flows." << endl;
    cerr << "Start flow: " << my_read.start_flow << " Number of flows: " << global_context.treePhaserFlowOrder.num_flows();
    assert(my_read.start_flow >= 0 and my_read.start_flow < global_context.treePhaserFlowOrder.num_flows());
  }
  if (my_read.phase_params.size() != 3) {
    cerr << "CrossHypotheses::FillInPrediction: There need to be 3 phase parameters!" << endl;
    assert(my_read.phase_params.size() != 3);
  }
  for (int i=0; i<3; i++) {
    if (my_read.phase_params[i] < 0 or my_read.phase_params[i] > 1) {
      cerr << "CrossHypotheses::FillInPrediction: Phase parameters should be positive and smaller than one!" << endl;
      assert(my_read.phase_params[i] >= 0 and my_read.phase_params[i] <= 1);
    }
  }

  // allocate everything here
  CleanAllocate(instance_of_read_by_state.size(), global_context.treePhaserFlowOrder.num_flows());

  max_last_flow = CalculateHypPredictions(thread_objects, my_read, global_context,
                                     instance_of_read_by_state, predictions, normalized);
  SetModPredictions();
  if (my_read.alignment.AlignmentFlag>0)
    strand_key = 1;
  else
    strand_key = 0;
}
void CrossHypotheses::FillInPrediction(PersistingThreadObjects &thread_objects, const Alignment& my_read, const InputStructures &global_context) {


    // allocate everything here
    CleanAllocate(instance_of_read_by_state.size(), global_context.treePhaserFlowOrder.num_flows());
    int flow_upper_bound = splice_end_flow + 4*min_delta_for_flow;
    max_last_flow = CalculateHypPredictions(thread_objects, my_read, global_context,
                                            instance_of_read_by_state, predictions, normalized, flow_upper_bound);
    SetModPredictions();
    if (my_read.is_reverse_strand)
        strand_key = 1;
    else
        strand_key = 0;
}
Beispiel #3
0
void CrossHypotheses::FillInPrediction(PersistingThreadObjects &thread_objects, const Alignment& my_read, const InputStructures &global_context) {
  // allocate everything here
  CleanAllocate(instance_of_read_by_state.size(), global_context.flow_order_vector.at(my_read.flow_order_index).num_flows());
  // We search for test flows in the flow interval [(splice_start_flow-3*max_flows_to_test), (splice_end_flow+4*max_flows_to_test)]
  // We need to simulate further than the end of the search interval to get good predicted values within
  int flow_upper_bound = splice_end_flow + 4*max_flows_to_test + 20;
  max_last_flow = CalculateHypPredictions(thread_objects, my_read, global_context, instance_of_read_by_state,
                                          same_as_null_hypothesis, predictions_all_flows, normalized_all_flows, flow_upper_bound);
  SetModPredictions();
  if (my_read.is_reverse_strand)
    strand_key = 1;
  else
    strand_key = 0;
}
void CrossHypotheses::InitializeDerivedQualities() {

    InitializeResponsibility(); // depends on hypotheses
    // in theory don't need to compute any but test flows
    SetModPredictions();  // make sure that mod-predictions=predictions
    ComputeBasicResiduals(); // predicted and measured

    InitializeSigma(); // depends on predicted

    my_t.SetV(heavy_tailed);

    ComputeBasicLikelihoods(); // depends on residuals and sigma
    // compute log-likelihoods
    ComputeLogLikelihoods();  // depends on test flow(s)
}