  	if (p->rid >= 0) { // with coordinate
  		kputs(bns->anns[p->rid].name, str); kputc('\t', str); // RNAME
  		kputl(p->pos + 1, str); kputc('\t', str); // POS
-@@ -847,6 +848,10 @@ void mem_aln2sam(const mem_opt_t *opt, c
+@@ -847,6 +850,10 @@ void mem_aln2sam(const mem_opt_t *opt, c
  				int c = p->cigar[i]&0xf;
  				if (!(opt->flag&MEM_F_SOFTCLIP) && !p->is_alt && (c == 3 || c == 4))
  					c = which? 4 : 3; // use hard clipping for supplementary alignments

+			kputsn("NA", 2, str);
+		}
+		kputc(',', str);
+		kputw(p->pair_score, str); // ztz5
+		kputc(',', str);
+		if(p->pair_sub >= 0) {
+			kputw(p->pair_score - p->pair_sub, str); // ztz6
+		} else {
+			kputsn("NA", 2, str);
+		}
+		kputc(',', str);
+		kputw(p->n_comp, str); // ztz7
+		kputc(',', str);
+		kputw(p->seedlen0, str); // ztz8
+		kputc(',', str);
+		kputw(p->sub_n, str); // ztz9
+		kputc(',', str);
+		kputw(p->pair_nsub, str); // ztz10
+		kputc(',', str);
+		kputw((int)(p->frac_rep * 1000.0), str); // ztz11
+		kputc(',', str);
+		kputw((int)(p->pair_frac_rep * 1000.0), str); // ztz12
+		kputc(',', str);
+		kputw((int)(p->seedcov * 1000.0), str); // ztz13
+		kputc(',', str);
+		kputw((int)(p->pair_seedcov * 1000.0), str); // ztz14
+	}
 	kputc('\n', str);
 }
 
@@ -1131,6 +1180,13 @@ mem_aln_t mem_reg2aln(const mem_opt_t *o
 	a.pos = pos - bns->anns[a.rid].offset;
 	a.score = ar->score; a.sub = ar->sub > ar->csub? ar->sub : ar->csub;
 	a.is_alt = ar->is_alt; a.alt_sc = ar->alt_sc;
+	a.seedlen0 = ar->seedlen0;
+	a.n_comp = ar->n_comp;
+	a.seedcov = ((float)ar->seedcov) / l_query;
+	a.frac_rep = ar->frac_rep;
+	a.sub_n = ar->sub_n;
+	a.pair_score = a.pair_sub = a.pair_nsub = 0;
+	a.pair_frac_rep = a.pair_seedcov = 0.;
 	free(query);

diff -rupN -x Xcode -x .git bwa/bwamem.c bwa-mod/bwamem.c
--- bwa/bwamem.c	2015-07-08 13:14:28.000000000 -0400
+++ bwa-mod/bwamem.c	2016-07-30 14:52:44.000000000 -0400
@@ -512,6 +512,8 @@ static void mem_mark_primary_se_core(con
 			int e_min = a[j].qe < a[i].qe? a[j].qe : a[i].qe;
 			if (e_min > b_max) { // have overlap
 				int min_l = a[i].qe - a[i].qb < a[j].qe - a[j].qb? a[i].qe - a[i].qb : a[j].qe - a[j].qb;
+				a[j].osub = a[j].osub < a[i].score ? a[i].score : a[j].osub;
+				a[j].osub_n++;
 				if (e_min - b_max >= min_l * opt->mask_level) { // significant overlap
 					if (a[j].sub == 0) a[j].sub = a[i].score;
 					if (a[j].score - a[i].score <= tmp && (a[j].is_alt || !a[i].is_alt))
@@ -838,6 +840,7 @@ void mem_aln2sam(const mem_opt_t *opt, c
 	ks_resize(str, str->l + s->l_seq + l_name + (s->qual? s->l_seq : 0) + 20);
 	kputsn(s->name, l_name, str); kputc('\t', str); // QNAME
 	kputw((p->flag&0xffff) | (p->flag&0x10000? 0x100 : 0), str); kputc('\t', str); // FLAG
