12 "Executes a probe match on a running PT server\n"
16 " --port <PORT> port of PT server\n"
17 " --sequence <SEQUENCE> probe\n"
19 " --complementFirst before matching first complement probe (applied before '--alsoRevCompl')\n"
20 " --alsoRevCompl also report matches of reverse-complement probe\n"
21 " (Note: specifying both does report complement plus reverse matches)\n"
23 " --max-hits <NUM> maximum number of hits (default:1,000,000; 0 means 'unlimited')\n"
24 " --weighted use weighted matching\n"
25 " --weighted-pos use weighted matching with pos&strength\n"
26 " --n-matches <NUM1> accept NUM1 occurrences of 'N' as match (default:2)\n"
27 " --n-match-bound <NUM2> when NUM2 occurrences of 'N' are encountered => all 'N's count as mismatch (default:5)\n"
28 " (inbetween all 'N' above NUM1 count as mismatch)"
29 " --mismatches <NUM> accept NUM mismatches (default:0)\n"
41 const char* port =
NULp;
42 const char* sequence =
NULp;
44 int complementFirst = 0;
45 int max_hits = 1000000;
49 int max_mismatches = 0;
58 for (
int i = 1; i < argc; i++) {
60 if (!strcmp(argv[i],
"--help")) {
63 }
else if (!strcmp(argv[i],
"--alsoRevCompl")) {
65 }
else if (!strcmp(argv[i],
"--complementFirst")) {
67 }
else if (!strcmp(argv[i],
"--weighted")) {
69 }
else if (!strcmp(argv[i],
"--weighted-pos")) {
71 }
else if (argc > i+1) {
72 if (!strcmp(argv[i],
"--port")) {
74 }
else if (!strcmp(argv[i],
"--sequence")) {
76 }
else if (!strcmp(argv[i],
"--max-hits")) {
77 max_hits = atoi(argv[++i]);
78 }
else if (!strcmp(argv[i],
"--n-matches")) {
79 n_accept = atoi(argv[++i]);
80 }
else if (!strcmp(argv[i],
"--n-match-bound")) {
81 n_limit = atoi(argv[++i]);
82 }
else if (!strcmp(argv[i],
"--mismatches")) {
83 max_mismatches = atoi(argv[++i]);
91 cerr <<
"Error: Did not understand argument '" << argv[i]
92 <<
"'." << endl << endl;
101 cerr <<
"need '--port' parameter" << endl;
105 cerr <<
"need '--sequence' parameter" << endl;
108 if (max_mismatches < 0 || max_mismatches > 10) {
109 cerr <<
"mismatches must be between 0 and 10" << endl;
124 error =
"Cannot contact PT server [1]";
126 else if (
aisc_create(link, PT_MAIN, com, MAIN_LOCS, PT_LOCS, locs,
NULp)) {
127 error =
"Cannot contact PT server [2]";
132 cerr <<
"Error in arb_probe_match: " << error << endl;
137 LOCS_MATCH_ALSO_REVCOMP, (
long)alsoRevCompl,
138 LOCS_COMPLEMENT_FIRST, (
long)complementFirst,
139 LOCS_MATCH_MAX_HITS, (
long)max_hits,
140 LOCS_MATCH_SORT_BY, (
long)sort_by,
141 LOCS_MATCH_N_ACCEPT, (
long)n_accept,
142 LOCS_MATCH_N_LIMIT, (
long)n_limit,
143 LOCS_MATCH_MAX_MISMATCHES, (
long)max_mismatches,
144 LOCS_SEARCHMATCH, sequence,
146 cerr <<
"Connection to PT server lost" << endl;
150 T_PT_MATCHLIST match_list;
152 long match_list_cnt = 0;
153 long matches_truncated = 0;
158 char *locs_error =
NULp;
161 LOCS_MATCH_LIST, match_list.as_result_param(),
162 LOCS_MATCH_LIST_CNT, &match_list_cnt,
163 LOCS_MATCH_STRING, &bs,
164 LOCS_MATCHES_TRUNCATED, &matches_truncated,
165 LOCS_ERROR, &locs_error,
169 if (*locs_error) cerr <<
"received error: " << *locs_error << endl;
173 if (matches_truncated) {
174 std::cout <<
"match list was truncated!" << endl;
177 std::cout <<
"acc \t"
189 while (match_list.exists()) {
190 char *m_acc, *m_sequence;
191 long m_start, m_stop, m_pos, m_mismatches, m_n_mismatches;
193 double m_wmismatches, m_dt;
195 aisc_get(link, PT_MATCHLIST, match_list,
196 MATCHLIST_FIELD_ACC, &m_acc,
197 MATCHLIST_FIELD_START, &m_start,
198 MATCHLIST_FIELD_STOP, &m_stop,
199 MATCHLIST_POS, &m_pos,
200 MATCHLIST_MISMATCHES, &m_mismatches,
201 MATCHLIST_WMISMATCHES, &m_wmismatches,
202 MATCHLIST_N_MISMATCHES, &m_n_mismatches,
204 MATCHLIST_OVERLAY, &m_sequence,
205 MATCHLIST_REVERSED, &m_reversed,
206 MATCHLIST_NEXT, match_list.as_result_param(),
209 std::cout << m_acc <<
"\t"
213 << m_mismatches <<
"\t"
214 << m_wmismatches <<
"\t"
215 << m_n_mismatches <<
"\t"
217 << m_reversed <<
"\t"
218 << m_sequence <<
"\t"
int aisc_close(aisc_com *link, AISC_Object &object)
int aisc_nput(aisc_com *link, int o_type, const AISC_Object &object,...)
int ARB_main(int argc, char **argv)
static void error(const char *msg)
#define AISC_MAGIC_NUMBER
aisc_com * aisc_open(const char *path, AISC_Object &main_obj, long magic, GB_ERROR *error)
int aisc_get(aisc_com *link, int o_type, const AISC_Object &object,...)
int aisc_create(aisc_com *link, int father_type, const AISC_Object &father, int attribute, int object_type, AISC_Object &object,...)