This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def omim_from_entrez(): | |
| """Return a mapping from NCBI GeneIDs to OMIM IDs. | |
| Returns 17,108 entries from an original 26,371. | |
| Sorted by key. | |
| """ | |
| fp = './app/data/mim2gene.txt' # https://www.omim.org/static/omim/data/mim2gene.txt | |
| df = pd.read_csv(fp, skiprows=4, sep='\t', | |
| usecols=['# MIM Number', 'Entrez Gene ID (NCBI)']) | |
| df.columns = ['omim', 'ncbi'] # rename columns | |
| df = df[np.isfinite(df['ncbi'])] # remove NaN's from ncbi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Using GDAL to open a 4-band image created by Sequoia camera. | |
| from osgeo import gdal # Geospatial Data Abstraction Library | |
| import numpy as np | |
| import sys, os, re | |
| def get_raster_bands(src_grayscale): | |
| """ | |
| Each band is a 2d numpy array of real luminosity values. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias ipy="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| ===================================== | |
| PEP 20 (The Zen of Python) by example | |
| ===================================== | |
| Usage: %prog | |
| :Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| ''' | |
| Stand-alone script to search NYT articles, based on Evan Sherlock's original. Python3 enabled. | |
| >> import nyt_article_search_api as nyt | |
| >> api = nyt.articleAPI() | |
| >> api/search() | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lshw -C memory 2>/dev/null | grep -Po ' +size: \K.*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| du -a /var | sort -n -r | head -n 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(igraph) | |
| library(rgexf) | |
| library(ggplot2) | |
| # ggnet2 is available through the GGally package | |
| # install.packages("GGally") | |
| library(GGally) | |
| # Following libraries will be required - used internally. | |
| lapply(c("sna", "scales","intergraph", "network"),require, character.only=T) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import luigi | |
| class FirstTask(luigi.Task): | |
| # The date when 'whatever' will be run. | |
| upload_date_param = luigi.DateParameter() | |
| def requires(self): | |
| """ | |
| What needs to happen before FirstTask begins? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import luigi | |
| from luigi.mock import MockTarget | |
| class FirstTask(luigi.Task): | |
| def output(self): | |
| return MockTarget("SimpleTask", | |
| mirror_on_stderr=True) | |
| def run(self): | |
| _write = self.output().open('w') |
NewerOlder