bam2UniquePairs.py - filter/report uniquely mapped read pairs from a (bwa!) bam-file

Tags

Genomics NGS

Purpose

Utility script to report and/or filter out “uniquely mapped” properly paired reads

Reports:

  1. The percentage of properly mapped read pairs with at least one uniquely mapped (XT=U) read

  2. The percentage of properly mapped read pairs with at least one best mapped (X0-1) read

  3. The percentage of properly mapped read pairs with at least one uniquely or best mapped (X0-1) read

If outfile is specified, reads are emitted when they are properly paired and the pair has at least one read that is either best or uniquely mapped.

Duplication is ignored.

Only BWA is supported.

TODO: cache and emit reads rather than iterating over the samfile twice…

usage: bam2UniquePairs [-h] [--version] [-f FILENAME] [-a ALIGNER] [-r REPORT]
                       [-o OUTFILE] [--timeit TIMEIT_FILE]
                       [--timeit-name TIMEIT_NAME] [--timeit-header]
                       [--random-seed RANDOM_SEED] [-v LOGLEVEL]
                       [--log-config-filename LOG_CONFIG_FILENAME]
                       [--tracing {function}] [-? ?]
                       [-P OUTPUT_FILENAME_PATTERN] [-F] [-I STDIN]
                       [-L STDLOG] [-E STDERR] [-S STDOUT]
bam2UniquePairs: error: argument -?: expected one argument