Skip to content

Instantly share code, notes, and snippets.

import argparse
import synapseclient, synapseutils
import pandas as pd
from multiprocessing.dummy import Pool
from synapseclient import File, Schema
from synapseclient.utils import humanizeBytes
from synapseutils.monitor import with_progress_bar
syn=synapseclient.Synapse()
syn.login()
@kdaily
kdaily / refresh_nda_token.sh
Created March 14, 2018 16:08 — forked from obenshaindw/refresh_nda_token.sh
Bash function to update AWS FederationToken provided by NIMH Data Archive
#!/bin/bash
## NDA AWS Token Generator
## Author: NIMH Data Archives
## http://ndar.nih.gov
## License: MIT
## https://opensource.org/licenses/MIT
##############################################################################
#
# Script to retrieve generated AWS Tokens from NIMHDA
@kdaily
kdaily / brown_bear.R
Created December 12, 2016 19:24 — forked from jimhester/brown_bear.R
brown bear brown bear
x <- c("Brown bear", "Red bird", "Yellow duck", "Blue horse", "Green frog", "Purple Cat", "Goldfish", "Teacher")
txt <- capture.output(cat(
sprintf("%s, %s, what do you see?\n I see a %s looking at me.\n", head(x, -1), head(x, -1), tail(x, -1)),
sprintf("Teacher, Teacher what do you see\n I see Children looking at me.\nChildren Children what do you see?\n We see a %s and a Teacher looking at us, that's what we see.",
paste0(collapse = ", ", head(x, -1))), sep = ""))
txt
#> Brown bear, Brown bear, what do you see?
#> I see a Red bird looking at me.
#> Red bird, Red bird, what do you see?
#> I see a Yellow duck looking at me.

##Load graph into memory g = new TinkerGraph() g.loadGraphSON('/Users/lom/Downloads/graph.json')

##Find all activities g.V('concreteType', 'activity').name nActivities = g.V('concreteType', 'activity').count()

@kdaily
kdaily / copyWikis.R
Last active December 17, 2015 19:15 — forked from brucehoff/copyWikis.R
#####
## FUNCTION FOR COPYING ALL SYNAPSE WIKI CONTENT (AND SUBPAGES) FROM ONE OWNER RESOURCE TO ANOTHER
## AUTHOR: BRIAN M. BOT
#####
## ARGUMENTS:
## oldOwnerId - the Synapse ID of the resource (e.g. Project) to copy the wiki content from
## newOwnerId - the Synapse ID of the resource (e.g. Project) to copy the wiki content to
#####
## VALUE:
## Silently returns the Wiki headers from the new owner
@kdaily
kdaily / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# Note: using the devel versions of both packages!
library(DESeq) # version 1.9.11
library(edgeR) # version 2.99.8
library(VennDiagram)
# Read in data ------------------------------------------------------------
## Use pasilla data
datafile = system.file( "extdata/pasilla_gene_counts.tsv", package="pasilla" )
datafile
#####
## AUTHOR: BRIAN M. BOT
## ORGANIZATION: SAGE BIONETWORKS
##
## ALLOW USERS TO LEVERAGE KNITR WHEN CONSTRUCTING SYNAPSE WIKI CONTENT
#####
## PARAMETERS:
## file: path to a local .Rmd file which to knit
## owner: a Synapse object which will own the resulting WikiPage (usually a Project, Folder, or File)
## parentWikiId (optional): if the resulting WikiPage is to be a subpage of another WikiPage, this is the id for the parent WikiPage (NOTE: owner is still required)
dual_dendogram_tile_plot <- function(data.matrix, main="Title"){
#Dual dendrogram ############
x <- data.matrix
dd.col <- as.dendrogram(hclust(method="ward",dist(x)))
col.ord <- order.dendrogram(dd.col)
dd.row <- as.dendrogram(hclust(method="ward",dist(t(x))))
row.ord <- order.dendrogram(dd.row)
library("igraph")
library("plyr")
library("HiveR")
library("RColorBrewer")
library("grDevices")
############################################################################################
rm(list = ls())
dataSet <- read.table("http://www.vesnam.com/Rblog/wp-content/uploads/2013/07/lesmis.txt",