Streamstats

Hi,
I added some new features to `samtools flagstat`.

- multiple output format (standard, json, xml)
- setting the qual for diffchrhigh
- more that one BAM file
- ouput name for report. If set, one use pipelining

## Examples:
### xml

```
$ curl -s "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase1/data/NA12273/alignment/NA12273.mapped.ILLUMINA.bwa.CEU.low_coverage.20101123.bam" | 
./samtools view -h - |
head -n 10000 | 
samtools view -Sb - |
 ./samtools flagstat -fX -  |
 xmllint --format - | 
head -n 20

<?xml version="1.0"?>
<array xmlns="http://www.ibm.com/xmlns/prod/2009/jsonx">
  <object>
    <string name="file">-</string>
    <object name="total">
      <number name="pass">9907</number>
      <number name="fail">0</number>
    </object>
    <object name="duplicates">
      <number name="pass">661</number>
      <number name="fail">0</number>
    </object>
    <object name="mapped">
      <number name="pass">9523</number>
      <number name="fail">0</number>
    </object>
    <object name="paired">
      <number name="pass">9874</number>
      <number name="fail">0</number>
    </object>
```
### JSON
```
$ curl -s "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase1/data/NA12273/alignment/NA12273.mapped.ILLUMINA.bwa.CEU.low_coverage.20101123.bam" |
 ./samtools view -h - | head -n 10000 | 
 ./samtools view -Sb - | 
./samtools flagstat -fJ -  |python -mjson.tool

[
    {
        "diffchr": {
            "fail": 0, 
            "pass": 804
        }, 
        "diffchrhigh": {
            "fail": 0, 
            "pass": 345
        }, 
        "duplicates": {
            "fail": 0, 
            "pass": 661
        }, 
        "file": "-", 
        "mapped": {
            "fail": 0, 
            "pass": 9523
        }, 
        "pair_map": {
            "fail": 0, 
            "pass": 9106
        }, 
        "paired": {
            "fail": 0, 
            "pass": 9874
        }, 
```
## standard
```
$ curl -s "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase1/data/NA12273/alignment/NA12273.mapped.ILLUMINA.bwa.CEU.low_coverage.20101123.bam" | 
./samtools view -h - | head -n 10000 |
 ./samtools view -Sb - |
 ./samtools flagstat -

File: -
9907 + 0 in total (QC-passed reads + QC-failed reads)
661 + 0 duplicates
9523 + 0 mapped (96.12%:-nan%)
9874 + 0 paired in sequencing
4903 + 0 read1
4971 + 0 read2
8135 + 0 properly paired (82.39%:-nan%)
9106 + 0 with itself and mate mapped
384 + 0 singletons (3.89%:-nan%)
804 + 0 with mate mapped to a different chr
345 + 0 with mate mapped to a different chr (mapQ>=5)
```
## Streaming
```
$ curl -s "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase1/data/NA12273/alignment/NA12273.mapped.ILLUMINA.bwa.CEU.low_coverage.20101123.bam" |
 ./samtools view -h - | head -n 10000 |  
./samtools view -Sb - | ./samtools flagstat -s -o report1.txt - | 
 ./samtools view  -b -f4 - |  ./samtools flagstat  -o report2.txt - 
```

```
$ cat report1.txt report2.txt 
File: -
9907 + 0 in total (QC-passed reads + QC-failed reads)
661 + 0 duplicates
9523 + 0 mapped (96.12%:-nan%)
9874 + 0 paired in sequencing
4903 + 0 read1
4971 + 0 read2
8135 + 0 properly paired (82.39%:-nan%)
9106 + 0 with itself and mate mapped
384 + 0 singletons (3.89%:-nan%)
804 + 0 with mate mapped to a different chr
345 + 0 with mate mapped to a different chr (mapQ>=5)

File: -
384 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
0 + 0 mapped (0.00%:-nan%)
384 + 0 paired in sequencing
89 + 0 read1
295 + 0 read2
0 + 0 properly paired (0.00%:-nan%)
0 + 0 with itself and mate mapped
0 + 0 singletons (0.00%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
```

## multiple bam
```
$   ./samtools flagstat  /home/lindenb/samtools-0.1.18/examples/ex1a.bam /home/lindenb/samtools-0.1.18/examples/toy.bam

File: /home/lindenb/samtools-0.1.18/examples/ex1a.bam
3307 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
3271 + 0 mapped (98.91%:-nan%)
3307 + 0 paired in sequencing
1654 + 0 read1
1653 + 0 read2
3144 + 0 properly paired (95.07%:-nan%)
3144 + 0 with itself and mate mapped
127 + 0 singletons (3.84%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)


File: /home/lindenb/samtools-0.1.18/examples/toy.bam
12 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
12 + 0 mapped (100.00%:-nan%)
2 + 0 paired in sequencing
1 + 0 read1
1 + 0 read2
2 + 0 properly paired (100.00%:-nan%)
2 + 0 with itself and mate mapped
0 + 0 singletons (0.00%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
```

Pierre