bedops icon indicating copy to clipboard operation
bedops copied to clipboard

Investigate having `--min`/`--max`/etc. operators support `--echo-*` with `--prec N`

Open alexpreynolds opened this issue 3 years ago • 0 comments

Given A.bed:

chr1    2849089 2849142 id-639  35      .       -1      -1      3.51493

Given B.bed:

chr1    2849089 2849124 i       0.000838724
chr1    2849124 2849125 i       0.000305542
chr1    2849125 2849132 i       0.000428122
chr1    2849132 2849134 i       0.000600718
chr1    2849134 2849142 i       0.000428122

Consider output from this command:

$ bedmap --chrom chr1 --sci --prec 5 --echo --echo-map --min --min-element A.bed B.bed
chr1    2849089 2849142 id-639  35      .       -1      -1      3.51493|chr1    2849089 2849124 i       0.000839;chr1   2849124 2849125 i       0.000306;chr1   2849125 2849132 i       0.000428;chr1   2849132 2849134 i       0.000601;chr1   2849134 2849142 i       0.000428|3.05542e-04|chr1       2849124 2849125 i       3.05542e-04

While --min and --min-element use --sci --prec 5 to report the score value of the minimum-scoring element with the specified precision, --echo and --echo-map do not.

It might be worth taking a look at the patches leading up to v2.4.12 to see what would be involved in reformatting score output from --echo-* operations.

Perhaps a --apply-prec-to-all or similar option could be used to preserve existing behavior for older pipelines. Or we break with the old approach and apply the format specifier globally, if specified via --prec.

A related issue may be #219. Performance concerns were raised by Shane.

alexpreynolds avatar Mar 10 '21 20:03 alexpreynolds