Skip to content

Commit

Permalink
update to -l
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanding Zhou committed Sep 16, 2020
1 parent a605734 commit 64218b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ void tbk_print1(tbk_data_t *d, int i, view_conf_t *conf, kstring_t *ks) {
float data = ((float*) (d->data))[i*2];
int data2 = ((int32_t*) (d->data))[i*2+1];
if (conf->na_for_negative && data < 0) {
{ kputc('\t', ks); kputs(conf->na_token, ks); }
kputc('\t', ks); kputs(conf->na_token, ks);
} else {
if (conf->min_coverage >= 0 && data2 < conf->min_coverage) {
{ kputc('\t', ks); kputs(conf->na_token, ks); }
kputc('\t', ks); kputs(conf->na_token, ks);
} else {
ksprintf(ks, "\t%f", data);
}
Expand All @@ -109,10 +109,10 @@ void tbk_print1(tbk_data_t *d, int i, view_conf_t *conf, kstring_t *ks) {
float data = ((float*) (d->data))[i*2];
float data2 = ((float*) (d->data))[i*2+1];
if (conf->na_for_negative && data < 0) {
{ kputc('\t', ks); kputs(conf->na_token, ks); }
kputc('\t', ks); kputs(conf->na_token, ks);
} else {
if (conf->max_pval >= 0 && data2 > conf->max_pval) {
{ kputc('\t', ks); kputs(conf->na_token, ks); }
kputc('\t', ks); kputs(conf->na_token, ks);
} else {
ksprintf(ks, "\t%f", data);
}
Expand Down
28 changes: 16 additions & 12 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char

int data;
fread(&data, 4, 1, tbk->fh); tbk->offset++;
if (conf->na_for_negative && data < 0) { fputc('\t', out_fh); fputs(conf->na_token, out_fh); }
else fprintf(out_fh, "\t%d", data);
if (conf->na_for_negative && data < 0) {
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else fprintf(out_fh, "\t%d", data);
break;
}
case DT_FLOAT: {
Expand All @@ -154,8 +155,9 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char

float data;
fread(&data, 4, 1, tbk->fh); tbk->offset++;
if (conf->na_for_negative && data < 0) { fputc('\t', out_fh); fputs(conf->na_token, out_fh); }
else fprintf(out_fh, "\t%f", data);
if (conf->na_for_negative && data < 0) {
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else fprintf(out_fh, "\t%f", data);
break;
}
case DT_DOUBLE: {
Expand All @@ -167,8 +169,9 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char

double data;
fread(&data, 8, 1, tbk->fh); tbk->offset++;
if (conf->na_for_negative && data < 0) { fputc('\t', out_fh); fputs(conf->na_token, out_fh); }
else fprintf(out_fh, "\t%f", data);
if (conf->na_for_negative && data < 0) {
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else fprintf(out_fh, "\t%f", data);
break;
}
case DT_STRINGF: {
Expand Down Expand Up @@ -222,8 +225,9 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char
uint16_t data;
fread(&data, 2, 1, tbk->fh); tbk->offset++;
float dataf = uint16_to_float(data);
if (conf->na_for_negative && dataf < 0) fputs("\t.", out_fh);
else fprintf(out_fh, "\t%.*f", conf->precision, dataf);
if (conf->na_for_negative && dataf < 0) {
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else fprintf(out_fh, "\t%.*f", conf->precision, dataf);
/* fprintf(out_fh, "\t%d", data); */
break;
}
Expand All @@ -238,10 +242,10 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char
fread(&data, 4, 1, tbk->fh); fread(&data2, 4, 1, tbk->fh); tbk->offset++;

if (conf->na_for_negative && data < 0) {
fputs("\t.", out_fh);
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else {
if (conf->min_coverage >= 0 && data2 < conf->min_coverage) {
fputs("\t.", out_fh);
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else {
fprintf(out_fh, "\t%f", data);
}
Expand All @@ -260,10 +264,10 @@ void tbk_query(tbk_t *tbk, int64_t offset, view_conf_t *conf, FILE *out_fh, char
fread(&data, 4, 1, tbk->fh); fread(&data2, 4, 1, tbk->fh); tbk->offset++;

if (conf->na_for_negative && data < 0) {
fputs("\t.", out_fh);
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else {
if (conf->max_pval >= 0 && data2 > conf->max_pval) {
fputs("\t.", out_fh);
fputc('\t', out_fh); fputs(conf->na_token, out_fh);
} else {
fprintf(out_fh, "\t%f", data);
}
Expand Down

0 comments on commit 64218b9

Please sign in to comment.