aboutsummaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-03-06 10:34:10 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2014-03-06 10:34:10 -0500
commit219a8ac002a1333e46f03db3d85289120f14cef1 (patch)
tree3161b72a403538f7659b8183bc5f4b5ac8900928 /src/c
parentdda68e7579b2f39643467280490c36aedad8d11a (diff)
fix spacing
Diffstat (limited to 'src/c')
-rw-r--r--src/c/kmer_utils.c42
-rw-r--r--src/c/multifasta_to_otu.c14
2 files changed, 28 insertions, 28 deletions
diff --git a/src/c/kmer_utils.c b/src/c/kmer_utils.c
index 4926788..aa341f3 100644
--- a/src/c/kmer_utils.c
+++ b/src/c/kmer_utils.c
@@ -22,22 +22,22 @@ const unsigned char alpha[256] =
// base-10 index
unsigned long num_to_index(const char *str, const int kmer, const long error_pos) {
- int i = 0;
- unsigned long out = 0;
- unsigned long multiply = 1;
+ int i = 0;
+ unsigned long out = 0;
+ unsigned long multiply = 1;
- for(i = kmer - 1; i >= 0; i--){
+ for(i = kmer - 1; i >= 0; i--){
if(str[i] == 5) {
// position += i;
return error_pos;
}
- out += str[i] * multiply;
- multiply = multiply << 2;
- }
+ out += str[i] * multiply;
+ multiply = multiply << 2;
+ }
- return out;
+ return out;
}
// Strip out any character 'c' from char array 's' into a destination dest (you
@@ -61,30 +61,30 @@ char *strnstrip(const char *s, char *dest, int c, unsigned long long len) {
unsigned long long * get_kmer_counts_from_file(const char *fn, const unsigned int kmer) {
-
- char *line = NULL;
- size_t len = 0;
- ssize_t read;
- long long i = 0;
+ char *line = NULL;
+ size_t len = 0;
+ ssize_t read;
+
+ long long i = 0;
long long position = 0;
- FILE * const fh = fopen(fn, "r");
- if(fh == NULL) {
- fprintf(stderr, "Error opening %s - %s\n", fn, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ FILE * const fh = fopen(fn, "r");
+ if(fh == NULL) {
+ fprintf(stderr, "Error opening %s - %s\n", fn, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
// width is 4^kmer
// there's a sneaky bitshift to avoid pow dependency
const unsigned long width = pow_four(kmer);
// malloc our return array
- unsigned long long * counts = malloc((width+ 1) * sizeof(unsigned long long));
+ unsigned long long * counts = malloc((width+ 1) * sizeof(unsigned long long));
memset(counts, 0, width * sizeof(unsigned long long));
- if(counts == NULL) {
+ if(counts == NULL) {
fprintf(stderr, strerror(errno));
- exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
char *str = malloc(4096);
diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c
index e060fcf..b6b0182 100644
--- a/src/c/multifasta_to_otu.c
+++ b/src/c/multifasta_to_otu.c
@@ -327,29 +327,29 @@ int main(int argc, char **argv) {
printf("sequences: %llu\n", sequences);
}
- unsigned long long *solutions = malloc(dir_count * sequences * sizeof(unsigned long long));
+ unsigned long long *solutions = malloc(dir_count * sequences * sizeof(unsigned long long));
check_malloc(solutions, NULL);
- long long *file_sequence_count = calloc(dir_count, sizeof(long long));
+ long long *file_sequence_count = calloc(dir_count, sizeof(long long));
check_malloc(file_sequence_count, NULL);
#ifdef OMP
- omp_set_num_threads(jobs);
+ omp_set_num_threads(jobs);
#endif
- printf("Beginning to process samples\n");
+ printf("Beginning to process samples\n");
#pragma omp parallel for shared(solutions, sensing_matrix_ptr, width, done, sequences)
- for(size_t i = 0; i < dir_count; i++ ) {
+ for(size_t i = 0; i < dir_count; i++ ) {
size_t x = 0;
size_t y = 0;
size_t z = 0;
unsigned long long file_sequence_count = 0;
- unsigned long long rare_value = 0;
- unsigned long long rare_width = 0;
+ unsigned long long rare_value = 0;
+ unsigned long long rare_width = 0;
double rare_percent = 1.0;