parklab / bamsnap

MIT License
109 stars 23 forks source link

HTML created for multi-sample snaps can't load the snaps #21

Open B3rse opened 3 years ago

B3rse commented 3 years ago

HTML created for multi-sample snaps can't load the snaps. The template is not updated and expects one snap for each sample while the program creates a single snap with all the samples. As a result, the HTML can't load pictures properly.

ankit-21 commented 2 years ago

Facing the same issue as the OP. Attaching a screenshot for reference.

Screen Shot 2021-11-23 at 11 29 50 AM

Any help is much appreciated.

ankit-21 commented 2 years ago

Fixed this error by fixing the path in the src/bamsnap/bamsnap.py file. Fixed the path in lines 122 and 154. I use an old Mac and the solution that worked for me was as below:

Lines 121-123:

img_list += '<a name="'+vid2+'"></a><div class="ic" id="s'+vid2+'"><div `class="text-block"><span` class="it">'+vid + \
                    '</span></div><img src="' + os.getcwd() + '/' + self.opt['out'] + '/bamsnap_images/' + \
                    vid2+'.png" alt="'+vid+'" style="width:100%;"></div>'

Lines 153-154:

img_list += '<a name="'+sid+'"></a><div class="ic" id="s'+sid+'"><div class="text-block"><span class="it">' + \
                    sid+'</span></div><img src="' + os.getcwd() + '/' + self.opt['out'] + '/bamsnap_images/'+vid+'.png" alt="'+sid+'" style="width:100%;"></div>

Lines 121-123:

img_list += '<a name="'+vid2+'"></a><div class="ic" id="s'+vid2+'"><div class="text-block"><span class="it">'+vid + \
                    '</span></div><img src="../bamsnap_images/' + \
                    vid2+'.png" alt="'+vid+'" style="width:100%;"></div>'

Lines 153-154:

vid3 = pos1['chrom'] + '_' + str(pos1['t_pos'])
img_list += '<a name="'+sid+'"></a><div class="ic" id="s'+sid+'"><div class="text-block"><span class="it">' + \
                    sid+'</span></div><img src="../bamsnap_images/'+vid3+'.png" alt="'+sid+'" style="width:100%;"></div>'

I hope this helps. :)