Skip to content

Instantly share code, notes, and snippets.

View Gibbsdavidl's full-sized avatar
🐢

David L Gibbs Gibbsdavidl

🐢
View GitHub Profile
@Gibbsdavidl
Gibbsdavidl / isb-cgc-query_of_the_month-november-2018.ipynb
Last active December 6, 2018 00:05
ISB-CGC-Query_of_the_Month-November-2018.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Gibbsdavidl
Gibbsdavidl / launch_jupyter_interface.sh
Created October 23, 2018 17:48
Launch Jupyter Interface fix
#!/bin/bash
# Made a tiny change to allow me to run it on Mac OS 10.11.6 #
# This script sets SSH tunnel and opens Chrome Browser with SOCKS proxy
# configured for direct access to the Jupyter cluster.
set -euo pipefail
DIR="${BASH_SOURCE%/*}"
@Gibbsdavidl
Gibbsdavidl / gist:5580a4cb7834e2658613bb7bec07ae49
Created February 27, 2018 02:06
BigQuery to perform Spearman's correlation over all pairs of genes given Reactome pathway definitions.
WITH
--
--
--
geneList AS (
SELECT
a.entrez AS Entrez,
Symbol AS HGNC_gene_symbol
FROM
`isb-cgc.QotM.Reactome_a1` a
@Gibbsdavidl
Gibbsdavidl / sift.cpp
Created October 2, 2017 17:45 — forked from lxc-xx/sift.cpp
OpenCV's SIFT implementation
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
@Gibbsdavidl
Gibbsdavidl / gist:8a20097aaf8bece8fc586310795b54da
Last active September 26, 2017 17:49
ANOVA comparing expression values between samples with and without a SNP.
# This shows the contents of my global.R file, that contains the BigQuery SQL, googleAuthR code, and plots.
# global.R
#http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_(ggplot2)/
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
library(grid)
# Make a list from the ... arguments and plotlist
@Gibbsdavidl
Gibbsdavidl / gist:72941f4f58c740d603c266f04939dadd
Created May 23, 2017 23:23
BigQuery_Linear_Regression_Library.sql
CREATE TEMP FUNCTION
bq_linear(x ARRAY<FLOAT64>, y ARRAY<FLOAT64>)
RETURNS FLOAT64
LANGUAGE js AS """
// http://tom-alexander.github.io/regression-js/
var data = [];
// Our data list is list of lists. The small list being each (x,y) point
for (var i = 0; i < x.length; i++) {
data.push([x[i],y[i]])
SELECT
project_short_name,
STDDEV_SAMP( protein_expression ) / AVG( protein_expression ) AS CoV
FROM
[isb-cgc:TCGA_hg19_data_v0.Protein_Expression]
group by
project_short_name
order by
CoV DESC
WITH
mutatedSamples AS (
SELECT
project_short_name,
sample_barcode_tumor
FROM
`isb-cgc.TCGA_hg19_data_v0.Somatic_Mutation_MC3`
WHERE
Hugo_Symbol = 'EGFR'
AND Variant_Type = 'SNP'
WITH
--
-- we start by translating the correlations that we got to ranks,
-- based on sorting the genes on corrByGene "DESC"
-- this will result in the highest positive correlation getting
-- rank #1, etc
-- we also lightly filter the genes by excluding any with near-zero
-- or negative correlation coefficients, and the result is a list
-- of approx 9000 genes with symbol, correlation, and rank
geneScoresT AS (