Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data type or modify gap #3

Open
Smeds opened this issue Nov 15, 2024 · 0 comments
Open

New data type or modify gap #3

Smeds opened this issue Nov 15, 2024 · 0 comments

Comments

@Smeds
Copy link

Smeds commented Nov 15, 2024

Would it be possible to have an additional type similar to gap (not "weighted according to the length of the bin and pixel") where the value isn't locked to max 1.0?

if (data_type == data_type_dic["gap"]) { //
// add the value to graph->values
std::unique_lock<std::mutex> lock(mtx_global);
Graph_tmp->values[index] = Min(Max(0.f, (f32)value + Graph_tmp->values[index]), 1.0f); // if set the value vector as f32 array, then we can not use the atomic operation. If mutil-thread is used, then we have to use the mutex to protect the values
lock.unlock();
}
else if (data_type == data_type_dic["repeat_density"]){ // normalise the repeat density data by the length of the bin, and scale that into 0 - 100
f32 valueToAdd_f = (f32)value / (f32)bin_size * (f32)nThisBin / (f32)bp_per_pixel * 100.0f;
if (valueToAdd_f > 100.f) {
printf("Warning: valueToAdd_f is larger than 100: %f\n", valueToAdd_f);
}
std::unique_lock<std::mutex> lock(mtx_global);
Graph_tmp->values[index] += valueToAdd_f;
lock.unlock();
}
else {
f32 valueToAdd_f = (f32)value * (f32)nThisBin / (f32)bp_per_pixel;
// add the value to graph->values
std::unique_lock<std::mutex> lock(mtx_global);
Graph_tmp->values[index] += valueToAdd_f; // if set the value vector as f32 array, then we can not use the atomic operation. If mutil-thread is used, then we have to use the mutex to protect the values
lock.unlock();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant