Mercurial > repos > portiahollyoak > fastuniq
comparison source/fastq_pair_array.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_PAIR_ARRAY' structure group was used to store a array of | |
| 3 * paired FASTQ reads, including basic operation function as well. | |
| 4 * | |
| 5 * This file was written by Haibin Xu, December 2011. | |
| 6 ****************************************************************************/ | |
| 7 | |
| 8 #include "fastq_pair.h" | |
| 9 | |
| 10 #ifndef FASTQ_PAIR_ARRAY_BLOCK_SIZE | |
| 11 #define FASTQ_PAIR_ARRAY_BLOCK_SIZE 100000 | |
| 12 #endif | |
| 13 | |
| 14 #ifndef _FASTQ_PAIR_ARRAY_BLOCK | |
| 15 typedef struct fastq_pair_array_block | |
| 16 { | |
| 17 FASTQ_PAIR *block[FASTQ_PAIR_ARRAY_BLOCK_SIZE]; | |
| 18 struct fastq_pair_array_block *previous; | |
| 19 struct fastq_pair_array_block *next; | |
| 20 long num; | |
| 21 } FASTQ_PAIR_ARRAY_BLOCK; | |
| 22 #define _FASTQ_PAIR_ARRAY_BLOCK | |
| 23 #endif | |
| 24 | |
| 25 #ifndef _FASTQ_PAIR_ARRAY | |
| 26 typedef struct fastq_pair_array | |
| 27 { | |
| 28 FASTQ_PAIR_ARRAY_BLOCK *array; | |
| 29 FASTQ_PAIR_ARRAY_BLOCK *last; | |
| 30 long block_num; | |
| 31 long fastq_pair_num; | |
| 32 FASTQ_PAIR_ARRAY_BLOCK **index; | |
| 33 } FASTQ_PAIR_ARRAY; | |
| 34 #define _FASTQ_PAIR_ARRAY | |
| 35 #endif | |
| 36 | |
| 37 /* create a FASTQ pair array. If successful, return the point to it, | |
| 38 * otherwise, return NULL. */ | |
| 39 FASTQ_PAIR_ARRAY *fastq_pair_array_create(); | |
| 40 | |
| 41 /* free the FASTQ pair array. If successful, return 0, otherwise return 1. */ | |
| 42 int fastq_pair_array_remove(FASTQ_PAIR_ARRAY *fq_pair_array); | |
| 43 | |
| 44 /* append a new FASTQ pair to the array. if successful, return 0, otherwise | |
| 45 * return 1. */ | |
| 46 int fastq_pair_array_append(FASTQ_PAIR *fq_pair, | |
| 47 FASTQ_PAIR_ARRAY *fq_pair_array); | |
| 48 | |
| 49 /* generate the index for given FASTQ_PAIR, if successful, return 0, otherwise | |
| 50 * return 1. */ | |
| 51 int fastq_pair_array_generate_index(FASTQ_PAIR_ARRAY *fq_pair_array); | |
| 52 | |
| 53 /* get double pointer to individual fastq_pair member at specific position | |
| 54 * in the array, if successful, return the double pointer, otherwise | |
| 55 * return NULL */ | |
| 56 FASTQ_PAIR **fastq_pair_array_get_pointer(FASTQ_PAIR_ARRAY *fq_pair_array, | |
| 57 long position); | |
| 58 | |
| 59 /* merge the two sorted part in array, low-middle and middle-high, into a | |
| 60 * single sorted order. If successful, return 0, otherwise return. */ | |
| 61 int fastq_pair_array_merge(FASTQ_PAIR_ARRAY *fq_pair_array, | |
| 62 FASTQ_PAIR_ARRAY *temp_fq_pair_array, | |
| 63 long low, long middle, long high); | |
| 64 | |
| 65 /* sort the FASTQ pair array. If successful, return 0, otherwise | |
| 66 * return 1. */ | |
| 67 int fastq_pair_array_sort(FASTQ_PAIR_ARRAY *fq_pair_array, | |
| 68 FASTQ_PAIR_ARRAY *temp_fq_pair_array, | |
| 69 long first, long last); | |
| 70 | |
| 71 /* write the pair-end reads in the array in FASTA or FASTQ format into two | |
| 72 * output files(format='fa' or 'fq') or in FASTA format into a single output | |
| 73 * file(format="fa" and fp_out2==NULL) using the original description | |
| 74 * (serial_flag=0) or a new serial number(serial_flag=1). Output all sequences | |
| 75 * (flag_uniq==0), or unique ones(flag_uniq==1). If successful, return 0, | |
| 76 * otherwise return 1. */ | |
| 77 int fastq_pair_array_printf(FASTQ_PAIR_ARRAY *fq_pair_array, FILE *fp_out1, | |
| 78 FILE *fp_out2, char *format, int serial_flag, | |
| 79 int flag_uniq); | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 |
