Skip to content

Instantly share code, notes, and snippets.

<results>
<runner place="123" age="29" gender="F" age_range="20-29" place_by_group="24">
<name>Elizabeth Greer</name>
<city>Lexington KY</city>
<bib>84</bib>
<time>2:42:18</time>
<pace>12:23/M</pace>
</runner>
<runner place="124" age="27" gender="M" age_range="20-29" place_by_group="30">
<name>Bill Greer</name>
<html>
<head>
<title>Flow Visualization - Tapered, Curved</title>
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
svg {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAMAAACKeiw+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////9fb3h/JDwQAAABtJREFUeNpiYMQLGBgZ8IJR6VHpUWnKpAECDACcGgA72QxfPgAAAABJRU5ErkJggg==);
}
svg .circle {
<html>
<head>
<title>Flow Visualization - Straight, Arrows</title>
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
svg {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAMAAACKeiw+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////9fb3h/JDwQAAABtJREFUeNpiYMQLGBgZ8IJR6VHpUWnKpAECDACcGgA72QxfPgAAAABJRU5ErkJggg==);
}
svg .circle {
<?xml version="1.0" encoding="UTF-8"?>
<Pathway xmlns="http://pathvisio.org/GPML/2013a" Name="New Pathway" Version="20130416">
<Graphics BoardWidth="221.9068056407112" BoardHeight="152.0110361741263" />
<DataNode TextLabel="GeneProduct" GraphId="b090f" Type="GeneProduct">
<Graphics CenterX="39.90941140404671" CenterY="46.96030042918464" Width="72.23513182096872" Height="42.19221336603309" ZOrder="32768" FontSize="10" Valign="Middle" />
<Xref Database="" ID="" />
</DataNode>
<InfoBox CenterX="0.0" CenterY="0.0" />
<Biopax />
</Pathway>
from lxml import etree
import StringIO
tree = etree.parse("http://www.wikipathways.org/wpi/webservice/webservice.php/getPathway?pwId=WP1266")
apiResponse = tree.xpath('/ns1:getPathwayResponse/ns1:pathway/ns2:gpml', namespaces={'ns1': 'http://www.wso2.org/php/xsd','ns2': 'http://www.wikipathways.org/webservice'})
pathwayXml = StringIO.StringIO(apiResponse[0].text)
pathwayTree = etree.parse(pathwayXml)
species = pathwayTree.xpath('/foo:Pathway/@Organism', namespaces={'foo': 'http://genmapp.org/GPML/2008a'})
ids = pathwayTree.xpath('/foo:Pathway/foo:DataNode[@Type="Protein" or @Type="GeneProduct"]/foo:Xref/@ID[normalize-space() and not(ancestor::a | ancestor::script | ancestor::style)]', namespaces={'foo': 'http://genmapp.org/GPML/2008a'})
@ariutta
ariutta / LICENSE
Created November 21, 2013 22:10 — forked from shinout/LICENSE
Copyright 2012 Shin Suzuki<shinout310@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ariutta
ariutta / index.html
Last active December 30, 2015 04:29
d3.xml test case
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
@ariutta
ariutta / multiple dates for display
Last active January 2, 2016 11:09
data to work with for multi date picker and viewer. first, a user can select one or multiple dates, with selected dates turning a different color (e.g., blue). later, these dates can be displayed, with availability indicated using background color. so available dates could be shown with one background color (e.g., green) and unavailable dates sh…
[
{
date:"2014-01-30T05:15:00.000Z",
available:true
},
{
date:"2014-01-31T18:30:00.000Z",
available:false
},
{
<svg width="589.4605394605396" height="1403.9516241579338" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<rect fill="none" stroke="#000000" stroke-width="5" x="276.33951" y="574.04834" width="0" height="32" id="svg_2"/>
<path id="svg_8" d="m59.73946,289.24838c0,-10.32419 8.6758,-19 19,-19l195.00001,0c10.32422,0 19,8.67581 19,19l0,113c0,10.32419 -8.67578,19 -19,19l-195.00001,0c-10.3242,0 -19,-8.67581 -19,-19l0,-113z" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#b2b2b2" fill-opacity="0.01" fill="#000000"/>
<rect id="svg_1" stroke="#b2b2b2" fill-opacity="0.01" height="151" width="233" y="NaN" x="NaN" stroke-width="5" fill="#000000"/>
<path id="svg_3" d="m77.23946,293.74838c0,-3.80365 3.19635,-7 7,-7l186.00001,0c3.80365,0 7,3.19635 7,7l0,104c0,3.80365 -3.19635,7 -7,7l-186.00001,0c-3.80365,0 -7,-3.19635 -7,-7l0,-104z" stroke-linecap="null" stroke-linejoin="null" stroke-das
@ariutta
ariutta / pathvisiojs-load-snippet.html
Last active January 2, 2016 23:39
Snippets to include to get pathvisiojs running: https://github.com/wikipathways/pathvisiojs/
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" media="screen">
<link rel="stylesheet" href="http://wikipathways.github.io/pathvisiojs/src/css/pathvisiojs.css" media="screen">
<link rel="stylesheet" href="http://wikipathways.github.io/pathvisiojs/src/css/annotation.css" media="screen">
<link rel="stylesheet" href="http://wikipathways.github.io/pathvisiojs/src/css/pan-zoom.css" media="screen">
<link rel="stylesheet" href="http://wikipathways.github.io/pathvisiojs/src/css/pathway-diagram.css" media="screen">
<script src="http://wikipathways.github.io/pathvisiojs/lib/rgb-color/rgb-color.min.js"></script>
<script src="http://wikipathways.github.io/pathvisiojs/lib/strcase/build/build.js"></script>
<script src="http://wikipathways.github.io/pathvisiojs/lib/async/lib/async.js"></script>
<script src="http://wikipathways.github.io/pathvisiojs/lib/d3/d3.min.js"></script>
<script src="http://wikipathways.github.io/pathvisiojs/lib/jquery/jquery.mi