[go: up one dir, main page]

File: sequence.h

package info (click to toggle)
andi 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 988 kB
  • sloc: ansic: 2,296; sh: 426; cpp: 99; makefile: 76; awk: 51
file content (68 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * @file
 * @brief Functions and structures for DNA sequences
 *
 */
#ifndef _SEQUENCE_H_
#define _SEQUENCE_H_

#include <err.h>
#include <errno.h>
#include <stdlib.h>

/**
 * @brief A structure for sequences.
 *
 * This structure is used to represent a DNA sequence of some kind.
 */
typedef struct seq_s {
	/** This is the DNAs forward strand as a string. */
	char *S;
	/** The length of the forward strand. */
	size_t len;
	/** A name for this sequence */
	char *name;
} seq_t;

/**
 * @brief This structure enhances the usual sequence with its reverse
 * complement.
 */
typedef struct seq_subject {
	/** This member contains first the reverse strand and then the
		forward strand. */
	char *RS;
	/** Corresponds to strlen(RS) */
	size_t RSlen;
	/**
	 * @brief GC-Content
	 *
	 * The relative amount of G or C in the DNA.
	 */
	double gc;
	/** The minimum length for an anchor. */
	size_t threshold;
} seq_subject;

void seq_free(seq_t *S);
int seq_subject_init(seq_subject *S, const seq_t *);
void seq_subject_free(seq_subject *S);
int seq_init(seq_t *S, const char *seq, const char *name);

/**
 * @brief A dynamically growing structure for sequences.
 */
typedef struct dsa_s {
	seq_t *data;
	size_t capacity, size;
} dsa_t;

int dsa_init(dsa_t *A);
void dsa_push(dsa_t *A, seq_t S);
void dsa_free(dsa_t *A);
size_t dsa_size(const dsa_t *A);
seq_t *dsa_data(dsa_t *A);

seq_t dsa_join(dsa_t *dsa);

#endif