Skip to content

Instantly share code, notes, and snippets.


Daniel Himmelstein dhimmel

View GitHub Profile
dhimmel /
Created Dec 1, 2020
Review of TIGA (Target illumination GWAS analytics) preprint v1
dhimmel / weighted-r2.R
Last active Sep 17, 2020
Computing the R-squared of a linear regression model with weighted observations in R
View weighted-r2.R
# Compare four methods for computing the R-squared (R2, coefficient of determination)
# with wieghted observations for a linear regression model in R.
# This work was written by Daniel Himmelstein (@dhimmel) with guidance
# from Alex Pankov (@a-pankov). It is released as CC0 (public domain).
get_r2_cor <- function(y, y_pred, w) {
# Calculate R2 using the correlation coefficient method
xy = cbind(y, y_pred)
return(boot::corr(d=xy, w=w) ^ 2)
dhimmel /
Last active May 4, 2020
Review of the "Rigor and Transparency Index" manuscript (

Daniel Himmelstein's review of preprint v2

Review of version 2 of the following preprint:

Rigor and Transparency Index, a new metric of quality for assessing biological and medical science methods
Joe Menke, Martijn Roelandse, Burak Ozyurt, Maryann Martone, Anita Bandrowski
bioRxiv (2020-01-18)
DOI: 10.1101/2020.01.15.908111

The study introduces an automated method called SciScore to detect whether an article's methods section mentions any of 15 categories, such as a consent statement or an organism. These metrics are combined to create a single score for each article called the "Rigor and Transparency Index". The authors applied the method to the PubMed Central Open Access subset with over 1 million articles to identify trends in the level of details provided by method sections.

dhimmel / cypher-edge-swap.adoc
Last active Dec 28, 2018
Randomized edge swaps in cypher
View cypher-edge-swap.adoc

Degree-Preserving Edge-Swap


We designed a hetnet for drug repurposing that contains 50 thousand nodes (of 10 labels) and 3 million relationships (of 27 types). And we’ve chosen neo4j for handling network storage and interaction.

dhimmel / hetmech-query-node-pair.ipynb
Created Oct 23, 2018
Query relationship between the FTO gene and obesity using hetmech
View hetmech-query-node-pair.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dhimmel / hetionet-v1.0-metaedge-xswap-stats.tsv
Last active Oct 2, 2018
Analytical derivation of the prior XSwap probability of a hetnet edge
View hetionet-v1.0-metaedge-xswap-stats.tsv
metaedge abbreviation n_edges n_connected_source_nodes n_connected_target_nodes n_source_wedges n_target_wedges n_wedges n_valid_xswaps
Anatomy–downregulates–Gene AdG 102240 36 15097 173440264 493897 173934161 5052523519
Anatomy–expresses–Gene AeG 526407 241 18094 2290279787 10749138 2301028925 136250872696
Anatomy–upregulates–Gene AuG 97848 36 15929 149352969 359661 149712630 4637353998
Compound–binds–Gene CbG 11571 1389 1689 104024 476540 580564 66357671
Compound–causes–Side Effect CcSE 138944 1071 5701 16998055 16764774 33762829 9618885267
Compound–downregulates–Gene CdG 21102 734 2880 1683615 291789 1975404 220661247
Compound–palliates–Disease CpD 390 221 50 326 2857 3183 72672
Compound–resembles–Compound CrC 12972 1281 1281 120047 120047 240094 83889812
Compound–treats–Disease CtD 755 387 77 1420 8070 9490 275145
dhimmel / version-gh-pages.ipynb
Last active Feb 16, 2018
Convert Manubot gh-pages to use versioned directories
View version-gh-pages.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dhimmel / bitcoin-random-outcomes.ipynb
Last active Jan 29, 2018
Using Bitcoin to randomly determine a future outcome involving untrusted parties
View bitcoin-random-outcomes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dhimmel /
Last active Jan 4, 2018
Other responses from "What’s the primary reason you use Sci-Hub" survey question in


From In survey, most give thumbs-up to pirated papers by John Travis on 2016-05-06 in Science, question 5 was:

What’s the primary reason you use Sci-Hub or other pirated article repositories?

The possible answers were:

  1. I don’t have any access to the papers — 50.97% 5,046
  2. Convenience--It’s easier to use than the authentication systems provided by the publishers or my libraries — 16.90% 1,673