annotate source/fastq_pair.c @ 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
1 /****************************************************************************
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
2 * The 'FASTQ_PAIR' structure group was used to store paired reads and
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
3 * qualities, including basic operation function as well.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
4 *
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
5 * This file was written by Haibin Xu, December 2011.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
6 ****************************************************************************/
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
7
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
8 #include "fastq_pair.h"
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
9
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
10 FASTQ_PAIR *fastq_pair_create()
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
11 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
12 /* create a FASTQ pair. If successful, return the point to it,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
13 * otherwise, return NULL.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
14 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
15 FASTQ_PAIR *fq_pair;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
16
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
17 if((fq_pair=(FASTQ_PAIR *)malloc(sizeof(FASTQ_PAIR)))==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
18 return NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
19
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
20 fq_pair->seq_left=NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
21 fq_pair->seq_right=NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
22
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
23 return fq_pair;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
24 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
25
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
26 int fastq_pair_remove(FASTQ_PAIR *fq_pair)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
27 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
28 /* free the FASTQ pair. If successful, return 0, otherwise return 1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
29 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
30 if(fq_pair==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
31 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
32
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
33 fastq_pair_clear(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
34 free(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
35
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
36 return 0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
37 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
38
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
39 int fastq_pair_clear(FASTQ_PAIR *fq_pair)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
40 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
41 /* clear the FASTQ pair. If successful, return 0, otherwise return 1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
42 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
43 if(fq_pair==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
44 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
45
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
46 if(fq_pair->seq_left!=NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
47 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
48 fastq_remove(fq_pair->seq_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
49 fq_pair->seq_left=NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
50 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
51 if(fq_pair->seq_right!=NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
52 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
53 fastq_remove(fq_pair->seq_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
54 fq_pair->seq_right=NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
55 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
56 return 0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
57 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
58
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
59 int fastq_pair_scanf(FASTQ_PAIR *fq_pair, FILE *fp_left_in, FILE *fp_right_in,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
60 int whether_append_description, int whether_append_quality)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
61 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
62 /* load the left and right reads and qualities for FASTQ pair from file, including description
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
63 * (whether_append_description=1) or not (whether_append_description=0), including quality
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
64 * (whether_append_quality=1) or not (whether_append_quality=0). If successful, return 0,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
65 * otherwise, clear FASTQ pair and return 1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
66 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
67 FASTQ_ALL *fq_left, *fq_right;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
68
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
69 if(fq_pair==NULL || fp_left_in==NULL || fp_right_in==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
70 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
71
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
72 /* clear the FASTQ_PAIR */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
73 fastq_pair_clear(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
74
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
75 /* create the FASTQ_ALL structure */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
76 if((fq_left=fastq_create())==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
77 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
78 if((fq_right=fastq_create())==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
79 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
80 fastq_remove(fq_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
81 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
82 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
83
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
84 if(fastq_scanf(fq_left, fp_left_in, whether_append_description, whether_append_quality)!=0 ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
85 fastq_scanf(fq_right, fp_right_in, whether_append_description, whether_append_quality)!=0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
86 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
87 fastq_remove(fq_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
88 fastq_remove(fq_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
89 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
90 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
91
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
92 fq_pair->seq_left=fq_left;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
93 fq_pair->seq_right=fq_right;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
94
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
95 return 0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
96 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
97
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
98 int fastq_pair_printf(FASTQ_PAIR *fq_pair, FILE *fp_out1, FILE *fp_out2,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
99 char *format, long serial)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
100 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
101 /* write the pair-end reads in FASTA or FASTQ format into two output files(format='fa' or 'fq')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
102 * or in FASTA format into a single output file(format="fa" and fp_out2==NULL) using the original
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
103 * description (serial=-1) or the new serial. If successful, return 0, otherwise, return 1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
104 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
105 if(fq_pair==NULL || fp_out1==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
106 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
107
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
108 if((strcmp(format, "fq")==0 && fp_out2!=NULL) ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
109 (strcmp(format, "fa")==0 && fp_out2!=NULL))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
110 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
111 fastq_printf(fq_pair->seq_left, fp_out1, format, serial);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
112 fastq_printf(fq_pair->seq_right, fp_out2, format, serial);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
113 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
114 else if(strcmp(format, "fa")==0 && fp_out2==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
115 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
116 fastq_printf(fq_pair->seq_left, fp_out1, format, serial);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
117 fastq_printf(fq_pair->seq_right, fp_out1, format, serial);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
118 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
119 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
120 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
121
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
122 return 0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
123 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
124
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
125 int fastq_pair_compare_tight(FASTQ_PAIR *fq_pair_a, FASTQ_PAIR *fq_pair_b)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
126 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
127 /* compare the two FASTQ pairs tightly, if identical, return 0, else if a>b,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
128 * return 1, else if a<b, return -1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
129 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
130 char *a_left, *a_right, *b_left, *b_right;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
131 int i, flag;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
132
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
133 /* check whether the sequence read exist */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
134 if(fq_pair_a==NULL || fq_pair_b==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
135 fq_pair_a->seq_left==NULL || fq_pair_a->seq_left->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
136 fq_pair_a->seq_right==NULL || fq_pair_a->seq_right->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
137 fq_pair_b->seq_left==NULL || fq_pair_b->seq_left->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
138 fq_pair_b->seq_right==NULL || fq_pair_b->seq_right->sequence==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
139 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
140
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
141 /* obtain points to sequence */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
142 a_left=fq_pair_a->seq_left->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
143 a_right=fq_pair_a->seq_right->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
144 b_left=fq_pair_b->seq_left->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
145 b_right=fq_pair_b->seq_right->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
146
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
147 flag=0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
148 for(i=0;;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
149 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
150 if(a_left[i]=='\0' && b_left[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
151 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
152 if(a_left[i]==b_left[i])
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
153 continue;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
154 if(a_left[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
155 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
156 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
157 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
158 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
159 if(b_left[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
160 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
161 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
162 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
163 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
164
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
165 switch((int)(a_left[i]>b_left[i]))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
166 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
167 case 1:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
168 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
169 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
170 case 0:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
171 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
172 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
173 default:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
174 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
175 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
176 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
177 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
178
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
179 if(flag==0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
180 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
181 for(i=0;;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
182 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
183 if(a_right[i]=='\0' && b_right[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
184 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
185 if(a_right[i]==b_right[i])
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
186 continue;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
187 if(a_right[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
188 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
189 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
190 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
191 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
192 if(b_right[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
193 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
194 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
195 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
196 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
197
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
198 switch((int)(a_right[i]>b_right[i]))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
199 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
200 case 1:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
201 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
202 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
203 case 0:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
204 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
205 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
206 default:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
207 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
208 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
209 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
210 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
211 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
212
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
213 return flag;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
214 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
215
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
216 int fastq_pair_compare_loose(FASTQ_PAIR *fq_pair_a, FASTQ_PAIR *fq_pair_b)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
217 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
218 /* compare the two FASTQ pairs loosely, if identical, return 0, else if a>b,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
219 * return 1, else if a<b, return -1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
220 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
221 char *a_left, *a_right, *b_left, *b_right;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
222 int i, flag;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
223
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
224 /* check whether the sequence read exist */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
225 if(fq_pair_a==NULL || fq_pair_b==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
226 fq_pair_a->seq_left==NULL || fq_pair_a->seq_left->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
227 fq_pair_a->seq_right==NULL || fq_pair_a->seq_right->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
228 fq_pair_b->seq_left==NULL || fq_pair_b->seq_left->sequence==NULL ||
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
229 fq_pair_b->seq_right==NULL || fq_pair_b->seq_right->sequence==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
230 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
231
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
232 /* obtain points to sequence */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
233 a_left=fq_pair_a->seq_left->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
234 a_right=fq_pair_a->seq_right->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
235 b_left=fq_pair_b->seq_left->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
236 b_right=fq_pair_b->seq_right->sequence;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
237
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
238 flag=0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
239 for(i=0;;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
240 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
241 if(a_left[i]=='\0' && b_left[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
242 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
243 if(a_left[i]==b_left[i])
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
244 continue;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
245 if(a_left[i]=='\0' || b_left[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
246 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
247
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
248 switch((int)(a_left[i]>b_left[i]))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
249 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
250 case 1:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
251 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
252 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
253 case 0:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
254 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
255 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
256 default:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
257 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
258 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
259 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
260 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
261
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
262 if(flag==0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
263 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
264 for(i=0;;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
265 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
266 if(a_right[i]=='\0' && b_right[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
267 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
268 if(a_right[i]==b_right[i])
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
269 continue;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
270 if(a_right[i]=='\0' || b_right[i]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
271 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
272
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
273 switch((int)(a_right[i]>b_right[i]))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
274 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
275 case 1:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
276 flag=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
277 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
278 case 0:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
279 flag=-1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
280 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
281 default:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
282 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
283 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
284 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
285 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
286 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
287
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
288 return flag;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
289 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
290
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
291 long fastq_pair_get_left_length(FASTQ_PAIR *fq_pair)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
292 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
293 /* return the length of left FASTQ sequence in pair, if any error, return -1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
294 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
295 if(fq_pair==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
296 return -1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
297 return fastq_get_length(fq_pair->seq_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
298 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
299
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
300 long fastq_pair_get_right_length(FASTQ_PAIR *fq_pair)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
301 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
302 /* return the length of right FASTQ sequence in pair, if any error, return -1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
303 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
304 if(fq_pair==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
305 return -1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
306 return fastq_get_length(fq_pair->seq_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
307 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
308
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
309 long fastq_pair_get_total_length(FASTQ_PAIR *fq_pair)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
310 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
311 /* return the length of both left and right FASTQ sequence in pair,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
312 * if any error, return -1.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
313 */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
314 long left_length, right_length;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
315
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
316 if(fq_pair==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
317 return -1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
318 left_length=fastq_pair_get_left_length(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
319 right_length=fastq_pair_get_right_length(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
320
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
321 if(left_length==-1 || right_length==-1)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
322 return -1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
323
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
324 return left_length+right_length;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
325 }