Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cnvCallerGPU
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gad-public
cnvCallerGPU
Commits
51d0f376
Commit
51d0f376
authored
Jan 25, 2025
by
Yannis Duffourd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding cpp version
parent
35e59a9c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
+97
-0
cnvCaller.cu
cnvCaller.cu
+97
-0
cnvCallerGPU.cpp
cnvCallerGPU.cpp
+0
-0
cnvCallerGPU.h
cnvCallerGPU.h
+0
-0
main.cpp
main.cpp
+0
-0
No files found.
cnvCaller.cu
0 → 100644
View file @
51d0f376
// cnvCaller.cu
// Version : 1.1.0
// Description : C++/CUDA kernels to compute information needed by cnvcallerGPU
// Author: Theo.Serralta@u-bourgogne.fr ; yannis.duffourd@u-bourgogne.fr ; anthony.auclair@u-bourgogne.fr
#include <cuda_runtime.h>
// Kernel to compute raw average depth
__global__ void computeDepthKernel(int *depth_data, int seq_length, int window_size, int step_size, float *depth_results) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < seq_length - window_size + 1) {
int pos_start = (idx * step_size);
int pos_end = pos_start + window_size;
int count_reads = 0;
for (int i = pos_start; i < pos_end; i++) {
count_reads += depth_data[i];
}
depth_results[idx] = static_cast<float>(count_reads) / window_size;
}
}
// NEED TO OPTIMIZE WITH 3RD DEGREE POLYNOME
// Kernel to normalize depth using GC content and mappability
__global__ void normalizeDepthKernel(float *depth_correction, float *gc_results, float *map_results,
float mean_depth, float *gc_to_median, int seq_length,
int window_size, int step_size, float *normalized_depth) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < seq_length - window_size + 1) {
float gc_value = gc_results[idx];
float map_value = map_results[idx];
float depth_value = depth_correction[idx];
// Récupérer la médiane du GC content
float gc_median = gc_to_median[(int)gc_value];
// Vérifier les valeurs pour éviter des erreurs (division par zéro)
if (gc_median != 0.0f && map_value != 0.0f) {
normalized_depth[idx] = (depth_value / map_value) * (mean_depth / gc_median);
} else {
normalized_depth[idx] = 0.0f;
}
}
}
// Kernel to compute GC content in a sliding window
__global__ void computeGCKernel(char *seq_data, int seq_length, int window_size, int step_size, float *gc_results) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < seq_length - window_size + 1) {
int pos_start = (idx * step_size);
int pos_end = pos_start + window_size;
int gc_count = 0;
for (int i = pos_start; i < pos_end; ++i) {
char base = seq_data[i];
if (base == 'G' || base == 'C' || base == 'g' || base == 'c') {
gc_count++;
}
}
gc_results[idx] = (static_cast<float>(gc_count) / window_size) * 100.0f;
}
}
// Kernel to compute weighted average mappability
__global__ void computeMappabilityKernel(float *map_data, int seq_length, int window_size, int step_size, float *map_results) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < seq_length - window_size + 1) {
int pos_start = (idx * step_size);
int pos_end = pos_start + window_size;
float weighted_sum = 0.0f;
float total_weight = 0.0f;
for (int i = pos_start; i < pos_end; ++i) {
float weight = map_data[i];
weighted_sum += weight;
total_weight += 1.0f;
}
map_results[idx] = (total_weight > 0.0f) ? (weighted_sum / total_weight) : 0.0f;
}
}
// Kernel to compute Z-score
__global__ void computeZScoreKernel(float *normalized_depth, float mean_ratio, float std_ratio, int seq_length, float *z_score_results) {
int idx = threadIdx.x + blockIdx.x * blockDim.x;
if (idx < seq_length) {
float value = normalized_depth[idx];
if (isinf(value) || isnan(value)) {
value = 0.0f;
}
z_score_results[idx] = (value - mean_ratio) / std_ratio;
}
}
\ No newline at end of file
cnvCallerGPU.cpp
0 → 100644
View file @
51d0f376
cnvCallerGPU.h
0 → 100644
View file @
51d0f376
main.cpp
0 → 100644
View file @
51d0f376
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment