Skip to content

Commit

Permalink
Merge pull request #63 from andrewjpage/master
Browse files Browse the repository at this point in the history
sliding window at half minimum window size
  • Loading branch information
andrewjpage committed Feb 28, 2013
2 parents 0e561fd + f97c625 commit bb287fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/branch_sequences.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void get_likelihood_for_windows(char * child_sequence, int length_of_sequence, i
// start at the coordinate of the first snp
window_start_coordinate = snp_site_coords[0];

int number_of_windows = (int) ceil(branch_genome_size/window_size);
int number_of_windows = branch_genome_size;
// start coordinate, end coordinate, likelihood

int * block_coordinates[2];
Expand All @@ -366,7 +366,7 @@ void get_likelihood_for_windows(char * child_sequence, int length_of_sequence, i
block_coordinates[1] = (int *) malloc((number_of_windows+1)*sizeof(int));
number_of_blocks = 0;

for(i = 0; i < ceil(branch_genome_size*1.0/window_size); i++)
for(i = 0; i < branch_genome_size; i++)
{
window_end_coordinate = get_window_end_coordinates_excluding_gaps(window_start_coordinate, window_size, snp_locations, child_sequence,length_of_sequence);

Expand All @@ -387,7 +387,8 @@ void get_likelihood_for_windows(char * child_sequence, int length_of_sequence, i
}

int current_window_start_coordinate = window_start_coordinate;
window_start_coordinate = window_end_coordinate;
// Minimum statistically significant window size divided by 2 (Nyquist).
window_start_coordinate += (int) MIN_WINDOW_SIZE/2;
// Move to next snp, more efficient but then the adjacent block check doesnt work.
//window_start_coordinate = advance_window_start_to_next_snp(window_start_coordinate, snp_site_coords, child_sequence, number_of_branch_snps);s

Expand Down
4 changes: 2 additions & 2 deletions src/gff_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ void print_gff_header(FILE * gff_file_pointer, int genome_length)
fflush(gff_file_pointer);
}

void print_gff_line(FILE * gff_file_pointer, int start_coordinate, int end_coordinate, int number_of_snps, int current_node_id, int parent_node_id, char * taxon_names)
void print_gff_line(FILE * gff_file_pointer, int start_coordinate, int end_coordinate, int number_of_snps, char * current_node_id, char * parent_node_id, char * taxon_names)
{
fprintf(gff_file_pointer, "SEQUENCE\tGUBBINS\tCDS\t");
fprintf(gff_file_pointer, "%d\t",start_coordinate);
fprintf(gff_file_pointer, "%d\t",end_coordinate);
fprintf(gff_file_pointer, "0.000\t.\t0\t");

fprintf(gff_file_pointer, "node=\"%d->%d\";", parent_node_id, current_node_id );
fprintf(gff_file_pointer, "node=\"%s->%s\";", parent_node_id, current_node_id );
fprintf(gff_file_pointer, "taxa=\"%s\";", taxon_names);
fprintf(gff_file_pointer, "snp_count=\"%d\"", number_of_snps);
fprintf(gff_file_pointer, "\n");
Expand Down
2 changes: 1 addition & 1 deletion src/gff_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
#ifndef _GFF_FILE_H_
#define _GFF_FILE_H_
void print_gff_header(FILE * gff_file_pointer, int genome_length);
void print_gff_line(FILE * gff_file_pointer, int start_coordinate, int end_coordinate, int number_of_snps, int current_node_id, int parent_node_id, char * taxon_names);
void print_gff_line(FILE * gff_file_pointer, int start_coordinate, int end_coordinate, int number_of_snps, char * current_node_id, char * parent_node_id, char * taxon_names);
#endif

0 comments on commit bb287fe

Please sign in to comment.