Custom Hyperlink Creation Enquiry

Dear SequenceServer authors and users,

I understand that with the 1.+ version, customisation of links move to links.rb, as in the source code hosted in GitHub:

https://github.com/wurmlab/sequenceserver/blob/master/lib/sequenceserver/links.rb

We are currently using 0.8.7 and I have modified it to include custom links to GBrowse, I modified customisation.rb, function construct_custom_sequence_hyperlink(options), to this effect:

Hey Dave,

You have access to an Array of HSP objects in the link generation functions. Alignment coordinates are defined on HSP objects.

To get alignment start:
qstart = hsps.map(&:qstart).min # on query sequence
sstart = hsps.map(&:sstart).min # on target/subject sequence

Any function defined in Links module is automatically called, unless it’s declared private. You don’t have to worry about calling it yourself. Just return nil from the function if a link can’t be generated. If you want to create a helper function, like to get alignment coordinates, declare it private and it won’t be called.

Also, you need not modify links.rb bundled with SequenceServer. In fact, you shouldn’t as it will complicate further upgrades for you. Instead, create a separate file (call it whatever) and load it either by running “sequenceserver -r my_links_file.rb” or set it in configuration file by running “sequenceserver -s -r my_link_file.rb”.

Overall,

module SequenceServer
module Links

def apiloc

generate apiloc link

end

private

def coords
qstart = hsps.map(&:qstart).min
sstart = hsps.map(&:sstart).min
qend = hsps.map(&:qend).max

send = hsps.map(&:send).max
[[qstart, qend], [sstart, send]]
end

end
end

I hope this helps.

– Priyam

Hi Anurag.

Thanks for replying. I will have to work it on later as I’m restoring from a bungled backup that led to a crash in our Amazon instance.

As for creating a separate file, how do I implement it as I’m not using SS as stand-alone but served by Apache using Passenger?

Hey,

SequenceServer reads the config file whether run self-hosted or via Passenger. Just set location of the links file through the “require” key in config file.

If directly editing config file, add line:

:require: /path/to/links/file

If want to set from command line:

sequenceserver -s -r /path/to/links/file

If you are using alternate config file:

sequenceserver -c /my/config/file -s -r /path/to/links/file

The sequenceserver command should be viewed as a way to configure and test your SequenceServer setup and the simplest recourse to run it.

– Priyam