aboutsummaryrefslogtreecommitdiff
path: root/include/libbio.h
blob: 9f5401527be60d4479ad02e2ae3d3272bc1077fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

// -----------------------------------------------------------------------
// Phylogenetics

typedef struct bio·Node
{
    string name;
    string comment;
    double dist;
    double support;
    int    nchild;
    int    ndescendent;
    struct bio·Node *parent;
    struct bio·Node *child[2];
    struct bio·Node *sibling;
} bio·Node;

error phylo·addchild(bio·Node *parent, bio·Node* child);
bool  phylo·isleaf(bio·Node *node);

typedef struct bio·Tree
{
    bio·Node *root;
} bio·Tree;

/* newick i/o */
bio·Tree bio·readnewick(Stream *file, mem·Allocator heap);
error    bio·writenewick(bio·Tree tree, Stream *out);

// -----------------------------------------------------------------------
// Sequences

typedef struct bio·FastaReader bio·FastaReader;

/* fasta/q i/o */
bio·Seq *bio·newfastareader(Stream *file, mem·Allocator heap);
bio·Seq *bio·readfasta(bio·FastaParser *p);
error    bio·writefasta(bio·Seq *seq, Stream *out);