Skip to content

Commit

Permalink
Add root['meta']['updated'] to default exclude paths to simplify di…
Browse files Browse the repository at this point in the history
…ff_jsons.py invocations
  • Loading branch information
corneliusroemer committed Nov 9, 2024
1 parent e596b50 commit 21d2227
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/diff_jsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
parser.add_argument("first_json", help="first JSON to compare")
parser.add_argument("second_json", help="second JSON to compare")
parser.add_argument("--significant-digits", type=int, default=5, help="number of significant digits to use when comparing numeric values")
parser.add_argument("--exclude-paths", nargs="+", action=ExtendOverwriteDefault, help="list of paths to exclude from consideration when performing a diff", default=["root['generated_by']['version']"])
parser.add_argument("--exclude-paths", nargs="+", action=ExtendOverwriteDefault, help="list of paths to exclude from consideration when performing a diff", default=["root['generated_by']['version']", "root['meta']['updated']"])
parser.add_argument("--exclude-regex-paths", nargs="+", action="extend", help="list of path regular expressions to exclude from consideration when performing a diff")
parser.add_argument("--ignore-numeric-type-changes", action="store_true", help="ignore numeric type changes in the diff (e.g., int of 1 to float of 1.0)")

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/ancestral/cram/vcf-multi-allele.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See <https://github.com/nextstrain/augur/issues/1380> for the bug this is testin
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
> "$DATA/nt_muts.ref-seq.json" \
> nt_muts.json \
> --exclude-regex-paths "root\['nodes'\]\['.+'\]\['sequence'\]" "root\['generated_by'\]"
> --exclude-regex-paths "root\['nodes'\]\['.+'\]\['sequence'\]"
{'iterable_item_added': {"root['nodes']['sample_B']['muts'][0]": 'A30G'}}

$ cat > expected.vcf <<EOF
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/ancestral/cram/vcf.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ but it will have the reference sequence attached.
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
> "$DATA/nt_muts.ref-seq.json" \
> "nt_muts.vcf-input.ref-seq.json" \
> --exclude-regex-paths "root\['nodes'\]\['.+'\]\['sequence'\]" "root\['generated_by'\]"
> --exclude-regex-paths "root\['nodes'\]\['.+'\]\['sequence'\]"
{}

Here's the same mutations as in $DATA/nt_muts.ref-seq.json,
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/translate/cram/general.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ which validate the output will fail as it's missing a 'nuc' annotation.
$ python3 "$SCRIPTS/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> "aa_muts.json" \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{}

Same as above but using a GenBank file. This changes the 'type' of the annotations,
Expand All @@ -33,5 +33,5 @@ but this is irrelevant for Auspice's use and simply reflects the reference sourc
$ python3 "$SCRIPTS/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> "aa_muts.genbank.json" \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root\['annotations'\]\['.+'\]\['type'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['(seqid|type)'\]"
{}
3 changes: 1 addition & 2 deletions tests/functional/translate/cram/genes.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ as a feature ('nuc' in this case)
$ python3 "$SCRIPTS/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> "aa_muts.genes-args.json" \
> --exclude-regex-paths "seqid" "gene1" "root['meta']['updated']"
> --exclude-regex-paths "seqid" "gene1"
{}
Using a text file rather than command line arguments

Expand All @@ -45,5 +45,4 @@ Using a text file rather than command line arguments
$ python3 "$SCRIPTS/diff_jsons.py" \
> "aa_muts.genes-args.json" \
> "aa_muts.genes-txt.json" \
> --exclude-paths "root['meta']['updated']"
{}
2 changes: 1 addition & 1 deletion tests/functional/translate/cram/gff.t
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ GFF file with 'region' removed, so the only genome information is the ##sequence
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> "aa_muts.pragma-only.json" \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{}

GFF file with no genome coordinate information
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/translate/cram/root-mutations.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ is unchanged (MPCG*). There is also a mutation E4G at the root node to compensat
$ python3 "$SCRIPTS/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> "aa_muts.json" \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{'values_changed': {"root['reference']['gene1']": {'new_value': 'MPCE*', 'old_value': 'MPCG*'}}, 'iterable_item_added': {"root['nodes']['node_root']['aa_muts']['gene1'][0]": 'E4G'}}
2 changes: 1 addition & 1 deletion tests/functional/translate/cram/translate-with-genbank.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Translate amino acids for genes using a GenBank file.
amino acid mutations written to .* (re)

$ python3 "$SCRIPTS/diff_jsons.py" $DATA/zika/aa_muts_genbank.json aa_muts.json \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{}
2 changes: 1 addition & 1 deletion tests/functional/translate/cram/vcf-with-root-mutation.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ node is E (and so are all the other nodes))
$ python3 "$SCRIPTS/diff_jsons.py" \
> aa_muts.truth.json \
> aa_muts.json \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{}
2 changes: 1 addition & 1 deletion tests/functional/translate/cram/vcf.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Setup
$ python3 "$SCRIPTS/diff_jsons.py" \
> "$DATA/aa_muts.json" \
> aa_muts.json \
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]" "root['meta']['updated']"
> --exclude-regex-paths "root\['annotations'\]\['.+'\]\['seqid'\]"
{}

------------------------------ MISSING TEST ----------------------------------
Expand Down

0 comments on commit 21d2227

Please sign in to comment.