annotate source/fastq_uniq.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 /* This program was used to remove duplicates in paired FASTQ sequences,
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
2 * which is usually appeared in mate pair libraries.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
3 *
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
4 * This file and its partner was written by Haibin Xu, December 2011.
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
5 */
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 #ifndef MAX_FILE_NUMBER
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
8 #define MAX_FILE_NUMBER 1000
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
9 #endif
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
10
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
11 #include <unistd.h>
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
12 #include "fastq_pair_array.h"
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
13
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
14 void fastq_uniq_usage()
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
15 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
16 fprintf(stderr, "-i : The input file list of paired FSATQ sequence files [FILE IN]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
17 fprintf(stderr, " Maximum 1000 pairs\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
18 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
19 fprintf(stderr, " This parameter is used to specify a list of paired sequence files in\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
20 fprintf(stderr, " FASTQ format as input, in which two adjacent files with reads in the\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
21 fprintf(stderr, " same order belong to a pair.\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
22 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
23 fprintf(stderr, "-t : Output sequence format [q/f/p]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
24 fprintf(stderr, " q : FASTQ format into TWO output files\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
25 fprintf(stderr, " f : FASTA format into TWO output files\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
26 fprintf(stderr, " p : FASTA format into ONE output file\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
27 fprintf(stderr, " default = q\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
28 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
29 fprintf(stderr, " This parameter is used to specify sequence format in output file(s).\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
30 fprintf(stderr, " FastUniq could output read pairs into two files in either FASTQ [q]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
31 fprintf(stderr, " or FASTA [f] format, in which reads in the same order belonging to a\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
32 fprintf(stderr, " pair. FastUniq could also output read pairs into a single file in\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
33 fprintf(stderr, " FASTA format [p], in which adjacent reads belonging to a pair.\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
34 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
35 fprintf(stderr, "-o : The first output file [FILE OUT]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
36 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
37 fprintf(stderr, "-p : The second output file [FILE OUT]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
38 fprintf(stderr, " Optional. ONLY required when output sequence format(-t) is specify as\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
39 fprintf(stderr, " [q] or [f].\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
40 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
41 fprintf(stderr, "-c : Types of sequence descriptions for output [0/1]\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
42 fprintf(stderr, " 0 : The raw descriptions\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
43 fprintf(stderr, " 1 : New serial numbers assigned by FastUniq\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
44 fprintf(stderr, " default = 0\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
45 fprintf(stderr, "\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
46 return;
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
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
49 int main (int argc, const char * argv[])
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 FILE *fp_in_list, *fp_in_left, *fp_in_right, *fp_out_left, *fp_out_right;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
52 char str_in_left[MAX_FILE_NUMBER][1000], str_in_right[MAX_FILE_NUMBER][1000];
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
53 char str_in_list[1000], str_out_left[1000], str_out_right[1000];
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
54 char s_left[1000], s_right[1000];
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
55 char output_format;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
56 int description_type;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
57 int flag_i=0, flag_o=0, flag_t=0, flag_p=0, flag_c=0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
58 char ch;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
59 FASTQ_PAIR *fq_pair;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
60 FASTQ_PAIR_ARRAY *fq_pair_array, *temp_fq_pair_array;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
61 long i, seq_pair_count;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
62
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
63 if(argc==1)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
64 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
65 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
66 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
67 }
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 /* initializing */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
70 for(i=0;i<MAX_FILE_NUMBER;i++)
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 str_in_left[i][0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
73 str_in_right[i][0]='\0';
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 str_in_list[0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
76 str_out_left[0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
77 str_out_right[0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
78 output_format='\0';
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 /* obtain inputted arguments */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
81 while((ch=getopt(argc, argv, "i:t:o:p:c:"))!=-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 switch(ch)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
84 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
85 case 'i':
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
86 strcpy(str_in_list,optarg);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
87 if(strcmp(str_in_list,"")!=0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
88 flag_i=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
89 else
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 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
92 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
93 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
94 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
95 case 't':
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
96 if(strlen(optarg)==1)
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 if(optarg[0]=='q')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
99 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
100 output_format='q';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
101 flag_t=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
102 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
103 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
104 else if(optarg[0]=='f')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
105 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
106 output_format='f';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
107 flag_t=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
108 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
109 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
110 else if(optarg[0]=='p')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
111 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
112 output_format='p';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
113 flag_t=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
114 break;
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 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
117 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
118 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
119 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
120 }
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 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
123 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
124 case 'o':
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
125 strcpy(str_out_left,optarg);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
126 if(strcmp(str_out_left,"")!=0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
127 flag_o=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
128 else
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 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
131 return 1;
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 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
134 case 'p':
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
135 strcpy(str_out_right,optarg);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
136 if(strcmp(str_out_right,"")!=0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
137 flag_p=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
138 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
139 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
140 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
141 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
142 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
143 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
144 case 'c':
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
145 if(strlen(optarg)==1)
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 if(optarg[0]=='0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
148 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
149 description_type=0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
150 flag_c=1;
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 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
153 else if(optarg[0]=='1')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
154 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
155 description_type=1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
156 flag_c=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 else
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 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
162 return 1;
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 fastq_uniq_usage();
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
166 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
167 default:
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
168 fastq_uniq_usage();
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 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
171 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
172
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
173 /* check inputted arguments */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
174 if(flag_i==0)
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 fprintf(stderr, "Error in input the name of FASTQ file list!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
177 return 1;
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_t==0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
180 output_format='q';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
181 if(flag_o==0 || (output_format!='p' && flag_p==0))
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 fprintf(stderr, "Error in output sequence file name!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
184 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
185 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
186 if(flag_c==0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
187 description_type=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 /* get pair-end FASTQ file list */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
190 if((fp_in_list=fopen(str_in_list, "r"))==NULL)
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 fprintf(stderr, "Error in open FASTQ file list %s for read!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
193 str_in_list);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
194 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
195 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
196 for(i=0; !feof(fp_in_list) && i<MAX_FILE_NUMBER;)
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 /* get the file store left FASTQ sequences */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
199 s_left[0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
200 fgets(s_left, 1000, fp_in_list);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
201 if(s_left[0]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
202 continue;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
203 else if(strlen(s_left)>=2 && s_left[strlen(s_left)-1]=='\n')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
204 s_left[strlen(s_left)-1]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
205 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
206 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
207 fprintf(stderr, "Error in read from FASTQ file list!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
208 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
209 }
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 /* get the file store right FASTQ sequences */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
212 s_right[0]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
213 fgets(s_right, 1000, fp_in_list);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
214 if(strlen(s_right)>=2)
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 if(s_right[strlen(s_right)-1]=='\n')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
217 s_right[strlen(s_right)-1]='\0';
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
218 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
219 else
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 fprintf(stderr, "Error in read from FASTQ file list!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
222 return 1;
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
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
225 /* append the fiel name to list array */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
226 strcpy(str_in_left[i], s_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
227 strcpy(str_in_right[i++], s_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
228 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
229 fclose(fp_in_list);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
230
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
231 /* check the status of pair-end FASTQ files */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
232 for(i=0;i<MAX_FILE_NUMBER;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
233 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
234 /* check whether list reached the end */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
235 if(str_in_left[i][0]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
236 break;
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 /* check file status */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
239 if((fp_in_left=fopen(str_in_left[i], "r"))==NULL)
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 fprintf(stderr, "Error in open left fastq file %s for read!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
242 str_in_left[i]);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
243 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
244 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
245 fclose(fp_in_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
246
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
247 if((fp_in_right=fopen(str_in_right[i], "r"))==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
248 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
249 fprintf(stderr, "Error in open right fastq file %s for read!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
250 str_in_right[i]);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
251 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
252 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
253 fclose(fp_in_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
254 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
255
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
256
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
257 /* read all pair-end FASTQ sequences into memory */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
258 seq_pair_count=0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
259 if((fq_pair_array=fastq_pair_array_create())==NULL)
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 fprintf(stderr, "Error in allocate enough memory!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
262 return 1;
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 if((temp_fq_pair_array=fastq_pair_array_create())==NULL)
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 fprintf(stderr, "Error in allocate enough memory!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
267 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
268 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
269 for(i=0;i<MAX_FILE_NUMBER;i++)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
270 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
271 /* check whether list reached the end */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
272 if(str_in_left[i][0]=='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
273 break;
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 /* open inputted pair-end FASTQ file */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
276 if((fp_in_left=fopen(str_in_left[i], "r"))==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
277 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
278 fprintf(stderr, "Error in open left fastq file %s for read!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
279 str_in_left[i]);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
280 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
281 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
282 if((fp_in_right=fopen(str_in_right[i], "r"))==NULL)
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 fprintf(stderr, "Error in open right fastq file %s for read!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
285 str_in_right[i]);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
286 return 1;
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
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
289 /* read sequences */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
290 for(;!feof(fp_in_left) && !feof(fp_in_right);)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
291 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
292 fq_pair=NULL;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
293 if((fq_pair=fastq_pair_create())==NULL)
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 fprintf(stderr, "Error in allocate enough memory!\n");
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 }
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 if(output_format=='f' || output_format=='p')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
300 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
301 /* NOT require quality */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
302 if(fastq_pair_scanf(fq_pair, fp_in_left, fp_in_right, description_type==0?1:0, 0)!=0)
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 fastq_pair_remove(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
305 break;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
306 }
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 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
309 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
310 /* require quality */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
311 if(fastq_pair_scanf(fq_pair, fp_in_left, fp_in_right, description_type==0?1:0, 1)!=0)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
312 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
313 fastq_pair_remove(fq_pair);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
314 break;
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 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
317
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
318 fastq_pair_array_append(fq_pair, fq_pair_array);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
319 fastq_pair_array_append(fq_pair, temp_fq_pair_array);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
320 seq_pair_count++;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
321 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
322
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
323 if(!feof(fp_in_left) && !feof(fp_in_right))
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
324 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
325 fprintf(stderr, "Error in Reading pair-end FASTQ sequence!\n");
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
326 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
327 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
328 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
329
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
330 /* create memory address index for each BLOCK in a FASTQ_PAIR_ARRAY */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
331 fastq_pair_array_generate_index(fq_pair_array);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
332 fastq_pair_array_generate_index(temp_fq_pair_array);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
333
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
334 /* sort the pair-end FASTQ sequences */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
335 fastq_pair_array_sort(fq_pair_array, temp_fq_pair_array, 1, seq_pair_count);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
336
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
337 /* open output fastq file */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
338 if((fp_out_left=fopen(str_out_left, "w"))==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
339 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
340 fprintf(stderr, "Error in open left fastq file %s for write!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
341 str_out_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
342 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
343 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
344
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
345 if(str_out_right[0]!='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
346 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
347 if((fp_out_right=fopen(str_out_right, "w"))==NULL)
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
348 {
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
349 fprintf(stderr, "Error in open right fastq file %s for write!\n",
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
350 str_out_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
351 return 1;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
352 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
353 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
354
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
355 /* output the sequence in specific format */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
356 if(output_format=='f')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
357 fastq_pair_array_printf(fq_pair_array, fp_out_left, fp_out_right, "fa", description_type, 1);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
358 else if(output_format=='p')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
359 fastq_pair_array_printf(fq_pair_array, fp_out_left, NULL, "fa", description_type, 1);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
360 else
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
361 fastq_pair_array_printf(fq_pair_array, fp_out_left, fp_out_right, "fq", description_type, 1);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
362
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
363 /* close output files */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
364 fclose(fp_out_left);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
365 if(str_out_right[0]!='\0')
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
366 fclose(fp_out_right);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
367
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
368 // /* free memory */
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
369 // fastq_pair_array_remove(fq_pair_array);
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
370
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
371 return 0;
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
372 }
816cb55b5a2d planemo upload for repository https://github.com/portiahollyoak/Tools commit c4769fd68ad9583d4b9dbdf212e4ecb5968cef1c-dirty
portiahollyoak
parents:
diff changeset
373