"Search for PATTERN in the read sequences in each FILE or standard input.\n"
"PATTERN, by default, is a perl compatible regular expression.\n\n"
"Options:\n"
+" -i, --id match the read id (by default, sequence is matched)\n"
" -v, --invert-match select nonmatching entries\n"
" -c, --count output only the number of matching sequences\n"
" -h, --help print this message\n"
static int invert_flag;
static int count_flag;
+static int id_flag;
seq_t* seq = fastq_alloc_seq();
while (fastq_next(fqf, seq)) {
+
rc = pcre_exec(re, /* pattern */
NULL, /* extre data */
- seq->seq.s, /* subject */
- seq->seq.n, /* subject length */
+ id_flag ? seq->id1.s : seq->seq.s,
+ id_flag ? seq->id1.n : seq->seq.n,
0, /* subject offset */
0, /* options */
ovector, /* output vector */
invert_flag = 0;
count_flag = 0;
+ id_flag = 0;
int opt;
int opt_idx;
static struct option long_options[] =
{
+ {"id", no_argument, &id_flag, 1},
{"invert-match", no_argument, &invert_flag, 1},
{"count", no_argument, &count_flag, 1},
{"help", no_argument, NULL, 'h'},
};
while (1) {
- opt = getopt_long(argc, argv, "vchV", long_options, &opt_idx);
+ opt = getopt_long(argc, argv, "ivchV", long_options, &opt_idx);
if( opt == -1 ) break;
}
break;
+ case 'i':
+ id_flag = 1;
+ break;
+
case 'v':
invert_flag = 1;
break;