<commit_before>/*
Raspberry, a qc tool for processing large sets of fastq files quickly
Authors:  <NAME>, <NAME>, <NAME>, <NAME>
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 [-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");
}
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:")) >= 0){
    switch(key){
    case 'p':  
        offset = atoi(optarg);
        break;
    case 't':
        nthreads = atoi(optarg);
        break;        
    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;
    Word_t n_fastq_files;
// read the rest of the args into  a judy 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);
return 0;
}
<commit_msg>Minor change  Free memory of the commandline option list - done<commit_after>/*
Raspberry, a qc tool for processing large sets of fastq files quickly
Authors:  AVSK <NAME>, <NAME>, <NAME>, <NAME>
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 [-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");
}
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:")) >= 0){
    switch(key){
    case 'p':  
        offset = atoi(optarg);
        break;
    case 't':
        nthreads = atoi(optarg);
        break;        
    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;
}

{'fraction_non_alphanumeric': 0.13182199832073888, 'fraction_numerical': 0.007556675062972292, 'mean_word_length': 3.1470844212358573, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1380532', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1695, 'n_words': 544}