Skip to content

Instantly share code, notes, and snippets.

Avatar

Luca Pandini lpand

  • Milan – Italy
View GitHub Profile
@lpand
lpand / graph_config_test.js
Created Sep 28, 2013
graph configuration
View graph_config_test.js
var nodes = [
{ name: 0, value: 0 },
{ name: 1, value: 1 },
{ name: 2, value: 2 },
{ name: 3, value: 3 }
]
var edges = [
{ source: nodes[0], target: nodes[1] },
@lpand
lpand / force_layout_tick.js
Last active Dec 24, 2015
Keeps the bubbles inside the force bounds and draws text if so configured
View force_layout_tick.js
config.force.tick = function() {
graphChart.links.attr({
x1: function(d) { return d.source.x },
y1: function(d) { return d.source.y },
x2: function(d) { return d.target.x },
y2: function(d) { return d.target.y } })
graphChart.bubbles
.selectAll('circle')
.attr({
@lpand
lpand / martexplorer.js
Created Sep 30, 2013
This is the martexplorer main.js hardcoded!
View martexplorer.js
(function($) {
/*
* Author: jhsu
*
* This file + required modules contains all the JavaScript to run MartExplorer.
*
* The workflow starts from the biomart.martexplorer.init function, and ends with _stepCallback function.
*
* The _stepCallback function has an array (bound by closure) that maps to each of the four steps.
View resizer.js
function resizeHandler () {
if (this._svg && !this._svg.empty()) {
this._svg.attr({
width: $(window).width()
height: $(window).height()
})
}
}
function resize (listener, interval) {
View biomart-notes.md

Weighted Network

We're going to gather gene pairs from single query results searching for genes sharing the same annotation term.

G1 A1

G2 A1 -> G1 G2 A1

G2 A3

View eight-queens-puzzle.md

image

Exercise 2

Implement a recursive procedure (function/class, you choose) that answers to the eight-queens puzzle problem.

The eight-queens puzzle asks how to place eight queens on a chessboard so that no queen is in check from any other (i.e., no two queens are in the same row, column, or diagonal).

Spoiler: one possible solution

One possible solution is shown in figure 2.8. One way to solve the puzzle is to work across the board, placing a queen in each column. Once we have placed k - 1 queens, we must place the kth queen in a position where it does not check any of the queens already on the board. We can formulate this approach recursively: Assume that we have already generated the sequence of all possible ways to place k - 1 queens in the first k - 1 columns of the board. For each of these ways, generate an extended set of positions by placing a queen in each row of the kth column. Now filter these, keeping only th

@lpand
lpand / enrichment_data.json
Last active Aug 29, 2015
Enrichment front-end app data format
View enrichment_data.json
{
"Gene Ontology (GO)": {
"header": {
"type": "annotation",
"columns": ["id", "status", "..."],
"display_names": ["name", "status", "..."]
},
"nodes": [
{ "id": "", "status": "", "start": "", "type": "term" },
{ "id": "", "foo": "", "bar": "", "type": "gene" },
View angular-results-service-promise.js
"use strict";
angular.module("martVisualEnrichment.services", [])
.factory("results",
["$document", "$q", "enrichmentResultsId",
function resultsFactory ($doc, $q, containerId) {
// I'm using a promise such that if we get data with ajax the API won't
// change.
var deffed = $q.defer(),
View angular-pills.js
;(function (angular) {
"use strict";
var app = angular.module("martVisualEnrichment.directives");
/**
*
* This implementation is highly inspired by https://github.com/angular-ui/bootstrap/blob/master/src/tabs/tabs.js
*
You can’t perform that action at this time.