Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutate2 returns Invalid token: '_' #173

Closed
tolot27 opened this issue Nov 10, 2021 · 2 comments
Closed

mutate2 returns Invalid token: '_' #173

tolot27 opened this issue Nov 10, 2021 · 2 comments

Comments

@tolot27
Copy link

tolot27 commented Nov 10, 2021

I've used mutate2 of the latest version of the Linux and Windows binaries provided at #153 (comment) to add an additional column to my dataset. Most of the time, it reports:

[ERRO] Invalid token: '_'

But after running it ten or more times, it passes and returns a result.

Some other intermediate builds after 0.23 have this problem with mutate2 as well but not the release version v0.23 or older versions.

Small file to reproduce: R176_stats.txt

Command to reproduce:

./csvtk -t mutate2 -n target_ratio -e '$reads_mapped/$reads' R176_stats.txt

head can be used to reduce the data set to fewer lines. Then the error occurs less frequent:

./csvtk -t mutate2 -n target_ratio -e '$reads_mapped/$reads' <(head -8 R176_stats.txt)
@shenwei356
Copy link
Owner

It's a bug occured when using two or more columns with common prefixes in column names, e.g., $reads_mapped and $reads share $reads.

But after running it ten or more times, it passes and returns a result.

The order of replacing variables with responding data is random (using map), so it happened sometimes.

$ csvtk -t mutate2 -n target_ratio -e '$reads_mapped/$reads' <(head -8 R176_stats.txt)
Sample  FMG-ID  Run     Pool    Ct      reads   reads_mapped    bases_uncovered cov_median      cov_std target_ratio
DH219441        FMG-AB558       R176-AB477      PL-AA114_25_100 19,96   19800   1908    514     8.00    4.63    0.10
DH219442        FMG-AB559       R176-AB478      PL-AA114_25_100 16,53   44384   36554   33      165.00  40.89   0.82
DH219443        FMG-AB560       R176-AB479      PL-AA114_25_100 16,94   23376   16905   38      76.00   21.04   0.72
DH219444        FMG-AB561       R176-AB480      PL-AA113_10_100 14,03   253236  230901  1       997.00  283.69  0.91
DH219445        FMG-AB562       R176-AB481      PL-AA113_10_100 10,22   302762  287621  0       1231.00 444.63  0.95
DH219446        FMG-AB563       R176-AB482      PL-AA113_10_100 15,02   289706  273986  2       1224.00 272.06  0.95
DH219447        FMG-AB564       R176-AB483      PL-AA113_10_100 15,75   44504   40738   6       174.00  69.97   0.92

@tolot27
Copy link
Author

tolot27 commented Nov 10, 2021

It works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants