* allow to select a read group at view command-line
AOBJS= bam_sort.o bam_tview.o bam_maqcns.o bam_plcmd.o sam_view.o \
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
bamtk.o
AOBJS= bam_sort.o bam_tview.o bam_maqcns.o bam_plcmd.o sam_view.o \
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
bamtk.o
INCLUDES=
SUBDIRS= . misc
INCLUDES=
SUBDIRS= . misc
#include "bam.h"
#ifndef PACKAGE_VERSION
#include "bam.h"
#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.4-10 (r341)"
+#define PACKAGE_VERSION "0.1.4-11 (r346)"
#endif
int bam_taf2baf(int argc, char *argv[]);
#endif
int bam_taf2baf(int argc, char *argv[]);
#include "sam.h"
static int g_min_mapQ = 0, g_flag_on = 0, g_flag_off = 0;
#include "sam.h"
static int g_min_mapQ = 0, g_flag_on = 0, g_flag_off = 0;
+static char *g_library, *g_rg;
static inline int __g_skip_aln(const bam_header_t *h, const bam1_t *b)
{
if (b->core.qual < g_min_mapQ || ((b->core.flag & g_flag_on) != g_flag_on) || (b->core.flag & g_flag_off))
return 1;
static inline int __g_skip_aln(const bam_header_t *h, const bam1_t *b)
{
if (b->core.qual < g_min_mapQ || ((b->core.flag & g_flag_on) != g_flag_on) || (b->core.flag & g_flag_off))
return 1;
+ if (g_library || g_rg) {
uint8_t *s = bam_aux_get(b, "RG");
if (s) {
uint8_t *s = bam_aux_get(b, "RG");
if (s) {
- const char *p = bam_strmap_get(h->rg2lib, (char*)(s + 1));
- return (p && strcmp(p, g_library) == 0)? 0 : 1;
+ if (g_rg && strcmp(g_rg, (char*)(s + 1)) == 0) return 0;
+ if (g_library) {
+ const char *p = bam_strmap_get(h->rg2lib, (char*)(s + 1));
+ return (p && strcmp(p, g_library) == 0)? 0 : 1;
+ } return 1;
} else return 1;
} else return 0;
}
} else return 1;
} else return 0;
}
/* parse command-line options */
strcpy(in_mode, "r"); strcpy(out_mode, "w");
/* parse command-line options */
strcpy(in_mode, "r"); strcpy(out_mode, "w");
- while ((c = getopt(argc, argv, "Sbt:hHo:q:f:F:ul:")) >= 0) {
+ while ((c = getopt(argc, argv, "Sbt:hHo:q:f:F:ul:r:")) >= 0) {
switch (c) {
case 'S': is_bamin = 0; break;
case 'b': is_bamout = 1; break;
switch (c) {
case 'S': is_bamin = 0; break;
case 'b': is_bamout = 1; break;
case 'q': g_min_mapQ = atoi(optarg); break;
case 'u': is_uncompressed = 1; break;
case 'l': g_library = strdup(optarg); break;
case 'q': g_min_mapQ = atoi(optarg); break;
case 'u': is_uncompressed = 1; break;
case 'l': g_library = strdup(optarg); break;
+ case 'r': g_rg = strdup(optarg); break;
default: return usage();
}
}
default: return usage();
}
}
view_end:
// close files, free and return
view_end:
// close files, free and return
- free(fn_list); free(fn_out); free(g_library);
+ free(fn_list); free(fn_out); free(g_library); free(g_rg);
samclose(in);
samclose(out);
return ret;
samclose(in);
samclose(out);
return ret;
fprintf(stderr, " -f INT required flag, 0 for unset [0]\n");
fprintf(stderr, " -F INT filtering flag, 0 for unset [0]\n");
fprintf(stderr, " -q INT minimum mapping quality [0]\n");
fprintf(stderr, " -f INT required flag, 0 for unset [0]\n");
fprintf(stderr, " -F INT filtering flag, 0 for unset [0]\n");
fprintf(stderr, " -q INT minimum mapping quality [0]\n");
+ fprintf(stderr, " -l STR only output reads in library STR [null]\n");
+ fprintf(stderr, " -r STR only output reads in read group STR [null]\n");
fprintf(stderr, "\n\
Notes:\n\
\n\
fprintf(stderr, "\n\
Notes:\n\
\n\
Unaligned words used in bam_import.c, bam_endian.h, bam.c and bam_aux.c.
.IP o 2
CIGAR operation P is not properly handled at the moment.
Unaligned words used in bam_import.c, bam_endian.h, bam.c and bam_aux.c.
.IP o 2
CIGAR operation P is not properly handled at the moment.
-.IP o 2
-The text viewer mysteriously crashes in a very rare case.