Skip to content

Instantly share code, notes, and snippets.

View ryananeff's full-sized avatar
👨‍⚕️
PGY-1

Ryan Neff ryananeff

👨‍⚕️
PGY-1
View GitHub Profile
// ==UserScript==
// @name Ryan's BIDMC OMR fix
// @namespace http://tampermonkey.net/
// @version 0.1
// @description CSS changes to make the page look nicer, add functionality
// @author Ryan Neff, MS4. raneff@gmail.com
// @match https://holmes.caregroup.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=caregroup.org
// @grant MIT license
// ==/UserScript==
@ryananeff
ryananeff / scraper.py
Created November 19, 2021 02:40
Scrape networks from NDEx
import pandas
import requests, json
req = input("Please enter a URL:")
network_obj = json.loads(requests.get(req).text)
node_names = {i["@id"]:i["n"] for i in network_obj[3]["nodes"]}
edges = network_obj[4]["edges"]
edgeattr = network_obj[7]["edgeAttributes"]
citations = {i["po"]:i["v"] for i in edgeattr if i["n"] == "citation"}
directed = {i["po"]:i["v"] for i in edgeattr if i["n"] == "directed"}
@ryananeff
ryananeff / recursiveUploadToSynapse.py
Last active June 9, 2021 16:17
[Python] Recursively upload a directory and subdirectories to Synapse using Synapse Python API
#!pip install synapseclient
import synapseclient, os
from synapseclient import Project, Folder, File, Link
syn = synapseclient.Synapse()
def upload_files_create_folders(path=".",parent_id=""):
""" upload_files_create_folders(path=".",parent_id="")
Recursively uploads all files and folders to a Synapse Project or folder.
@ryananeff
ryananeff / qvalue_python3.py
Last active November 16, 2024 06:33
q-value estimate for Python 3
## from: https://github.com/nfusi/qvalue
## edited to work in Python 3 by Ryan Neff, 4/19/18
import scipy as sp
import numpy as np
from scipy import interpolate
def qvalue_estimate(pv, m=None, verbose=False, lowmem=False, pi0=None):
"""
Estimates q-values from p-values
@ryananeff
ryananeff / acat.py
Last active February 14, 2025 14:27
[Python] ACAT test for combining p-values under the Cauchy distribution, inspired by ACAT R package (yaowuliu/ACAT)
import numpy as np
import scipy as sp
def acat_test(pvalues,weights=None):
'''acat_test()
Aggregated Cauchy Assocaition Test
A p-value combination method using the Cauchy distribution.
Inspired by: https://github.com/yaowuliu/ACAT/blob/master/R/ACAT.R
@ryananeff
ryananeff / heatmap_circles.py
Last active September 17, 2024 00:09
[Python] Clustermap with circles representing each element instead of squares for the heatmap
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.collections import PatchCollection
#### heatmap_circle()
##
## Creates a heatmap of values, with size of the circle at a given (row,col) as a second dimension
## uses seaborn's clustermap to provide biclustering
@ryananeff
ryananeff / convert_image_in_ppt.sh
Last active June 27, 2020 18:16
[MacOS] Reduce the size of PowerPoint (*.pptx) files by converting internal images from TIFF to PNG, saving 30x in file size
#!/bin/bash
input_file=$1;
if unzip -l "${input_file}" | grep ".tiff"
then
echo "tiffs found, converting..."
unzip -q "${input_file}" -d test
for i in test/ppt/media/*.tiff; do sips -s format png "${i}" --out "${i%tiff}png"; rm $i; done
for i in test/ppt/slides/_rels/*.rels; do echo $i; sed -i -e 's/.tiff/.png/g' $i; done
@ryananeff
ryananeff / adjust_text_polar.ipynb
Last active February 28, 2020 16:33
[Python] Demonstration of labeling issues using the default branch of the adjustText package.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.