Skip to content

Commit

Permalink
line endings fixed and NULL pointers addressed
Browse files Browse the repository at this point in the history
Updated to version 1.1
  • Loading branch information
ChrisCreevey committed Oct 24, 2016
1 parent 4e316f5 commit 5f8ae5a
Show file tree
Hide file tree
Showing 11 changed files with 5,697 additions and 214 deletions.
2 changes: 2 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
To install Crann, type the following at the commandline:


cc evolve.c Li_Wu_19851993.c adaptive_tree.c "linked tree.c" -o crann -lm


30 changes: 15 additions & 15 deletions Li_Wu_19851993.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void Li_Wu(void)

struct sequence *seq1 = start;
struct sequence *seq2 = start->next;
struct synon *new = '\0';
struct synon *new = NULL;

clear_results();
if(gen_opt[3] == 1){ startw = 0; endw = (start->length/3 -1); }
Expand Down Expand Up @@ -329,18 +329,18 @@ void Li_Wu(void)
}

/* now assign the pointers to the previous and next sequence */
if (li_wu_end == '\0' || li_wu_start == '\0') /* If this is a new list */
if (li_wu_end == NULL || li_wu_start == NULL) /* If this is a new list */
{
li_wu_end = new;
li_wu_start = new;
}
else (li_wu_end)->next = new;
new->next = '\0';
new->next = NULL;
new->previous = li_wu_end;
li_wu_end = new;

seq2 = seq1->next;
while(seq2 != '\0')
while(seq2 != NULL)
{
if(seq2->tag)
{
Expand Down Expand Up @@ -438,7 +438,7 @@ void which_sequences(void)
do{
if(position->tag) printf("\nNo: %d Name: %s ", ((position->seq_num)+1), (position->name));
position = position->next;
}while(position != '\0');
}while(position != NULL);
choice2 = getint("\n\nPlease select the number of a sequence to be omitted from the analysis, and enter 0 when finished\n", 0, num_of_seqs, 0);
if(choice2 == 0) choice2 = '\0';
else
Expand Down Expand Up @@ -581,7 +581,7 @@ void Li_Wu_movwin(void)

struct sequence *seq1 = start;
struct sequence *seq2 = start->next;
struct synon *new = '\0';
struct synon *new = NULL;


tag_all();
Expand Down Expand Up @@ -663,14 +663,14 @@ void Li_Wu_movwin(void)
*/
/* assign pointers to the prevoius and next sequence */

if(li_wu_start == '\0' || li_wu_end == '\0') /* if this is a new list */
if(li_wu_start == NULL || li_wu_end == NULL) /* if this is a new list */
{
li_wu_end = new;
li_wu_start = new;
}
else li_wu_end->next = new;

new->next = '\0';
new->next = NULL;
new->previous = li_wu_end;
li_wu_end = new;

Expand Down Expand Up @@ -744,7 +744,7 @@ void display_movwin(int window, int shift)
{
position = li_wu_start;
total = 0;
while(position != '\0')
while(position != NULL)
{
/* fprintf(outfile, "%f \t ", position->Ks[i]); */
total += position->Ks[i];
Expand All @@ -762,7 +762,7 @@ void display_movwin(int window, int shift)
{
position = li_wu_start;
total = 0;
while(position != '\0')
while(position != NULL)
{
/* fprintf(outfile, "%f \t ", position->Ka[i]); */
total += position->Ka[i];
Expand All @@ -782,7 +782,7 @@ void display_movwin(int window, int shift)
total = 0;
while(position != '\0')
{
/* if(position->Ka[i] != 0) fprintf(outfile, "%f \t ", position->Ks[i]/position->Ka[i]); */
*//* if(position->Ka[i] != 0) fprintf(outfile, "%f \t ", position->Ks[i]/position->Ka[i]); */
/* if(position->Ka[i] != 0) total += position->Ks[i]/position->Ka[i];
position = position->next;
}
Expand All @@ -798,9 +798,9 @@ void display_movwin(int window, int shift)
total = 0;
while(position != '\0')
{
/* if(position->Ks[i] != 0) fprintf(outfile, "%f \t ", position->Ka[i]/position->Ks[i]); */
*//* if(position->Ks[i] != 0) fprintf(outfile, "%f \t ", position->Ka[i]/position->Ks[i]); */
/* if(position->Ks[i] != 0) total += position->Ka[i]/position->Ks[i];
/* else fprintf(outfile, "0.000000 \t"); */
*//* else fprintf(outfile, "0.000000 \t"); */
/* position = position->next;
}
i++;
Expand All @@ -816,7 +816,7 @@ void display_movwin(int window, int shift)
{
position = li_wu_start;
total = 0;
while(position != '\0')
while(position != NULL)
{
/* fprintf(outfile, "%f \t ", position->varKs[i]); */
total += position->varKs[i];
Expand All @@ -834,7 +834,7 @@ void display_movwin(int window, int shift)
{
position = li_wu_start;
total = 0;
while(position != '\0')
while(position != NULL)
{
/* fprintf(outfile, "%f \t ", position->varKa[i]); */
total += position->varKa[i];
Expand Down
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
bin_PROGRAMS = crann
crann_SOURCES = evolve.c Li_Wu_19851993.c adaptive_tree.c "linked tree.c"
crann_LDADD = $(LDADD) -lm

Binary file modified Thumbs.db
Binary file not shown.
3,943 changes: 3,942 additions & 1 deletion adaptive_tree.c

Large diffs are not rendered by default.

Binary file added crann
Binary file not shown.
Binary file modified crann_manual.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <string.h>
#include <math.h>
#include <ctype.h>
/*#include <console.h> /* Uncomment for mac */
/*#include <console.h> */ /* Uncomment for mac */

struct sequence{

Expand Down Expand Up @@ -105,8 +105,8 @@ struct node{
struct node *tree_top; /* pointer to the top of the tree */


FILE *file = NULL, *outfile = NULL, *dist = NULL, *parenthesis = NULL, *ances_file = NULL, *outtree = NULL, *usagefile = NULL, *graphfile = NULL, *yadf = '\0';
char filename[36], outfilename[36], nestname[36];
FILE *file = NULL, *outfile = NULL, *dist = NULL, *parenthesis = NULL, *ances_file = NULL, *outtree = NULL, *usagefile = NULL, *graphfile = NULL, *yadf = NULL;
char filename[36], outfilename[36], nestname[36], string1[1000], string2[1000];
int code = 0, num_of_seqs = 0, untagged = 0, distance_written = FALSE, startw = 0, endw = 0, gen_opt[7] = {0, 0, 1, 1, 0, 0, 0}, ***graphs = NULL; /* distance_written is used to tell if the distance.out file was already written */
float **distances = NULL; /* used to store distances when computing a neighbour joining tree */

Expand Down
1,537 changes: 1,536 additions & 1 deletion evolve.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions externals.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#endif


extern const maxnamlen;
extern const int maxnamlen;

extern struct sequence{

Expand Down Expand Up @@ -103,7 +103,7 @@ extern struct node *tree_top; /* pointer to the top of the tree */


extern FILE *file, *outfile, *dist, *parenthesis, *ances_file, *outtree, *graphfile, *yadf;
extern char filename[36], outfilename[36], nestname[36];
extern char filename[36], outfilename[36], nestname[36], string1[1000], string2[1000];
extern int code, num_of_seqs, untagged, distance_written, startw, endw, gen_opt[7], ***graphs; /* distance_written is used to tell if the distance.out file was already written */
extern float **distances; /* used to store distances when computing a neighbour joining tree */

Expand Down
Loading

0 comments on commit 5f8ae5a

Please sign in to comment.