File: ParameterList.h

package info (click to toggle)
perm 0.4.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 976 kB
  • sloc: cpp: 13,499; makefile: 98; sh: 12
file content (154 lines) | stat: -rw-r--r-- 4,930 bytes parent folder | download | duplicates (5)
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
148
149
150
151
152
153
154
#ifndef INCLUDED_ParameterList
#define INCLUDED_ParameterList
/*
 * This parameter file is modeifed from SOCS system.
 */
#include "ParseReadsOpts.h"
#include "Flags.h"
#include "ShortReadUtil.h"
#include "ReadsFileParser.h"
#include "stdafx.h"
#include <string>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <limits>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
// Use OpenMP is gcc version is later than 4.2
#ifdef __GNUC__
#ifdef __GNUC_PATCHLEVEL__
#define __GNUC_VERSION__ (__GNUC__ * 10000 \
                            + __GNUC_MINOR__ * 100 \
                            + __GNUC_PATCHLEVEL__)
#else
#define __GNUC_VERSION__ (__GNUC__ * 10000 \
                            + __GNUC_MINOR__ * 100)
# endif

#if __GNUC_VERSION__ >= 40200
#include <omp.h>
#endif
#else
#ifdef _MSC_VER
#if _MSC_VER >= 2000
#include <omp.h>
#endif
#endif
#endif
using namespace std;

class MappingOpts : public CParseReadsOpts
{
public:
    MappingOpts(void);
    virtual ~MappingOpts(void);
    void setDefaults(void);
    void clearOutputFileName(bool clear = true);
    unsigned int readLength;
    unsigned int anchorLength;
    string fullCommand;
    // I/O options
    bool bPrintSamHeader;             // Default is true
    bool bIgnoreQS;                   // Default is false
    bool bPrintNM;                    // Default is false
    bool bPrintAlignments;            // Default is false
    bool bPrintAmbigReadsSeparately;  // Default is false
    bool bPrintUnMappedReads;         // Default is false
    bool bExcludeAmbiguousReads;      // Default is true
    bool bPrintAmbiguousReadsOnly;    // Default is false
    bool bPrintBadReads;              // Default is false
    bool bPrintFirstAlignmentOnly;    // Default is false
    bool bGetAllAlignments;           // Default is false
    bool bMap2ForwardStrandOnly;      // Default is false
    bool bMap2ReverseStrandOnly;      // Default is false
    bool bPrintAmbigReadsInOneLine;   // Default is false
    char logFileN[FILENAME_MAX];
    char outputDir[FILENAME_MAX];
    char outputFileN[FILENAME_MAX];
    char outputFormat[FILENAME_MAX];
    char badReadFileN[FILENAME_MAX];
    char ambiguousReadFileN[FILENAME_MAX];
    char unmappedFileN[FILENAME_MAX];
    char readsFileFormat[FILENAME_MAX];
    int ambiguousDiffThreshold;
    int mismatchScoreThreshold;
    int maxAlignPerRead;
    int subDiffThreshold;

    bool bExcludeAmbiguousPaired;
    bool bPrintBestPaired;
    bool bPrintRef4PairedInMapping;
    bool bPrintPairedRQ;
    // The default is output all combinations paired end mappings
    bool frOnly; // Paired end can only align to different strand.
    bool ffOnly; // Paired end can only align to the same strand.
    int disLB; // distance lower bound
    int disUB; // distance upper bound
    unsigned int truncatedReadPrefix;
    char readtag_delimiter;
    unsigned int maxThreadNum; // for OpenMp
};

class ParameterList : public MappingOpts
{
public:
    ParameterList(void) ;
    void setDefaults(void);
    bool checkRefValidity(void);
    bool truncatReadLength(void);
    void getOptsByCheckingExtName(void);
    void printSetting(void);

    bool validFlag;
    // Basic Input
    char refFile[FILENAME_MAX];
    char indexFileN[FILENAME_MAX];
    char seedName[FILENAME_MAX];
    string refFormat; // index, fasta, list
    int seedId;
    // Index
    bool bMakeIndex;  // Default is false
    bool bSaveIndex;  // Default is false
    // For Pairend Read
    bool bMatePairedReads;
    char matePairFileN1[FILENAME_MAX];
    char matePairFileN2[FILENAME_MAX];
    // others
    bool bMaskedMathRepeat;
};

bool printOptWarning4PairedEndOpts(ParameterList &P);
bool printOptWarning4PairedEndOpts(ParameterList &P);

ParameterList getParameterList(int argc, const char** argv);
bool retriveReadSetsAndSettings(ParameterList& P, \
                                vector<string>& readSetsList1,\
                                vector<string>& readSetsList2);
bool checkReadsSetNamesValidity(vector<string>& readSetsList1,\
                                vector<string>& readSetsList2);
unsigned int getReadLength(const char* readSetFileName, char expFileFormat = 'N');
bool getReadSetsFilenames(ParameterList &P,\
                          vector<string>& readSetList1,\
                          vector<string>& readSetList2);
bool checkFileListIsForPairedReads(const char* readSetListFilename);
bool checkFileListHasTheRightExt(vector<string>& readSetList);
bool withSupportExtFileName(const char* fileName);
bool withFastaExtFileName(const char* fileName);
int selectSeed(ParameterList& P);
void printSynopsis(void);
void printUsageInfo(string helpOpt);

// Overwrite string if the source string is not null
inline bool setStr(char* str1, const char* str2)
{
    if (str2[0] != '\0') {
        strcpy(str1, str2);
        return(true);
    } else {
        return(false);
    }
}
#endif