comparison source/fastq.h @ 0:816cb55b5a2d draft default tip

planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
author portiahollyoak
date Thu, 02 Jun 2016 11:34:51 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:816cb55b5a2d
1 /****************************************************************************
2 * The 'FASTQ_ALL' structure group was used to store nucleotide sequence in
3 * fastq format, including basic operation function as well.
4 *
5 * This file was written by Haibin Xu, December 2011.
6 ****************************************************************************/
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11
12 #ifndef FASTQ_DESCRIPTION_MAX_LENGTH
13 #define FASTQ_DESCRIPTION_MAX_LENGTH 1000
14 #endif
15
16 #ifndef FASTQ_SEQUENCE_MAX_LENGTH
17 #define FASTQ_SEQUENCE_MAX_LENGTH 2000
18 #endif
19
20 #ifndef _FASTQ_ALL
21 typedef struct fastq_all
22 {
23 char *description_1; /* the 1st description line */
24 char *sequence; /* the sequence*/
25 char *description_2; /* the 2nd description line */
26 char *quality; /* the quality */
27 } FASTQ_ALL;
28 #define _FASTQ_ALL
29 #endif
30
31 /* create a FASTQ_ALL sequence. If successful, return the point to it,
32 * otherwise, return NULL. */
33 FASTQ_ALL *fastq_create();
34
35 /* free the FASTQ sequence. If successful, return 0, otherwise return 1. */
36 int fastq_remove(FASTQ_ALL *fq);
37
38 /* clear the FASTQ sequence. If successful, return 0, otherwise return 1. */
39 int fastq_clear(FASTQ_ALL *fq);
40
41 /* get sequence serial from FASTQ description in format '@serial_number'.
42 * If successful return the serial, otherwise return -1. */
43 long fastq_get_serial(FASTQ_ALL *fq);
44
45 /* read a FASTQ sequence from input file, including description (whether_append_description=1)
46 * or not (whether_append_description=0), including quality (whether_append_quality=1) or not
47 * (whether_append_quality=0). If successful, return 0, otherwise, clear fq
48 * and return 1. */
49 int fastq_scanf(FASTQ_ALL *fq, FILE *fp_in,
50 int whether_append_description, int whether_append_quality);
51
52 /* write sequence into output file in FASTQ format(format='fq') or FASTA format(format='fa')
53 * using the original description (serial=-1) or the new serial.
54 * If successful, return 0, otherwise return 1. */
55 int fastq_printf(FASTQ_ALL *fq, FILE *fp_out, char *format, long serial);
56
57 /* return the length of FASTQ sequence, if any error, return -1. */
58 long fastq_get_length(FASTQ_ALL *fq);
59
60
61