我有以下chords.js
文件
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, data) {
var width = document.getElementsByClassName('mdl-card__supporting-text')[0].offsetWidth
var circos = new Circos({
container: '#chordsChart',
width: width,
height: width
})
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: width/2 - 80,
outerRadius: width/2 - 40,
labels: {
radialOffset: 70
},
ticks: {
display: true,
labelDenominator: 1000000
},
events: {
'click.demo': function (d, i, nodes, event) {
console.log('clicked on layout block', d, event)
}
}
}
)
.highlight('cytobands', cytobands, {
innerRadius: width/2 - 80,
outerRadius: width/2 - 40,
opacity: 0.3,
color: function (d) {
return gieStainColor[d.gieStain]
},
tooltipContent: function (d) {
return d.name
}
})
.chords(
'l1',
data,
{
radius: function (d) {
if (d.source.id === 'chr1') {
return 0.5
} else {
return null
}
},
logScale: false,
opacity: 0.7,
color: '#ff5722',
tooltipContent: function (d) {
return '<h3>' + d.source.id + ' ➤ ' + d.target.id + ': ' + d.value + '</h3><i>(CTRL+C to copy to clipboard)</i>'
},
events: {
'mouseover.demo': function (d, i, nodes, event) {
console.log(d, i, nodes, event.pageX)
}
}
}
)
.render()
}
d3.queue()
.defer(d3.json, './data/circle.json')
.defer(d3.csv, './data/data.json')
.await(drawCircos)
我index.html
的是:
<html lang="en">
<head>
<title>Circos</title>
<script src="https://cdn.rawgit.com/nicgirault/circosJS/master/dist/circosJS.js" type="text/javascript"></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>
<script src='./chords.js'></script>
</body>
</html>
我只有一个空页面:
$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [29/Oct/2017 22:50:44] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2017 22:50:50] "GET /chords.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2017 22:50:50] "GET /data/circle.json HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2017 22:50:54] code 404, message File not found
127.0.0.1 - - [29/Oct/2017 22:50:54] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [29/Oct/2017 22:50:54] "GET /data/data.json HTTP/1.1" 200 -
我错过了什么?
先感谢您