Skip to content

Commit

Permalink
Fix function definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Apr 24, 2024
1 parent cd52952 commit a04050d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
36 changes: 15 additions & 21 deletions src/Newickform.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void populate_parents(newick_node *node, newick_node** nodeArray, int * parents,
}

// Function to initialize the parents list and call the recursive function
int **get_parents(newick_node *root, newick_node** nodeArray, int num_nodes) {
int * get_parents(newick_node *root, newick_node** nodeArray, int num_nodes) {

// Initialise parent node array
int * parents = calloc(num_nodes,sizeof(int));
Expand All @@ -229,15 +229,6 @@ int **get_parents(newick_node *root, newick_node** nodeArray, int num_nodes) {

// Populate the parents list recursively
populate_parents(root, nodeArray, parents, num_nodes);

// Set root parent to NULL
for (int i = 0; i < num_nodes; i++) {
if (parents[i] == -1)
{
parents[i] = NULL;
break;
}
}

return parents;
}
Expand Down Expand Up @@ -426,17 +417,20 @@ newick_node* build_newick_tree(char * filename, FILE *vcf_file_pointer,int * snp
{
int node_index = jobNodeIndexArray[node_num_index];
int parent_node_index = parents[node_index];
fill_in_recombinations_with_gaps(nodeArray,
node_index,
parent_node_index,
parent_recombinations_array,
parent_num_recombinations_array,
current_total_snps_array,
num_blocks_array,
nodeArray[node_index]->block_coordinates,
length_of_original_genome,
snp_locations,
number_of_snps);
if (parent_node_index > -1)
{
fill_in_recombinations_with_gaps(nodeArray,
node_index,
parent_node_index,
parent_recombinations_array,
parent_num_recombinations_array,
current_total_snps_array,
num_blocks_array,
nodeArray[node_index]->block_coordinates,
length_of_original_genome,
snp_locations,
number_of_snps);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Newickform.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ int count_tree_nodes(newick_node* root);
void get_job_nodes(newick_node** jobNodeArray,newick_node** nodeArray,int* node_depths,int depth,int num_nodes);
void get_job_node_indices(int* jobNodeIndexArray, newick_node** nodeArray, int* node_depths, int depth, int num_nodes);
void get_job_counts(int *node_depths, int depth, int num_nodes);
int * get_parents(newick_node *root, newick_node** nodeArray, int num_nodes);
void populate_parents(newick_node *node, newick_node** nodeArray, int * parents, int num_nodes);
extern char* strip_quotes(char *taxon);
#endif

Expand Down

0 comments on commit a04050d

Please sign in to comment.