Skip to content

Commit

Permalink
The genome directory should always end in /, but that was not made cl…
Browse files Browse the repository at this point in the history
…ear previously. That has been fixed and now one should not actually have to end the directory name with a /
  • Loading branch information
dpryan79 committed Feb 27, 2014
1 parent 706ecee commit 0c79e51
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
9 changes: 7 additions & 2 deletions auxiliary/CpG_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void next_line(FILE *fp, char *buffer) {
}

void usage(char *prog) {
printf("Usage: %s [OPTIONS] genome_directory input.bedGraph output.txt\n", prog);
printf("Usage: %s [OPTIONS] genome_directory/ input.bedGraph output.txt\n", prog);
printf("\n\
Calculate a histogram of per-CpG coverage. N.B., the genome and bedGraph\n\
file need to be in the same order (they will be if the bedGraph file was\n\
Expand Down Expand Up @@ -69,7 +69,11 @@ int main(int argc, char *argv[]) {
i++;
chromosomes.max_genome = strtoull(argv[i], NULL, 10);
} else if(config.genome_dir == NULL) {
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(iname == NULL) {
iname = argv[i];
} else if(oname == NULL) {
Expand Down Expand Up @@ -139,6 +143,7 @@ int main(int argc, char *argv[]) {
printf("There were %llu CpGs\n", nCpGs);

//Close things up
if(config.genome_dir != NULL) free(config.genome_dir);
free(line);
free(chromosomes.genome);
for(i=0; i<chromosomes.nchromosomes; i++) {
Expand Down
9 changes: 7 additions & 2 deletions auxiliary/bedGraph2methylKit.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct CpG {
};

void usage(char *prog) {
printf("Usage: %s [OPTIONS] genome_directory file.bedGraph\n", prog);
printf("Usage: %s [OPTIONS] genome_directory/ file.bedGraph\n", prog);
printf("\n\
Convert a CpG bedGraph file to the format required for methylKit.\n\
The CpGs in the file should not be merged (i.e., they should represent\n\
Expand Down Expand Up @@ -104,7 +104,11 @@ int main(int argc, char *argv[]) {
usage(argv[0]);
return 0;
} else if(config.genome_dir == NULL) {
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(fname == NULL) {
fname = argv[i];
} else if(strcmp(argv[i], "--genome-size") == 0) {
Expand Down Expand Up @@ -159,6 +163,7 @@ int main(int argc, char *argv[]) {
}

//Close things up
if(config.genome_dir != NULL) free(config.genome_dir);
free(line);
fclose(of);
fclose(ifile);
Expand Down
9 changes: 7 additions & 2 deletions auxiliary/merge_CpGs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct CpG {
};

void usage(char *prog) {
printf("Usage: %s [OPTIONS] genome_directory file.bedGraph [file2.bedGraph file3.bedGraph]\n", prog);
printf("Usage: %s [OPTIONS] genome_directory/ file.bedGraph [file2.bedGraph file3.bedGraph]\n", prog);
printf("\n\
Merge strand metrics for individual CpG calls (i.e. if there are separate\n\
methylation metrics for the C's on the + and - strand of a CpG site, combine\n\
Expand Down Expand Up @@ -112,7 +112,11 @@ int main(int argc, char *argv[]) {
} else if(strcmp(argv[i], "--genome-size") == 0) {
chromosomes.max_genome = strtoull(argv[++i], NULL, 10);
} else if(config.genome_dir == NULL) {
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(fstart == -1) {
fstart = i;
break;
Expand Down Expand Up @@ -216,6 +220,7 @@ int main(int argc, char *argv[]) {
}

//Close things up
if(config.genome_dir != NULL) free(config.genome_dir);
free(line);
free(chromosomes.genome);
for(i=0; i<chromosomes.nchromosomes; i++) {
Expand Down
9 changes: 7 additions & 2 deletions herd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <wordexp.h>

void usage(char *prog) {
printf("Usage: %s [OPTIONS] -g genome_dir {-1 fastq_A1.gz,fastq_B1.gz -2 fastq_A2.gz,fastq_B2.gz | -U fastq.gz}\n", prog);
printf("Usage: %s [OPTIONS] -g genome_dir/ {-1 fastq_A1.gz,fastq_B1.gz -2 fastq_A2.gz,fastq_B2.gz | -U fastq.gz}\n", prog);
printf("\n \
N.B., Bison has a number of defaults that are different from that of bowtie2.\n \
All of these can be changed with the normal bowtie2 options, which change\n \
Expand Down Expand Up @@ -162,6 +162,7 @@ int main(int argc, char *argv[]) {
config.n_compression_threads = 0;
config.unmapped1 = NULL;
config.unmapped2 = NULL;
config.genome_dir = NULL;
global_header = NULL;
unmapped1 = NULL;
unmapped2 = NULL;
Expand Down Expand Up @@ -215,7 +216,11 @@ int main(int argc, char *argv[]) {
config.FASTQ1 = argv[i];
} else if(strcmp(argv[i], "-g") == 0) {
i++;
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(strcmp(argv[i], "-p") == 0) {
i++;
config.nthreads = atoi(argv[i]);
Expand Down
8 changes: 7 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ int main(int argc, char *argv[]) {
config.quiet = 0;
config.FASTQ1 = NULL;
config.FASTQ2 = NULL;
config.genome_dir = NULL;
chromosomes.max_genome = 3000000000;
chromosomes.nchromosomes = 0; //We need to initialize the struct

Expand Down Expand Up @@ -154,7 +155,11 @@ int main(int argc, char *argv[]) {
config.FASTQ1 = argv[i];
} else if(strcmp(argv[i], "-g") == 0) {
i++;
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(strcmp(argv[i], "-p") == 0) {
i++;
config.nthreads = atoi(argv[i]);
Expand Down Expand Up @@ -387,6 +392,7 @@ int main(int argc, char *argv[]) {

//Clean up
if(config.odir != NULL) free(config.odir);
if(config.genome_dir != NULL) free(config.genome_dir);
quit(3, 0);
return 0;
}
9 changes: 7 additions & 2 deletions methylation_extractor.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ void fill_bounds(char *str, int bounds[4]) {
}

void usage(char *prog) {
printf("Usage: %s [OPTIONS] genome_directory input.(sam|bam)\n", prog);
printf("Usage: %s [OPTIONS] genome_directory/ input.(sam|bam)\n", prog);
printf("\n\
Extract methylation information into a bedGraph file or files. By default,\n\
only CpG metrics are output\n\
Expand Down Expand Up @@ -883,7 +883,11 @@ int main(int argc, char *argv[]) {
} else if (strcmp(argv[i], "-CTOB") == 0) {
fill_bounds(argv[++i], CTOB);
} else if(config.genome_dir == NULL) {
config.genome_dir = argv[i];
config.genome_dir = strdup(argv[i]);
if(*(config.genome_dir+strlen(config.genome_dir)-1) != '/') {
config.genome_dir = realloc(config.genome_dir, sizeof(char) * (strlen(config.genome_dir)+2));
sprintf(config.genome_dir, "%s/", config.genome_dir);
}
} else if(strcmp(argv[i], "--genome-size") == 0) {
i++;
chromosomes.max_genome = strtoull(argv[i], NULL, 10);
Expand Down Expand Up @@ -1000,6 +1004,7 @@ int main(int argc, char *argv[]) {
free(*(chromosomes.chromosome+i));
}
free(chromosomes.chromosome);
if(config.genome_dir != NULL) free(config.genome_dir);
destroy_methyl_list(CpGlist);
destroy_methyl_list(CHGlist);
destroy_methyl_list(CHHlist);
Expand Down

0 comments on commit 0c79e51

Please sign in to comment.