Skip to content

Instantly share code, notes, and snippets.

View agrueneberg's full-sized avatar

Alexander Grueneberg agrueneberg

View GitHub Profile
@agrueneberg
agrueneberg / query.sparql
Last active October 8, 2015 17:08
Federating Patient Data From RPPA Data
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX tcga:<http://purl.org/tcga/core#>
PREFIX tcgameta:<http://purl.org/tcga/metadata#>
PREFIX tcgaclin:<http://purl.org/tcga/clin#>
PREFIX tcgaclinProp:<http://purl.org/tcga/clin#property/>
SELECT ?patientId ?tumorTissueSite ?ageAtInitialDiagnosis ?gender ?race ?vitalStatus
WHERE {
SERVICE <http://agalpha.mathbiol.org:10035/repositories/tcga> {
?file tcga:platform ?platform .
?platform rdfs:label "mda_rppa_core" .
@agrueneberg
agrueneberg / gist:3842413
Created October 5, 2012 21:07
UUIDs to Patient Barcodes
library(RCurl)
library(rjson)
# Read sample UUIDs.
uuids <- read.csv(file="~/uuids.csv")
# Convert to character vector.
uuids <- as.vector(t(uuids))
# Query TCGA's UUID to barcode Web Service.
@agrueneberg
agrueneberg / TCGA.R
Created October 25, 2012 17:44
TCGA Toolbox for R
library(RCurl)
library(rjson)
TCGA.get <- function (uri) {
getURI(uri)
}
TCGA.find <- function (query) {
uri <- paste("http://agalpha.mathbiol.org/repositories/tcga?infer=true&query=", URLencode(query, reserved=TRUE), sep="")
response <- fromJSON(getURI(uri, httpheader=c("Accept: application/sparql-results+json")))
@agrueneberg
agrueneberg / gist:4157870
Created November 27, 2012 23:12
@ControllerAdvice in Spring MVC 3.2

Spring MVC 3.2 introduces the @ControllerAdvice component annotation that allows you define single @ExceptionHandler methods for all your controllers.

If you find yourself that the exception handlers are not working the way they are supposed to and you happen to have a clearly separated root and web scope, make sure that that you are including the @ControllerAdvice component in the web scope rather than the root scope, i.e. include org.springframework.web.bind.annotation.ControllerAdvice in context:component-scan:

<context:component-scan base-package="[path]" use-default-filters="false">
  <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation" />
  <context:include-filter expression="org.springframework.web.bind.annotation.ControllerAdvice" type="annotation" />
@agrueneberg
agrueneberg / webfinger.nginx
Last active April 30, 2023 22:00
A simple WebFinger resource for nginx (compatible with draft-ietf-appsawg-webfinger-14.txt).
location ~ /.well-known/webfinger {
add_header 'Access-Control-Allow-Origin' '*';
if ($arg_resource = "") {
return 400;
}
try_files /profiles/$arg_resource.json =404;
}
@agrueneberg
agrueneberg / client.html
Last active March 19, 2023 06:48
HMAC-SHA256 example for verifying both the data integrity and the authentication of a request in Node.js and web browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HMAC-SHA256 Example</title>
</head>
<body>
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script>
<script>
var sharedSecret, query, signature, hmac, xhr;
@agrueneberg
agrueneberg / tcga-file-search.postman_collection
Last active August 29, 2015 14:03
TCGA File Search API - Query Collection for Postman
{
"id": "4f972238-9569-c553-f31b-d13f05a7af9f",
"name": "TCGA File Search API",
"description": "See https://tcga-data.nci.nih.gov/ccg-data-web/search.jsp?projectId=1",
"order": [
"16f2ef6f-8874-22b6-c702-ff6fc98b31e3",
"a3821414-552b-37e4-8123-b2d8cfd92216",
"1965c0e3-1217-717f-3f2a-b48f24cb7043",
"805128a2-7729-90dd-4ff6-ae9af4a5a633",
"9710c160-0f7e-06a9-695b-2a5601f60404",
@agrueneberg
agrueneberg / ufw-syncthing
Created January 4, 2015 20:06
ufw app profile for syncthing (to put into /etc/ufw/applications.d/)
[Syncthing]
title=Syncthing
description=Open Source Continuous File Synchronization
ports=22000/tcp|21025/udp

How to match RPPA samples to their patients in The Cancer Genome Atlas (TCGA)

When I wrote the TCGA Toolbox and the TCGA.rppa module, one of biggest problems was to match samples and patients.

Both sample and patient files can be accessed through the Open Access HTTP Directory. For glioblastoma multiforme (gbm), the samples can be found in the gbm/cgcc/mdanderson.org/mda_rppa_core/protein_exp/mdanderson.org_GBM.MDA_RPPA_Core.Level_3.1.0.0/ directory, and the patients can be found [in the nationwidechildrens.org_clinical_patient_gbm.txt file in

@agrueneberg
agrueneberg / parallel.R
Created September 10, 2015 15:20
Parallel Computing in R
library(parallel)
library(BGLR)
library(microbenchmark)
data(mice)
X <- mice.X
y <- mice.pheno$Obesity.BMI
GWAS <- function (i) {
summary(lm(y ~ X[, i]))$coef[2, ]