Skip to content

Instantly share code, notes, and snippets.

@sacundim
Created December 9, 2021 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sacundim/94347be6feb88c64950f26acfeebaeaf to your computer and use it in GitHub Desktop.
Save sacundim/94347be6feb88c64950f26acfeebaeaf to your computer and use it in GitHub Desktop.
jq-based script to count sequences in Covariants.org
#!/usr/bin/env bash
#
# Fetch data from Covariants.org and count how many sequences
URL='https://raw.githubusercontent.com/hodcroftlab/covariants/master/web/data/perCountryData.json'
COUNTRY="${1?"No country given"}"
curl --compressed "${URL}" | jq "[
.regions
| .[]
| .distributions
| .[]
| select(.country==\"${COUNTRY}\")
| .distribution
| .[]
| .total_sequences
]
| add"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment