示例#1
0
bool hang_next(
	panda_seq_identifier *id,
	const panda_qual **forward,
	size_t *forward_length,
	const panda_qual **reverse,
	size_t *reverse_length,
	void *user_data) {
	struct hang_data *data = (struct hang_data *) user_data;
	while (data->next(id, forward, forward_length, reverse, reverse_length, data->next_data)) {
		size_t offset;
		if (data->forward_length > 0) {
			offset = panda_compute_offset_qual(data->threshold, true, *forward, *forward_length, data->forward, data->forward_length);
			if (offset == 0) {
				panda_log_proxy_write(data->logger, PANDA_CODE_NO_FORWARD_PRIMER, NULL, id, "OVERHANGING REJECT");
				if (!data->skip)
					continue;
			} else {
				*forward_length -= offset - 1;
			}
		}
		if (data->reverse_length > 0) {
			offset = panda_compute_offset_qual(data->threshold, true, *reverse, *reverse_length, data->reverse, data->reverse_length);
			if (offset == 0) {
				panda_log_proxy_write(data->logger, PANDA_CODE_NO_REVERSE_PRIMER, NULL, id, "OVERHANGING REJECT");
				if (!data->skip)
					continue;
			} else {
				*reverse_length -= offset - 1;
			}
		}
		return true;
	}
	return false;
}
static bool precheck_func(
	PandaLogProxy logger,
	const panda_seq_identifier *id,
	const panda_qual *forward,
	size_t forward_length,
	const panda_qual *reverse,
	size_t reverse_length,
	struct data *data) {

	(void) logger;
	(void) id;

	return panda_compute_offset_qual(log(0.9), 0.01, !data->forward, data->forward ? forward : reverse, data->forward ? forward_length : reverse_length, data->primer, data->primer_length) == 0;
}