]> git.donarmstrong.com Git - samtools.git/blobdiff - bam_plcmd.c
Release samtools-0.1.8
[samtools.git] / bam_plcmd.c
index d34cd267a9edd363a32605c083fefe5ba512e8bb..6804795bd107405982cada8544051cc073fdf55e 100644 (file)
@@ -341,17 +341,19 @@ int bam_pileup(int argc, char *argv[])
     d->max_depth = 0;
        d->tid = -1; d->mask = BAM_DEF_MASK;
        d->c = bam_maqcns_init();
+       d->c->is_soap = 1; // change the default model
        d->ido = bam_maqindel_opt_init();
-       while ((c = getopt(argc, argv, "st:f:cT:N:r:l:d:im:gI:G:vM:S2aR:P")) >= 0) {
+       while ((c = getopt(argc, argv, "st:f:cT:N:r:l:d:im:gI:G:vM:S2aR:PA")) >= 0) {
                switch (c) {
                case 'a': d->c->is_soap = 1; break;
+               case 'A': d->c->is_soap = 0; break;
                case 's': d->format |= BAM_PLF_SIMPLE; break;
                case 't': fn_list = strdup(optarg); break;
                case 'l': fn_pos = strdup(optarg); break;
                case 'f': fn_fa = strdup(optarg); break;
                case 'T': d->c->theta = atof(optarg); break;
                case 'N': d->c->n_hap = atoi(optarg); break;
-               case 'r': d->c->het_rate = atof(optarg); break;
+               case 'r': d->c->het_rate = atof(optarg); d->ido->r_snp = d->c->het_rate; break;
                case 'M': d->c->cap_mapQ = atoi(optarg); break;
                case 'd': d->max_depth = atoi(optarg); break;
                case 'c': d->format |= BAM_PLF_CNS; break;
@@ -379,7 +381,7 @@ int bam_pileup(int argc, char *argv[])
                fprintf(stderr, "Usage:  samtools pileup [options] <in.bam>|<in.sam>\n\n");
                fprintf(stderr, "Option: -s        simple (yet incomplete) pileup format\n");
                fprintf(stderr, "        -S        the input is in SAM\n");
-               fprintf(stderr, "        -a        use the SOAPsnp model for SNP calling\n");
+               fprintf(stderr, "        -A        use the MAQ model for SNP calling\n");
                fprintf(stderr, "        -2        output the 2nd best call and quality\n");
                fprintf(stderr, "        -i        only show lines/consensus with indels\n");
                fprintf(stderr, "        -m INT    filtering reads with bits in INT [%d]\n", d->mask);
@@ -388,7 +390,7 @@ int bam_pileup(int argc, char *argv[])
                fprintf(stderr, "        -t FILE   list of reference sequences (force -S)\n");
                fprintf(stderr, "        -l FILE   list of sites at which pileup is output\n");
                fprintf(stderr, "        -f FILE   reference sequence in the FASTA format\n\n");
-               fprintf(stderr, "        -c        output the maq consensus sequence\n");
+               fprintf(stderr, "        -c        output the SOAPsnp consensus sequence\n");
                fprintf(stderr, "        -v        print variants only (for -c)\n");
                fprintf(stderr, "        -g        output in the GLFv3 format (suppressing -c/-i/-s)\n");
                fprintf(stderr, "        -T FLOAT  theta in maq consensus calling model (for -c/-g) [%f]\n", d->c->theta);
@@ -453,13 +455,13 @@ typedef struct {
 
 typedef struct {
        bamFile fp;
-       bam_iterf_t iter;
+       bam_iter_t iter;
 } mplp_aux_t;
 
 static int mplp_func(void *data, bam1_t *b)
 {
        mplp_aux_t *ma = (mplp_aux_t*)data;
-       if (ma->iter) return bam_iterf_read(ma->fp, ma->iter, b);
+       if (ma->iter) return bam_iter_read(ma->fp, ma->iter, b);
        return bam_read1(ma->fp, b);
 }
 
@@ -494,7 +496,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
                                exit(1);
                        }
                        if (i == 0) beg0 = beg, end0 = end;
-                       data[i]->iter = bam_iterf_query(idx, tid, beg, end);
+                       data[i]->iter = bam_iter_query(idx, tid, beg, end);
                        bam_index_destroy(idx);
                }
                if (i == 0) h = h_tmp;
@@ -536,7 +538,7 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn)
        bam_header_destroy(h);
        for (i = 0; i < n; ++i) {
                bam_close(data[i]->fp);
-               if (data[i]->iter) bam_iterf_destroy(data[i]->iter);
+               if (data[i]->iter) bam_iter_destroy(data[i]->iter);
                free(data[i]);
        }
        free(data); free(plp); free(ref); free(n_plp);