Skip to content

Instantly share code, notes, and snippets.

View eweitz's full-sized avatar

Eric Weitz eweitz

View GitHub Profile
@eweitz
eweitz / wikipathways-review.js
Last active July 22, 2024 12:10
Summarize recent changes in WikiPathways
// This JavaScript code helps summarize recent changes for WikiPathways
// See output at e.g. https://github.com/wikipathways/wikipathways-help/discussions/124
//
// To run:
// - Go to https://classic.wikipathways.org/index.php?title=Special:RecentPathwayChanges&limit=500&offset=0
// - Open Developer Tools in your web browser
// - Update the `dates` array below
// - Execute code, e.g. by putting cursor at end of last line and pressing Return / Enter
//
// The output can be pasted into the "Recent changes" section for new Weekly Review Report entries
@eweitz
eweitz / wikipathways-by-organism.sh
Last active June 9, 2021 12:44
Pathway count by organism in WikiPathways
# Get number of pathways by organism in WikiPathways
# Graph of output:
# https://docs.google.com/spreadsheets/d/1zZSqeKufuYxfFd3pFeMAUOjCm1sLRAw5SgJ4OJel9M8/edit?usp=sharing
# Fetch all organisms in WikiPathways
curl -s https://webservice.wikipathways.org/listOrganisms?format=json | jq .organisms[] > organisms-wikipathways.json
# Fetch all pathways in WikiPathways
curl -s https://webservice.wikipathways.org/listPathways?format=json | jq . > all-wikipathways.json
@eweitz
eweitz / extract_scp_study_metadata.py
Last active February 1, 2019 15:03
Extract study metadata using Python bindings for Single Cell Portal REST API
"""Extract public study metadata using Python bindings for SCP REST API
See https://github.com/broadinstitute/single_cell_portal/issues/52 for context and usage notes.
"""
import argparse
import json
import pprint
import scp_api
@eweitz
eweitz / chr_rs_acc_via_eutils.py
Created April 25, 2017 15:33
NCBI EUtils demo: get a chromosome's RefSeq accession given its name and assembly
'''
This simple script shows how to use NCBI E-Utilies to get a chromosome's
RefSeq accession given the chromosome's name and its genome assembly.
Example:
$ python3 chr_rs_acc_via_eutils.py
RefSeq accession for chromosome 6 on genome assembly GRCh38 (GCF_000001405.26):
NC_000006.12
'''
@eweitz
eweitz / protein_hgvs_for_snp_id.py
Last active January 28, 2019 03:14
How to get protein change HGVS data for a given dbSNP RS ID, using NCBI EUtils
"""Python 3 script to get partial protein HGVS given NCBI dbSNP ID
Example:
$ python3 protein_hgvs_for_snp_id.py 334
snp_id:
334
gene:
{'name': 'HBB', 'gene_id': '3043'}
protein_change_hgvs:
@eweitz
eweitz / ncbi_sequence_viewer_plasmodium.html
Last active June 16, 2016 04:04
Plasmodium falciparum chromosome 1 in NCBI Sequence Viewer
<!DOCTYPE html>
<html>
<head>
<!-- Include sviewer.js. Don't forget id="autoload"! -->
<script type="text/javascript" src="https://www.ncbi.nlm.nih.gov/projects/sviewer/js/sviewer.js" id="autoload"></script>
</head>
<body>
<h1>NCBI Sequence Viewer: Plasmodium falciparum strain 3D7, chromosome 1</h1>
<!--
Sequence Viewer Embedding API: https://www.ncbi.nlm.nih.gov/tools/sviewer/embedding-api/
@eweitz
eweitz / http_debugging.py
Last active November 12, 2022 20:32 — forked from tonetheman/http_debugging.py
Debug requests for urllib in Python 3
"""" Tested in Python 3.4 """
import urllib.request
import http.client
http.client.HTTPConnection.debuglevel = 1
response = urllib.request.urlopen('https://github.com/eweitz')