Skip to content

Commit

Permalink
Merge pull request #22 from nicgirault/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
nicgirault authored Mar 8, 2017
2 parents 047a71c + 64413c7 commit fa61880
Show file tree
Hide file tree
Showing 233 changed files with 111,506 additions and 17,412 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "google",
"parser": "babel-eslint",
"rules": {
}
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Collision between ids
Rules => faire des callbacks à la place
6 changes: 1 addition & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "circosjs",
"description": "d3js library to draw circular graphs",
"main": "dist/circosJS.js",
"main": "dist/circos.min.js",
"license": "GPL-2.0",
"ignore": [
"demo"
Expand Down Expand Up @@ -34,11 +34,7 @@
"url": "git://nicgirault/circosJS.git"
},
"dependencies": {
"d3": "~3.5.2",
"colorBrewer": "https://raw.githubusercontent.com/d3/d3/bower-metadata/lib/colorbrewer/colorbrewer.css",
"d3-tip": "~0.6.8"
},
"resolutions": {
"d3": "~3.5.2"
}
}
16 changes: 16 additions & 0 deletions demo/chords/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang='en'>

<head>
<title>circosJS</title>
<meta charset='utf-8'></meta>
<script src='../../dist/circos.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3-queue/3.0.3/d3-queue.js'></script>
</head>

<body>
<div id='chart'></div>
<script src='./index.js'></script>
</body>
</html>
93 changes: 93 additions & 0 deletions demo/chords/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
var gieStainColor = {
gpos100: 'rgb(0,0,0)',
gpos: 'rgb(0,0,0)',
gpos75: 'rgb(130,130,130)',
gpos66: 'rgb(160,160,160)',
gpos50: 'rgb(200,200,200)',
gpos33: 'rgb(210,210,210)',
gpos25: 'rgb(200,200,200)',
gvar: 'rgb(220,220,220)',
gneg: 'rgb(255,255,255)',
acen: 'rgb(217,47,39)',
stalk: 'rgb(100,127,164)',
select: 'rgb(135,177,255)',
};

var drawCircos = function(error, GRCh37, cytobands, data) {
var circos = new Circos({
container: '#chart',
width: 1000,
height: 1050,
});

cytobands = cytobands.map(function(d) {
return {
block_id: d.chrom,
start: parseInt(d.chromStart),
end: parseInt(d.chromEnd),
gieStain: d.gieStain,
name: d.name,
};
});

data = data.map(function(d) {
return {
source: {
id: d.source_id,
start: parseInt(d.source_breakpoint) - 2000000,
end: parseInt(d.source_breakpoint) + 2000000,
},
target: {
id: d.target_id,
start: parseInt(d.target_breakpoint) - 2000000,
end: parseInt(d.target_breakpoint) + 2000000,
},
};
});

circos
.layout(
GRCh37,
{
innerRadius: 400,
outerRadius: 440,
labels: {
radialOffset: 70,
},
ticks: {
display: true,
labelDenominator: 1000000,
},
}
)
.highlight('cytobands', cytobands, {
innerRadius: 400,
outerRadius: 440,
opacity: 0.3,
color: function(d) {
return gieStainColor[d.gieStain];
},
tooltipContent: function(d) {
return d.name;
},
})
.chords(
'l1',
data,
{
logScale: false,
opacity: 0.7,
color: '#ff5722',
tooltipContent: function(d) {
return d.source.id + ' ➤ ' + d.target.id + ': ' + d.value;
},
}
)
.render();
};

d3.queue()
.defer(d3.json, '../data/GRCh37.json')
.defer(d3.csv, '../data/cytobands.csv')
.defer(d3.csv, '../data/fusion-genes.csv')
.await(drawCircos);
26 changes: 26 additions & 0 deletions demo/data/GRCh37.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{"id":"chr1","label":"chr1","color":"#996600","len":249250621},
{"id":"chr2","label":"chr2","color":"#666600","len":243199373},
{"id":"chr3","label":"chr3","color":"#99991E","len":198022430},
{"id":"chr4","label":"chr4","color":"#CC0000","len":191154276},
{"id":"chr5","label":"chr5","color":"#FF0000","len":180915260},
{"id":"chr6","label":"chr6","color":"#FF00CC","len":171115067},
{"id":"chr7","label":"chr7","color":"#FFCCCC","len":159138663},
{"id":"chr8","label":"chr8","color":"#FF9900","len":146364022},
{"id":"chr9","label":"chr9","color":"#FFCC00","len":141213431},
{"id":"chr10","label":"chr10","color":"#FFFF00","len":135534747},
{"id":"chr11","label":"chr11","color":"#CCFF00","len":135006516},
{"id":"chr12","label":"chr12","color":"#00FF00","len":133851895},
{"id":"chr13","label":"chr13","color":"#358000","len":115169878},
{"id":"chr14","label":"chr14","color":"#0000CC","len":107349540},
{"id":"chr15","label":"chr5","color":"#6699FF","len":102531392},
{"id":"chr16","label":"chr16","color":"#99CCFF","len":90354753},
{"id":"chr17","label":"chr17","color":"#00FFFF","len":81195210},
{"id":"chr18","label":"chr18","color":"#CCFFFF","len":78077248},
{"id":"chr19","label":"chr19","color":"#9900CC","len":59128983},
{"id":"chr20","label":"chr20","color":"#CC33FF","len":63025520},
{"id":"chr21","label":"chr21","color":"#CC99FF","len":48129895},
{"id":"chr22","label":"chr22","color":"#666666","len":51304566},
{"id":"chrX","label":"chrX","color":"#999999","len":155270560},
{"id":"chrY","label":"chrY","color":"#CCCCCC","len":59373566}
]
Loading

0 comments on commit fa61880

Please sign in to comment.