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
e3c16446
Commit
e3c16446
authored
1 week ago
by
Yannis Duffourd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming into Galacs
parent
51d0f376
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
0 deletions
+155
-0
Galacs.cpp
Galacs.cpp
+0
-0
Galacs.cu
Galacs.cu
+97
-0
Galacs.h
Galacs.h
+58
-0
No files found.
Galacs.cpp
0 → 100644
View file @
e3c16446
This diff is collapsed.
Click to expand it.
Galacs.cu
0 → 100644
View file @
e3c16446
// 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
This diff is collapsed.
Click to expand it.
Galacs.h
0 → 100644
View file @
e3c16446
#ifndef _CNVCALLERGPU_H
#define _CNVCALLERGPU_H
#include <vector>
#include <map>
#include <string>
#include <htslib/sam.h>
class
cnvCallerGPU
{
public
:
cnvCallerGPU
();
cnvCallerGPU
(
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
std
::
string
,
int
,
int
,
double
,
int
,
int
);
int
mainLoop
();
int
getNbThread
();
int
getWindowSize
();
int
getStepSize
();
double
getZscore
();
std
::
string
getOutputFilePairs
();
std
::
string
getOutputFileSplit
();
std
::
string
getOutputFile
();
std
::
string
getReferenceFile
();
std
::
string
getBamFile
();
private
:
std
::
string
sampleName
;
std
::
string
inputBamFile
;
std
::
string
referenceFile
;
std
::
string
outputFile
;
std
::
string
outputFilePairs
;
std
::
string
outputFileSplit
;
std
::
map
<
std
::
string
,
std
::
map
<
int32_t
,
std
::
map
<
int32_t
,
int32_t
>>>
rawCounts
;
std
::
map
<
std
::
string
,
std
::
map
<
int32_t
,
std
::
map
<
int32_t
,
float
>>>
gcContent
;
std
::
map
<
std
::
string
,
std
::
map
<
int32_t
,
int32_t
>>
refDict
;
int
depthThreshold
;
int
nbThread
;
int
loggingLevel
;
int
window
;
int
step
;
double
zscore
;
// method
int
getGenome
();
void
displayGenome
();
int
readBam
(
std
::
string
,
int32_t
,
int32_t
);
int
bamParsingLauncher
();
};
#endif
This diff is collapsed.
Click to expand it.
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