Skip to content

Instantly share code, notes, and snippets.

View hpiwowar's full-sized avatar

Heather Piwowar hpiwowar

View GitHub Profile
@hpiwowar
hpiwowar / annotate_bibtex.py
Created June 23, 2011 23:25
For annotating bibtex files using article info from customized spreadsheets
#!/usr/bin/env python
# Initially written by Heather Piwowar, June 2011
# Public domain: have at it!
# For annotating bibtex files, pulling in article info from customized spreadsheets
import csv
import re
import codecs
from pybtex.database.input import bibtex as bibtex_in
from pybtex.database.output import bibtex as bibtex_out
@hpiwowar
hpiwowar / wos_txt_to_bibtex.py
Created June 23, 2011 23:24
For converting ISI Web of Science tab-delimited exports into bibtex format
#!/usr/bin/env python
# Initially written by Heather Piwowar, June 2011
# Public domain: have at it!
# For converting ISI Web of Science tab-delimited exports into bibtex format
import csv
import glob
import random
from collections import defaultdict
import codecs
@hpiwowar
hpiwowar / ASIST2011_stats.R
Created May 30, 2011 15:15
Stats for the analysis and graphics in Piwowar ASIS&T 2011 submission "Finding the hold-outs"
### Heather Piwowar
### MIT open license.
### blog post about interm results:
library(rms)
# if true, draw figures on screen instead of in a file
SCREEN=TRUE
# set to ".eps" or ".png"
@hpiwowar
hpiwowar / plot.summary.formula.response.CIs.R
Created May 30, 2011 15:10
Plots Hmisc summary formula responses with confidence intervals
### Heather Piwowar
# Modifications to add confidence intervals added by Heather Piwowar
# Based on dotchart2{Hmisc}
dotchart2.CIs =
function (data, labels, groups = NULL, gdata = NA, horizontal = TRUE,
pch = 16, xlab = "", ylab = "", auxdata, auxgdata = NULL,
auxtitle, lty = if (.R.) 1 else 2, lines = TRUE, dotsize = 0.8,
cex = par("cex"), cex.labels = cex, cex.group.labels = cex.labels *
1.25, sort. = TRUE, add = FALSE, dotfont = par("font"),
dotchart2.CIs =
function (data, labels, groups = NULL, gdata = NA, horizontal = TRUE,
pch = 16, xlab = "", ylab = "", auxdata, auxgdata = NULL,
auxtitle, lty = if (.R.) 1 else 2, lines = TRUE, dotsize = 0.8,
cex = par("cex"), cex.labels = cex, cex.group.labels = cex.labels *
1.25, sort. = TRUE, add = FALSE, dotfont = par("font"),
groupfont = 2, reset.par = add, xaxis = TRUE, width.factor = 1.1,
lcolor = if (.R.) "gray" else par("col"), ...)
{
if (.R. && !add) {
library(Hmisc)
journdat = read.csv("~/Downloads/JournalData.csv", as.is=TRUE, na.strings="N/A")
journdat$is.Environmental.Sciences = 0
journdat$is.Environmental.Sciences[grep("*Environmental Sciences*", journdat$ISI.Category)] = 1
summary(Policy.request...require.code ~ Impact.Factor + Policy.has.instructions.for.how.to.cite.data. + Subscription.Model + is.Environmental.Sciences, journdat)
response = summary(Policy.request...require.code ~ Impact.Factor + Policy.has.instructions.for.how.to.cite.data. + Subscription.Model + is.Environmental.Sciences, journdat)
import os
import time
import re
import nose
from nose.tools import assert_equals
from collections import defaultdict
import EUtils
from EUtils import HistoryClient, ThinClient
import dataset
import datasources
humans[mesh] AND "magnetic resonance imaging"[mesh]
NOT "magnetic resonance imaging/ethics"[mesh]
AND "mental disorders"[mesh]
AND (fmri[Title/Abstract] OR "Functional MRI"[Title/Abstract]
OR "Functional magnetic resonance imaging"[Title/Abstract]
OR "Functional MR Imaging"[Title/Abstract])
AND Journal Article[ptyp] AND English[lang]
NOT (Editorial[ptyp] OR Letter[ptyp] OR Meta-Analysis[ptyp]
OR Practice Guideline[ptyp] OR Review[ptyp] OR Case Reports[ptyp]
OR Comment[ptyp] OR Corrected and Republished Article[ptyp])
humans[mesh] AND "magnetic resonance imaging"[mesh]
NOT "magnetic resonance imaging/ethics"[mesh]
NOT "mental disorders"[mesh]
AND (fmri[Title/Abstract] OR "Functional MRI"[Title/Abstract]
OR "Functional magnetic resonance imaging"[Title/Abstract]
OR "Functional MR Imaging"[Title/Abstract])
AND Journal Article[ptyp] AND English[lang]
NOT (Editorial[ptyp] OR Letter[ptyp] OR Meta-Analysis[ptyp]
OR Practice Guideline[ptyp] OR Review[ptyp] OR Case Reports[ptyp]
OR Comment[ptyp] OR Corrected and Republished Article[ptyp])
import nose
from nose.tools import assert_equals
from tests import slow, online, notimplemented, acceptance
import urllib2
import random
import datasources
from datasources import pubmed
from datasources import urlopener