File: parameter.h

package info (click to toggle)
skewer 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 272 kB
  • sloc: cpp: 5,384; makefile: 47
file content (147 lines) | stat: -rw-r--r-- 4,381 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/**********************************************************************
 * Skewer - a fast and accurate adapter trimming tool
 *          using the bit-masked k-difference matching algorithm
 * Copyright (c) 2013-2014 by Hongshan Jiang
 * hongshan.jiang@gmail.com
 *
 * If you use this program, please cite the paper:
 * Jiang, H., Lei, R., Ding, S.W. and Zhu, S. (2014) Skewer: a fast and
 * accurate adapter trimmer for next-generation sequencing paired-end reads.
 * BMC Bioinformatics, 15, 182.
 * http://www.biomedcentral.com/1471-2105/15/182
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#ifndef _PARAMETER_H
#define _PARAMETER_H

#include <vector>
#include <string>

#include "common.h"
#include "fastq.h"

using namespace std;

typedef struct{
	const char * name;
	char chr;
}OPTION_ITEM;

typedef enum{
	COMPRESS_NONE = 0,
	COMPRESS_GZ = 1,
	COMPRESS_BZ2 = 2
}COMPRESS_FORMAT;

///////////////////////////////////////
class cParameter
{
private:
	char arr[2][MAX_PATH+1];
	int argc;
	char ** argv;
	bool bXFile;
	bool bYFile;
	bool bJFile;
	bool bAutoFormat;

public:
	const char * version;
	string x_str;
	string y_str;
	string m_str;
	string j_str;
	vector<string> adapters;
	vector<string> adapters2;
	vector< vector<bool> > bMatrix;
	vector<string> rowNames;
	vector<string> colNames;
	vector<string> juncAdapters;
	char * input[2];
	// These are the output fastq files for the
	// trimmed reads that pass filters
	vector<string> output;
	vector<string> output2;
	// These are the output fastq files for only
	// the reads that passed filters AND were trimmed.
	// The full reads appear in the file with the
	// trimmed bases in lower case rather than removed.
	vector<string> masked;
	vector<string> masked2;
	bool bWriteMasked;
	// These files contain the reads that were excluded
	// from the output because they failed filters.
	vector<string> excluded;
	vector<string> excluded2;
	bool bWriteExcluded;
	vector<string> barcodeNames;
	string barcodes;
	string mapfile;
	string untrimmed;
	string untrimmed2;
	char logfile[MAX_PATH+1+100];
	const char * pDecorate;
	TRIM_MODE trimMode;
	bool bShareAdapter;
	bool bBarcode;
	bool bClip;
	bool bQiime;
	bool bFilterNs;
	bool bFilterUndetermined;
	bool bRedistribute;
	bool bStdin;
	bool bStdout;
	bool bQuiet;
	bool bEnquireVersion;
	int nFileCnt;
	enum FASTQ_FORMAT fastqFormat;
	int baseQual;
	COMPRESS_FORMAT outputFormat;
	double epsilon, delta;
	int minLen, maxLen, minAverageQual, minEndQual, nThreads;
	int minK;
	int iCutF, iCutR;
	bool bCutTail;
	bool bFillWithNs;

private:
	char * occOfLastDot(char * str);
	bool IsDirectorySpecified (char * str);
	int ReadMatrix(const char * fileName);
	int ReadFasta(const char * fileName, vector<string> & sequences);

public:
	cParameter();
	bool IsAutoFastqFormat();
	void PrintVersion(FILE * fp);
	void PrintUsage(char * program, FILE *fp);
	void PrintSimpleUsage(char * program, FILE *fp);
	void printCommandLine(FILE *fp);
	void printRelatedFiles(FILE *fp);
	void printVersion(FILE *fp);
	void printLogo(FILE *fp, bool bLeadingRtn=false);
	void printOpt(FILE *fp, bool bLeadingRtn=false);
	int GetOpt(int argc, char *argv[], char * errMsg);
};

extern "C" int color_fprintf(int colorCode, FILE *stream, const char *format, ...);
extern "C" int color_sprintf(int colorCode, char *str, const char *format, ...);

#endif // _PARAMETER_H