forked from CEG-ICRISAT/Raspberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqc.c
More file actions
88 lines (86 loc) · 2.47 KB
/
qc.c
File metadata and controls
88 lines (86 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Raspberry, a qc tool for processing large sets of fastq files quickly
Authors: AVSK Mohan Katta, Aamir Khan, Dadakhalandar Doddamani, Rajeev Varshney
Center of Excellence in Genomics
ICRISAT, India
License GPL V3
*/
#include<stdio.h>
#include<stdlib.h>
#include<Judy.h>
#include<omp.h>
#include "qc.h"
void help(){
fprintf(stderr, "Raspberry is a fast QC tool for parallel and batch processing of NGS reads in FASTQ format.\
The tool accepts both compressed and decompressed FASTQ format files.\
It has been developed and tested with data from Illumina HiSeq and Miseq platform.\
For more details just run raspberry at shell \n\n \
Computational Genomics Group, CEG, ICRISAT, Patancheru, India 2015\
");
fprintf(stderr, "\n");
fprintf(stderr, "Usage: raspberry [-v] [-p <int>] [-t <int>] *.fastq.gz | *.fastq\n");
fprintf(stderr, "Options \n-p\t phred offset [default: 33]\n");
fprintf(stderr, "-t\t number of threads [default: as available on the machine]\n");
fprintf(stderr, "-v\t print version number\n");
}
int offset = 33;
COUNTS_INIT;
void run_parallel(int offset, int n_fastq_files, Pvoid_t PJLArray, int nt){
int k;
PWord_t PValue;
if (!nt) nt = omp_get_num_procs();
omp_set_num_threads(nt);
#pragma omp parallel
{
//printf("number of procs: %d\n", nt);
#pragma omp for ordered
for(k=0; k < n_fastq_files; ++k){
JLG(PValue, PJLArray, k);
stats((unsigned char*) *PValue, offset);
}
}
}
int main(int argc, char** argv){
int key, nthreads = 0;
//process options
while((key = getopt(argc, argv, "p:t:v")) >= 0){
switch(key){
case 'p':
offset = atoi(optarg);
break;
case 't':
nthreads = atoi(optarg);
break;
case 'v':
printf("v%.1f\n\n",0.3);
//break;
return 0;
default:
help();
break;
return 0;
}
}
if(optind == argc){
help();
return 0;
}
//remaining non-option args
int n = argc - optind;
Pvoid_t PJLArray = (Pvoid_t) NULL;
PWord_t PValue;
Word_t Index, Rc_word;
Word_t n_fastq_files;
// read the rest of the args into an array
for(Index=0; Index < n; ++Index){
JLI(PValue, PJLArray, Index);
*PValue = (Word_t) argv[optind++];
}
//find total # indexes
JLC(n_fastq_files, PJLArray, 0, -1);
//printf("number of files on cmd line:%lu\n", n_fastq_files);
//run main task
run_parallel(offset, n_fastq_files, PJLArray, nthreads);
JLFA(Rc_word, PJLArray);
return 0;
}