Skip to content

Commit

Permalink
#78 WIP: show user correct coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
josiahseaman committed Feb 4, 2019
1 parent b183324 commit fca1918
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
16 changes: 9 additions & 7 deletions DDV/Display_Utils.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@
"collapsed": true
},
"outputs": [],
"source": []
"source": [
""
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -512,7 +514,7 @@
" if score < 7000:\n",
" print(offset, score/len(human_sample))\n",
" scores.append(score/len(human_sample))\n",
"Pic(scores, width=len(scores), height=20)\n"
"Pic(scores, width=len(scores), height=20)"
]
},
{
Expand Down Expand Up @@ -690,7 +692,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
Expand Down Expand Up @@ -765,7 +767,7 @@
"4c67f75fbb934cca90210ad5e385736d": {
"views": [
{
"cell_index": 12
"cell_index": 12.0
}
]
},
Expand Down Expand Up @@ -799,7 +801,7 @@
"6e9bd00ff5d64c62afe3b00f5687ee70": {
"views": [
{
"cell_index": 6
"cell_index": 6.0
}
]
},
Expand Down Expand Up @@ -917,7 +919,7 @@
"d1fc09278f8148b9bbe6e508141868cb": {
"views": [
{
"cell_index": 14
"cell_index": 14.0
}
]
},
Expand Down Expand Up @@ -960,4 +962,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
5 changes: 2 additions & 3 deletions DDV/MultipleAlignmentLayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@ def calc_all_padding(self):
#First contig of each MSA has a 10px tall title
contig.title_padding = 0 if i != 0 else widest_sequence * self.title_height_px
contig.tail_padding = 0
contig.nuc_title_start = seq_start
contig.nuc_seq_start = seq_start + title_length
contig.nuc_seq_start = 0
#at the moment these values are the same but they have different meanings
total_progress += length + contig.title_padding # pointer in image
seq_start += title_length + length # pointer in text
seq_start += length # pointer in text
return total_progress


Expand Down
10 changes: 4 additions & 6 deletions DDV/TileLayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@ def calc_all_padding(self):
contig.reset_padding = reset
contig.title_padding = title
contig.tail_padding = tail
contig.nuc_title_start = seq_start
contig.nuc_seq_start = seq_start + title_length
contig.nuc_seq_start = 0

total_progress += reset + title + tail + length # pointer in image
seq_start += title_length + length # pointer in text
seq_start += length # pointer in text
return total_progress # + reset + title + tail + length


Expand Down Expand Up @@ -548,7 +547,7 @@ def contig_struct(self):
{"name": contig.name.replace("'", ""), "xy_seq_start": xy_seq_start, "xy_seq_end": xy_seq_end,
"title_padding": contig.title_padding, "tail_padding": contig.tail_padding,
"xy_title_start": xy_seq_start - contig.title_padding,
"nuc_title_start": contig.nuc_title_start, "nuc_seq_start": contig.nuc_seq_start,
"nuc_seq_start": contig.nuc_seq_start,
"fake_start": fake_start})
xy_seq_start += len(contig.seq) + contig.tail_padding
return json
Expand Down Expand Up @@ -617,11 +616,10 @@ def dice_self_contigs(self, chunk_size):
class ContigChunk(Contig):
def __init__(self, original, fake_start, size):
super(ContigChunk, self).__init__(original.name, original.seq[fake_start: fake_start+size])
self.fake_start=fake_start
self.fake_start = fake_start
at_the_end = len(self.seq) != size
first_chunk = not fake_start
self.title_padding = original.title_padding if first_chunk else 0
self.nuc_title_start = original.nuc_title_start if first_chunk else fake_start
self.nuc_seq_start = original.nuc_seq_start + fake_start
self.tail_padding = original.tail_padding if at_the_end else 0
self.reset_padding = original.reset_padding if at_the_end else 0
Expand Down
2 changes: 1 addition & 1 deletion DDV/html_template/nucleotideNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function showNucleotideNumber(event, viewer) {
if(cursor_in_a_title){
document.getElementById("Nucleotide").innerHTML = position_info.contig_name;
}else{
var display_number = information_to_show ? position_info.index_inside_contig : "-";
var display_number = information_to_show ? position_info.file_coordinates : "-";
document.getElementById("Nucleotide").innerHTML = numberWithCommas(display_number);
var display_file = information_to_show ? fasta_sources[position_info.fasta_index] : "Sequence under Cursor";
document.getElementById("FileUnderCursor").innerHTML = display_file;
Expand Down

0 comments on commit fca1918

Please sign in to comment.