Commit 27fa4069 authored by Raphael Müller's avatar Raphael Müller
Browse files

feature correct y position. axis a little bit wider

parent 58b13ab0
......@@ -34,7 +34,7 @@ Vue.component( "axis", {
},
methods: {
genomeToPixel( pos ) {
return (pos-(this.start-this.tickSize))/(this.length) * this.width
return (this.width*(pos-this.start))/(this.length)
}
},
computed:{
......@@ -52,7 +52,7 @@ Vue.component( "axis", {
//return Math.pow( 10, Math.round( Math.log10( this.genomeSectionSize / this.noTicks ) ) ) // axis tick size in log 10 bp
},
noTicks(){
return Math.ceil(this.length/this.tickSize)
return Math.floor(this.length/this.tickSize)+2
},
ticks(){
const firstTickPos = Math.round(this.start/this.tickSize)*this.tickSize//Math.pow( 10, Math.floor( Math.log10( this.start ) ) )
......
......@@ -15,7 +15,7 @@ Vue.component("genome-viewer",{
<!-- -->
<lane v-for="lane in lanes" :key="lane.id" :x="to_w(0)" :y="to_h(lane)" :height="2*one_height" :width="to_w(100)">
</lane>
<feature v-for="(feature, index) in featureData" :key="feature.name" :feature-id="feature.name" :svg-width="(1+index)*20" :svg-height="one_height" :svg-x="genomeToPixel(feature.start)" :svg-y="to_h(lane(feature.strand))+ one_height/2" color="grey" border-color="red" @click="featureClick">
<feature v-for="(feature, index) in featureData" :key="feature.name" :feature-id="feature.name" :svg-width="genomeToPixel(feature.end)-genomeToPixel(feature.start)" :svg-height="one_height" :svg-x="genomeToPixel(feature.start)" :svg-y="to_h(lane(feature.strand))+ one_height/2" color="grey" border-color="red" @click="featureClick">
</feature>
<!-- -->
</svg>
......@@ -51,16 +51,22 @@ Vue.component("genome-viewer",{
starts(){
return this.featureData.map(f => f.start)
},
axisStart(){
genomeStart(){
return Math.min(...this.starts)
},
axisStop(){
genomeStop(){
return Math.max(...this.stops)
},
axisStart(){
return this.genomeStart - this.tickSize
},
axisStop(){
return this.genomeStop + this.tickSize
},
genome_size(){},
length(){
if(this.genomeStats.start < this.genomeStats.end){
return this.axisStop - this.axisStart
return this.genomeStop - this.genomeStart
}else{
// TODO: if genome is circular
}
......@@ -111,7 +117,7 @@ Vue.component("genome-viewer",{
return (this.width*param)/100
},
genomeToPixel(pos){
return (this.width*(pos - (this.axisStart - this.tickSize)))/this.length
return (this.width*(pos - (this.axisStart)))/(this.length+2*this.tickSize)
},
featureClick (featureId) {
console.log(featureId)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment