Skip to content

Commit

Permalink
add MAPQ filter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MPIBR-tushevg committed Sep 7, 2016
1 parent dacb22d commit 55c05b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
17 changes: 13 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const char VERSION[] = "v0.01";
const char PROGRAM_NAME[] = "FastPASSFinder";

int parseSettings(int argc, char *argv[], Settings *config)
int parseSettings(int argc, const char *argv[], Settings *config)
{
// initialize default values
config->input = NULL;
Expand All @@ -20,6 +20,7 @@ int parseSettings(int argc, char *argv[], Settings *config)
config->window = DEFAULT_WINDOW;
config->depth = DEFAULT_DEPTH;
config->sizepoly = DEFAULT_SIZEPOLY;
config->mapq = DEFAULT_MAPQ;

if(argc < 5)
{
Expand All @@ -44,6 +45,17 @@ int parseSettings(int argc, char *argv[], Settings *config)
{
version();
}
else if((PARAMETER_CHECK("-q", 2, parameterLength)) || (PARAMETER_CHECK("--mapq", 6, parameterLength)))
{
i += 1;
config->mapq = strtol(argv[i], NULL, 10);

if (config->mapq < 0)
{
fprintf(stderr, "Error:: MAPQ should be >=0!\n");
return EXIT_FAILURE;
}
}
else if((PARAMETER_CHECK("-w", 2, parameterLength)) || (PARAMETER_CHECK("--window", 8, parameterLength)))
{
i += 1;
Expand Down Expand Up @@ -85,7 +97,6 @@ int parseSettings(int argc, char *argv[], Settings *config)
(PARAMETER_CHECK("--input", 7, parameterLength)))
{
i += 1;

config->input = argv[i];

if (config->input == NULL)
Expand All @@ -98,7 +109,6 @@ int parseSettings(int argc, char *argv[], Settings *config)
(PARAMETER_CHECK("--maskpoly", 10, parameterLength)))
{
i += 1;

config->maskpoly = argv[i];

if (config->maskpoly == NULL)
Expand All @@ -112,7 +122,6 @@ int parseSettings(int argc, char *argv[], Settings *config)
(PARAMETER_CHECK("--output", 8, parameterLength)))
{
i += 1;

config->output = argv[i];

if (config->output == NULL)
Expand Down
4 changes: 3 additions & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define DEFAULT_WINDOW 200
#define DEFAULT_DEPTH 5
#define DEFAULT_SIZEPOLY 3
#define DEFAULT_MAPQ 0

// define MIN & MAX macros
#define MIN(a,b) (((a)<(b))?(a):(b))
Expand All @@ -36,11 +37,12 @@ typedef struct _Settings
int64_t window;
int64_t depth;
int64_t sizepoly;
int64_t mapq;
} Settings;

// function declarations
int chompNewLine(char *);
int parseSettings(int, char **, Settings *);
int parseSettings(int, const char **, Settings *);
int help(void);
int version(void);

Expand Down

0 comments on commit 55c05b0

Please sign in to comment.