Skip to content

Commit

Permalink
rounded floating values
Browse files Browse the repository at this point in the history
  • Loading branch information
sigven committed Jan 27, 2022
1 parent 05da2ea commit 52b0044
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vcf2tsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import math
import subprocess

version = '0.3.6'
version = '0.3.7.1'


def __main__():
Expand Down Expand Up @@ -201,7 +201,10 @@ def vcf2tsv(query_vcf, out_tsv, skip_info_data, skip_genotype_data, keep_rejecte
## sample-wise
while j < dim[0]:
if sample_dat[j].size > 1:

d = ','.join(str(e) for e in np.ndarray.tolist(sample_dat[j]))
if column_types[format_tag] == 'Float':
d = ','.join(str(round(e, 4)) for e in np.ndarray.tolist(sample_dat[j]))
## undefined/missing value
if '-2147483648' in d:
d = d.replace('-2147483648', '.')
Expand Down

0 comments on commit 52b0044

Please sign in to comment.