Skip to content

Instantly share code, notes, and snippets.

@fxp
Last active January 24, 2017 08:48
Show Gist options
  • Save fxp/339ef686d515fd481494678d546494f6 to your computer and use it in GitHub Desktop.
Save fxp/339ef686d515fd481494678d546494f6 to your computer and use it in GitHub Desktop.
download all omim with curl
if [ ! -d docs ]; then
mkdir docs
fi
KEY="YOUR-KEY"
function download_omim {
echo "download $1";
curl -s --fail "http://api.omim.org/api/entry?mimNumber=$1&apiKey=$KEY&format=json&include=all" | jq '.omim.entryList[0].entry' > docs/$1
}
# curl https://omim.org/static/omim/data/mim2gene.txt | grep -oh '^[0-9]\+' | sort | uniq | \
if ! hash jq 2>/dev/null; then
sudo apt-get install jq
fi
curl "https://omim.org/static/omim/data/mim2gene.txt" | awk 'NR>5 {print $1}' | sort | uniq | \
while read line; do
echo $line
cat docs/$line | jq '.' > /dev/null
if [ $? -ne 0 ] || [ ! -f docs/$line ]; then
download_omim $line
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment