Skip to content

Instantly share code, notes, and snippets.

View wenliangz's full-sized avatar

Wenliang wenliangz

  • Pfizer Inc.
  • Cambridge, MA
View GitHub Profile
@wenliangz
wenliangz / pubmed.py
Created November 12, 2022 06:07 — forked from mcfrank/pubmed.py
Example of using the Entrez API to get pubmed citations
## this little script shows off the use of the pubmed API through bioconductor
## requires installing Biopython (using pip)
## also requires installing the DTD files for each of the Entrez API calls,
## but the instructions for this are given when you run the script
## useful list of Entrez databases that can be queried through API
# pmc_pubmed PubMed citations for these articles
# pmc_refs_pubmed PubMed article citing PMC article
# pmc_pmc_cites PMC articles that given PMC article cites
# pmc_pmc_citedby PMC article citing given PMC article
@wenliangz
wenliangz / geoParseExample.py
Created November 6, 2019 14:22 — forked from cplaisier/geoParseExample.py
Example of use GEOParse
import GEOparse
import pandas as pd
import matplotlib.pyplot as plt
import numpy
from matplotlib.backends.backend_pdf import PdfPages
#gseNums = ['GSE14860']
#gseNums = ['GSE49278', 'GSE19750', 'GSE10846']
gseNums = ['GSE19417', 'GSE49278', 'GSE19750', 'GSE10846', 'GSE39582', 'GSE35158', 'GSE19422', 'GSE19987', 'GSE32894', 'GSE35158', 'GSE27155', 'GSE33630', 'GSE56303', 'GSE29695', 'GSE10141', 'GSE9843', 'GSE25097', 'GSE32225', 'GSE26566', 'GSE65858', 'GSE39366', 'GSE22138', 'GSE46517', 'GSE71729', 'GSE8607', 'GSE4573', 'GSE29354', 'GSE71118', 'GSE19949', 'GSE15641', 'GSE26253', 'GSE15460', 'GSE21034', 'GSE9891', 'GSE32062', 'GSE72094', 'GSE26939', 'GSE29174', 'GSE31448', 'GSE45725', 'GSE40435', 'GSE14860']
@wenliangz
wenliangz / .block
Created September 19, 2019 17:24 — forked from pbeshai/.block
Lasso with d3 v4 and Canvas
license: mit
height: 500
border: no
@wenliangz
wenliangz / discrete_cmap.py
Created March 22, 2019 19:30 — forked from jakevdp/discrete_cmap.py
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
@wenliangz
wenliangz / arrayToCSV.js
Created February 21, 2019 18:38 — forked from yangshun/arrayToCSV.js
Converts a 2D array into a CSV file
function arrayToCSV (twoDiArray) {
// Modified from: http://stackoverflow.com/questions/17836273/
// export-javascript-data-to-csv-file-without-server-interaction
var csvRows = [];
for (var i = 0; i < twoDiArray.length; ++i) {
for (var j = 0; j < twoDiArray[i].length; ++j) {
twoDiArray[i][j] = '\"' + twoDiArray[i][j] + '\"'; // Handle elements that contain commas
}
csvRows.push(twoDiArray[i].join(','));
}
@wenliangz
wenliangz / postgres-cheatsheet.md
Created October 21, 2018 18:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@wenliangz
wenliangz / createFlowFrame.R
Created December 19, 2017 17:31 — forked from yannabraham/createFlowFrame.R
A quick way to create FCS files from CSV
library(Biobase)
library(flowCore)
library(flowViz)
# simply replace the dummy dta below with your CSV data
dta <- matrix(rnorm(10000),ncol=10)
dimnames(dta)[[2]] <- LETTERS[1:10]
head(dta)
//Very basic conversion for Mindjet Mindmap (PC v14) text outline export to a Markdown file
//This is based on the Ruby gist at: https://gist.github.com/ttscoff/6308043
//Set vars here or supply vars
string inputTextFile = @"C:\mindjet_map.txt";
string outputMdFile = @"C:\mindjet_map.md";
//Read file
string str = System.IO.File.ReadAllText(inputTextFile);
@wenliangz
wenliangz / rosalind_hamm
Created February 15, 2015 23:56
wenliangz
seq=[]
with open('rosalind_hamm.txt') as f:
for each in f:
each=each.strip()
seq.append(each)
seq1=seq[0]
seq2=seq[1]
seq1_dict={}