-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[curate rename] allow column duplication
See discussion in PR review for context <#1506 (comment)>
- Loading branch information
1 parent
1b653e9
commit 8afabe4
Showing
2 changed files
with
46 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Setup | ||
|
||
$ export AUGUR="${AUGUR:-$TESTDIR/../../../../../bin/augur}" | ||
|
||
$ cat >records.ndjson <<~~ | ||
> {"accession": "record_1", "country": "country_1"} | ||
> {"accession": "record_2", "country": "country_2"} | ||
> ~~ | ||
|
||
|
||
Asking to rename the same column multiple times results in duplication of the column. | ||
Additional columns are inserted next to the existing one, and the order of the new columns | ||
matches the field-map | ||
|
||
$ AUGUR curate rename --field-map "accession=id" "accession=genbank_accession" < <(cat records.ndjson) | ||
{"id": "record_1", "genbank_accession": "record_1", "country": "country_1"} | ||
{"id": "record_2", "genbank_accession": "record_2", "country": "country_2"} | ||
|
||
|
||
We can use the same name to keep the original column | ||
|
||
$ AUGUR curate rename --field-map "accession=id" "accession=accession" < <(cat records.ndjson) | ||
{"id": "record_1", "accession": "record_1", "country": "country_1"} | ||
{"id": "record_2", "accession": "record_2", "country": "country_2"} |