Created
May 18, 2016 17:02
-
-
Save sestaton/ae4cc0dc273067333f7264f925f34433 to your computer and use it in GitHub Desktop.
create links to sunflower jbrowse from blast server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
module SequenceServer | |
# Module to contain methods for generating sequence retrieval links. | |
module Links | |
require 'erb' | |
include ERB::Util | |
alias_method :encode, :url_encode | |
BRONZE_ID_PATTERN = /(Ha\d+)/ | |
def bronze | |
return nil unless id.match(BRONZE_ID_PATTERN) | |
bronze_id = Regexp.last_match[1] | |
bronze_id = encode bronze_id | |
best_start = "" | |
best_end = "" | |
bscore = hsps.map(&:bit_score).max | |
hsps.each do |hsp, value| | |
if bscore == hsp.bit_score | |
best_start = hsp.sstart | |
best_end = hsp.send | |
end | |
end | |
url = "http://sunflowergenome.org/jbrowse_current/?data=extdata%2Fbronze" \ | |
"&loc=#{bronze_id}%3A#{best_start}..#{best_end}" \ | |
"&highlight=#{bronze_id}%3A#{best_start}..#{best_end}" \ | |
"&tracks=Genes%2CTranscript%2CTIRs%2CHelitrons%2Cnon_LTR_retrotransposons%2C" \ | |
"TRIM_retrotransposons%2CLTR_retrotransposons" | |
{ | |
:order => 2, | |
:title => 'HA412HO bronze genome browser - (best hit)', | |
:url => url, | |
:icon => 'fa-external-link' | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment