Skip to content

Instantly share code, notes, and snippets.

View bartaelterman's full-sized avatar

Bart Aelterman bartaelterman

View GitHub Profile
@bartaelterman
bartaelterman / download_records_ipython_notebook.ipynb
Last active August 29, 2015 13:57
iPython notebook that demonstrates fetching the number of downloaded records for GBIF datasets
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bartaelterman
bartaelterman / README.md
Last active August 29, 2015 14:00
line-chart-example

Line chart example

This code demonstrates how to create a line chart in d3 and how to let the user navigate it.

Code explanation

1. Draw the line chart

Drawing a basic line chart is explained here. Some adjustments to this example were made:

@bartaelterman
bartaelterman / README.md
Last active August 29, 2015 14:02
Line chart example with sub domains using D3

Domain line chart example

This example explains how to create a line chart that consits of several domains (analogues to the domains defined in cal-heatmap).

For every domain, a separate svg element is added to the DOM. When pressing Previous or Next, new data is fetched and a new svg element with a line chart is created. This new svg element is placed before (in the case of Previous) or after (in the case of Next) the existing domain svgs. Next, all domain svgs are shifted either to the left or to the right, and finally the svg element on the opposide side is removed from the DOM.

The code also contains a nrOfPrefetchedDomains parameter. When set to 1, two additional domains are constructed and placed on either side of the chart area, but they remain invisible (using the class invisible and the display: none attribute in the style sheet). This is useful when you would replace the DataObjStub by something that performs API calls to a backend. By pr

@bartaelterman
bartaelterman / app.js
Created September 17, 2014 07:42
Combining angularjs with d3
angular.module('sphere1', [])
.controller('SphereController', function() {
this.radius;
this.currentCircle = 1;
this.circles = circles;
this.setCurrent = function(val) {
this.currentCircle = val;
console.log(val);
@bartaelterman
bartaelterman / Makefile
Created September 26, 2014 11:52
fetch bacterial RNA-seq data
# Fetch all RNA-Seq datasets from bacteria and flag those from Illumina and a gut species
RNA_Seq_experiments.tsv: find_sra_exps.py update_SRA_run_dates.py query_sra.py test_query_sra.py
python find_sra_exps.py
python update_SRA_run_dates.py RNA_Seq_experiments.tsv RNA_Seq_experiments_date.tsv
mv RNA_Seq_experiments_date.tsv RNA_Seq_experiments.tsv
@bartaelterman
bartaelterman / cocc_taxonomy.json
Last active August 29, 2015 14:14
Bilevel sunburst example
{"name": "Coccinellidae", "children": [{"name": "Adalia", "children": [{"name": "Adalia bipunctata", "size": "3350"}, {"name": "Adalia decempunctata", "size": "1901"}]}, {"name": "Anatis", "children": [{"name": "Anatis ocellata", "size": "482"}]}, {"name": "Anisosticta", "children": [{"name": "Anisosticta novemdecimpunctata", "size": "784"}]}, {"name": "Aphidecta", "children": [{"name": "Aphidecta obliterata", "size": "500"}]}, {"name": "Calvia", "children": [{"name": "Calvia decemguttata", "size": "664"}, {"name": "Calvia quatuordecimguttata", "size": "1069"}]}, {"name": "Chilocorus", "children": [{"name": "Chilocorus bipustulatus", "size": "173"}, {"name": "Chilocorus renipustulatus", "size": "252"}]}, {"name": "Clitostethus", "children": [{"name": "Clitostethus arcuatus", "size": "7"}]}, {"name": "Coccidula", "children": [{"name": "Coccidula rufa", "size": "433"}, {"name": "Coccidula scutellata", "size": "271"}]}, {"name": "Coccinella", "children": [{"name": "Coccinella hieroglyphica", "size": "163"}, {"na
@bartaelterman
bartaelterman / index.html
Created January 31, 2015 15:36
zoomable icicle
<!DOCTYPE html>
<meta charset="utf-8">
<style>
rect {
stroke: #fff;
}
</style>
<body>
library(RAtmosphere)
library(maptools)
library(lubridate)
# The next function comes from the r-bloggers website
# http://www.r-bloggers.com/approximate-sunrise-and-sunset-times/
suncalc.custom <- function(d,Lat=48.1442,Long=-122.7551, earth.radius=6371, dist.sun=149598000){
rad<-function(x)pi*x/180 # convert degrees to radians
epsilon=rad(23.45) # Radians between the xy-plane and the ecliptic plane
@bartaelterman
bartaelterman / sayHi.R
Last active April 5, 2016 10:46
example-R-function
sayHi <- function(name) {
return(paste("Hi", name, sep=" "))
}
@bartaelterman
bartaelterman / viz.ipynb
Created April 15, 2016 14:30
js viz in jupyter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.