Skip to content

Instantly share code, notes, and snippets.

@ariutta
ariutta / download_upload.R
Last active April 10, 2019 17:33
Issue with creating/updating network on NDEx
# ndexr relies on httr but doesn't handle importing it
library(httr)
library(ndexr)
NDEX_USER <- Sys.getenv("NDEX_USER")
NDEX_PWD <- Sys.getenv("NDEX_PWD")
NETWORK_ID <- '37800bb2-5bb4-11e9-831d-0660b7976219'
ndexcon <- NA
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<h1>Pretty TSV Viewer</h1>
<br>
<div id="alert-cannot-update-query-param" class="row">
<div class="alert alert-warning" role="alert">
{
"Name": "ACE Inhibitor Pathway",
"Organism": "Homo sapiens",
"License": "CC BY 2.0",
"Comment": [
{
"Source": "WikiPathways-category",
"content": "Physiological Process"
},
{
var parse = require('s-expression');
var showdown = require('showdown');
function zoomOn(nodes) {
console.log('zoomOn');
console.log(`nodes: ${nodes}`);
}
function toggleHighlight(node, color) {
console.log('toggleHighlight');
var parse = require('s-expression');
var showdown = require('showdown');
function zoomOn(nodes) {
console.log('zoomOn');
console.log(`nodes: ${nodes}`);
}
function toggleHighlight(node, color) {
console.log('toggleHighlight');
@ariutta
ariutta / icon-example.gpml.xml
Created March 10, 2016 19:38
Example for including icons in GPML.
<?xml version="1.0" encoding="UTF-8"?>
<Pathway xmlns="http://pathvisio.org/GPML/2013a" Name="Sandbox Pathway" Last-Modified="2/20/2013" Organism="Homo sapiens" License="CC BY 2.0">
<Comment Source="WikiPathways-description">This is just one test pathway with a variety of object types including datanodes which can be connected to database entries (double-click on them when in edit mode). Feel free to edit anything on this page. </Comment>
<Comment Source="BotTest">20160101000001</Comment>
<BiopaxRef>bf7</BiopaxRef>
<Graphics BoardWidth="768.6990077177508" BoardHeight="540.0" />
<Shape GraphId="cd07f">
<Comment>DQo8P3htbCB2ZXJzaW9uPSIxLjAiIGVuY29kaW5nPSJVVEYtOCIgc3RhbmRhbG9uZT0ibm8iPz4NCjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPg0KPHN2Zw0KICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIg0KICAgeG1sbnM6Y2M9Imh0dHA6Ly93ZWIucmVzb3VyY2Uub3JnL2NjLyINCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyINCiAgIHhtbG5zOnN2Zz0iaHR0cDov
var Promise = require('es6-promise').Promise;
var superagent = require('superagent');
var prune = function(res) {
return {
body: res.body,
text: res.text,
headers: res.headers,
statusCode: res.statusCode,
status: res.status,
ok: res.ok,
var input = [1, 1, 1, 2, 2, 2, 3, 3];
var outputExpected = [[1, 1, 1], [2, 2, 2], [3, 3]];
var outputActual = input.reduce(function(acc, currentItem) {
var accLength = acc.length;
var currentGroup = acc[accLength - 1];
var currentGroupLength = currentGroup.length;
if (currentGroupLength > 0) {
var previousItem = currentGroup[currentGroupLength - 1];
if (previousItem === currentItem) {
@ariutta
ariutta / request.md
Last active July 12, 2016 21:09
GraphQL vs. REST vs. TypeScript interfaces

We want to run the equivalent of the following, getting name, age and friends' name(s):

GET https://example.org/users/1

With GraphQL, we can use user.graphql to get the following:

      { 
        id: 'https://example.org/users/1',
var strict = true;
var saxStream = sax.createStream(strict, {xmlns: true, encoding: 'utf8'})
function createSaxStreamEventObservable(eventName) {
return Rx.Observable.fromEventPattern(
function addHandler (h) {
saxStream.on(eventName, h);
},
function delHandler () {}
);