Skip to content

Commit

Permalink
Modularise functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Apr 23, 2024
1 parent 5478d65 commit 000a04a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/parse_phylip.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,21 @@ int get_internal_node(int sequence_index)
void get_sequence_for_sample_name(char * sequence_bases, char * sample_name)
{
int sequence_index;
sequence_index = find_sequence_index_from_sample_name( sample_name);
sequence_index = find_sequence_index_from_sample_name(sample_name);
if(sequence_index < 0)
{
printf("Couldnt find sequence name %s with index %d\n", sample_name,sequence_index);
printf("Could not find sequence name %s with index %d\n", sample_name,sequence_index);
exit(1);
}
get_sequence_for_sample_index(sequence_bases, sequence_index);

}

void get_sequence_for_sample_index(char * sequence_bases, int sequence_index)
{
memcpy(sequence_bases, sequences[sequence_index], size_of_string(sequences[sequence_index]) +1);
}


void fill_in_unambiguous_gaps_in_parent_from_children(int parent_sequence_index, int * child_sequence_indices, int num_children)
{
int snp_counter = 0;
Expand Down
1 change: 1 addition & 0 deletions src/parse_phylip.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
} sample_statistics;

void get_sequence_for_sample_name(char * sequence_bases, char * sample_name);
void get_sequence_for_sample_index(char * sequence_bases, int sequence_index);
int find_sequence_index_from_sample_name( char * sample_name);
int update_sequence_base(char new_sequence_base, int sequence_index, int base_index);
int does_column_contain_snps(int snp_column, char reference_base);
Expand Down

0 comments on commit 000a04a

Please sign in to comment.