22 #define pm_assert(cond) arb_assert(cond)
33 column() : title(
NULp), start_column(-1), end_column(-1) {}
34 column(
const char *t,
int sc,
int ec) : title(t), start_column(sc), end_column(ec) {}
40 typedef map<const char*, column, charpLess>
ColumnMap;
45 int probe_region_offset;
51 probe_region_offset(-1)
56 for (
char *tok_start = strtok(headline,
" "); tok_start; tok_start = strtok(
NULp,
" ")) {
57 char *tok_end = strchr(tok_start, 0)-1;
59 int startPos = tok_start-headline;
60 int endPos = tok_end-headline;
62 while (tok_end >= tok_start && tok_end[0] ==
'-') --tok_end;
63 while (tok_start <= tok_end && tok_start[0] ==
'-') ++tok_start;
67 columns[tok_start] =
column(tok_start, startPos-2, endPos-2);
70 if (columns.empty()) *errPtr =
ARB_strdup(
"No columns found");
78 ColumnMap::iterator ci = columns.find(columntitle);
79 if (ci == columns.end())
return NULp;
97 else if (!probe_target) {
98 init_error =
ARB_strdup(
"No probe target given.");
105 for (
int i = 0; probe_target_copy[i]; ++i) {
106 probe_target_copy[i] = toupper(probe_target_copy[i]);
107 if (probe_target_copy[i] ==
'T') {
108 probe_target_copy[i] =
'U';
115 char *probe_rev_compl =
ARB_strdup(probe_target_copy);
117 target_found = pimpl->
findColumn(probe_rev_compl);
118 free(probe_rev_compl);
122 int probe_region_offset = target_found->
start_column - 9;
126 init_error =
GBS_global_string_copy(
"Probe match parser failed (Could not find target '%s' in headline)", probe_target_copy);
128 free(probe_target_copy);
141 if (!col)
return false;
167 else error =
"No match given";
193 error =
"no such column: 'pos'";
200 int matchlen = strlen(match);
215 while (sc<ec && match[sc] ==
' ') ++sc;
216 while (sc<ec && match[ec] ==
' ') --ec;
char * get_column_content(const char *columnName, bool chop_spaces) const
ParsedProbeMatch(const char *match_, const ProbeMatchParser &parser_)
char * ARB_strdup(const char *str)
const char * GBS_global_string(const char *templat,...)
ProbeMatchParser(const char *probe_target, const char *headline)
ProbeMatch_impl(const char *headline_, char **errPtr)
const char * get_probe_region() const
int get_probe_region_offset() const
NOT4PERL void GBT_reverseComplementNucSequence(char *seq, long length, char T_or_U)
int get_probe_region_offset() const
map< const char *, column, charpLess > ColumnMap
static void error(const char *msg)
void set_probe_region_offset(int offset)
column(const char *t, int sc, int ec)
ASSERTING_CONSTEXPR_INLINE int bio2info(int biopos)
char * ARB_strndup(const char *start, int len)
bool is_gene_result() const
bool getColumnRange(const char *columnName, int *startCol, int *endCol) const
char * strpartdup(const char *str, int c1, int c2)
column * findColumn(const char *columntitle)
char * GBS_global_string_copy(const char *templat,...)