当前位置: 首页>>代码示例>>C++>>正文


C++ CI::get_CI方法代码示例

本文整理汇总了C++中CI::get_CI方法的典型用法代码示例。如果您正苦于以下问题:C++ CI::get_CI方法的具体用法?C++ CI::get_CI怎么用?C++ CI::get_CI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI的用法示例。


在下文中一共展示了CI::get_CI方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: compute_preliminary_blocks

void AlgorithmMIG::compute_preliminary_blocks() throw (Exception) {
	CI* ci = NULL;

	long double* w_values = NULL;
	long double w_values_sum = 0.0;

	double lower_ci = 0.0;
	double upper_ci = 0.0;

	preliminary_block* new_strong_pairs = NULL;

	n_preliminary_blocks = 0u;

	ci = CIFactory::create(ci_method, likelihood_density);
	ci->set_dbview(db);

	w_values = (long double*)malloc(db->n_markers * sizeof(long double));
	if (w_values == NULL) {
		throw Exception(__FILE__, __LINE__, "Error in memory allocation.");
	}

	for (unsigned int i = 0u; i < db->n_markers; ++i) {
		w_values[i] = 0.0;
	}

	for (unsigned int i = 1u; i < db->n_markers; ++i) {
		w_values_sum = 0.0;
		for (long int j = i - 1u; j >= 0; --j) {
			ci->get_CI(i, j, &lower_ci, &upper_ci);
			if (!ISNAN(lower_ci) && !ISNAN(upper_ci)) {
				if (((auxiliary::fcmp(lower_ci, pos_strong_pair_cl, EPSILON) >= 0) && (auxiliary::fcmp(upper_ci, pos_strong_pair_cu, EPSILON) >= 0)) ||
						((auxiliary::fcmp(lower_ci, neg_strong_pair_cu, EPSILON) <= 0) && (auxiliary::fcmp(upper_ci, neg_strong_pair_cl, EPSILON) <= 0))) {
					w_values_sum += strong_pair_weight;
					w_values[j] += w_values_sum;
					if (auxiliary::fcmp(w_values[j], 0.0, EPSILON) >= 0) {
						if (n_preliminary_blocks >= preliminary_blocks_size) {
							preliminary_blocks_size += PRELIMINARY_BLOCKS_SIZE_INCREMENT;
							new_strong_pairs = (preliminary_block*)realloc(preliminary_blocks, preliminary_blocks_size * sizeof(preliminary_block));
							if (new_strong_pairs == NULL) {
								delete ci;
								ci = NULL;

								free(w_values);
								w_values = NULL;

								throw Exception(__FILE__, __LINE__, "Error in memory reallocation.");
							}
							preliminary_blocks = new_strong_pairs;
							new_strong_pairs = NULL;
						}

						preliminary_blocks[n_preliminary_blocks].start = j;
						preliminary_blocks[n_preliminary_blocks].end = i;
						preliminary_blocks[n_preliminary_blocks].length_bp = db->positions[i] - db->positions[j];

						++n_preliminary_blocks;
					}
				} else if ((auxiliary::fcmp(lower_ci, neg_recomb_pair_cu, EPSILON) >= 0) && (auxiliary::fcmp(upper_ci, pos_recomb_pair_cu, EPSILON) <= 0)) {
					w_values_sum -= recomb_pair_weight;
					w_values[j] += w_values_sum;
				} else {
					w_values[j] += w_values_sum;
				}
			} else {
				w_values[j] += w_values_sum;
			}
		}
	}

	delete ci;
	ci = NULL;

	free(w_values);
	w_values = NULL;
}
开发者ID:cran,项目名称:LDExplorer,代码行数:75,代码来源:AlgorithmMIG.cpp


注:本文中的CI::get_CI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。