parameters available for linking out

Dear Developers,

What methods can I use besides the ones documented in https://github.com/yannickwurm/sequenceserver/blob/master/lib/sequenceserver/links.rb ?

I would like to link to a jbrowse instance, for this I would like to specify the start and end position on the target (hit)

using a constructor like this:

info = self

url = “http://etc.ect#[info]

I could get below information. But I cannot access the value underlying these parameters. I would like to do something like this:

def jbrowse

contig_id = “Asparagus.V2.0”

contig_pre = “AsOf_v2.0_scaffold”

r_start = self.some.method.to.get.to.hsp.sstart

r_end = self.some.method.to.get.to.hsp.send

contig = encode self.accession

hit_database = whichdb

rest = encode self

url = “http://192.0.0.10/jbrowse/?data=#{contig_id}” \

“%2Fjson%2F&tracks=DNA&highlight=&” \

“loc=#{contig_pre}#{contig}%3A#{r_start}…#{r_end}”

{

:order => 2,

:title => ‘jbrowse’,

:url => url,

:icon => ‘fa-external-link’

}

end

How can I get an overview of the methods available for accessing the variables stored in this instance?

Kind regards,

Thomas

URI::InvalidURIError - bad URI(is not URI?): http://192.0.0.10/jbrowse/?data=Asparagus.V2.0%2Fjson%2F&tracks=DNA&highlight=&loc=AsOf_v2.0_scaffold3%3A
[#<struct SequenceServer::BLAST::HSP::BLASTN hit=#<struct SequenceServer::BLAST::Hit query=#<struct SequenceServer::BLAST::Query report=#<SequenceServer::BLAST::Report:0x00000001be2548 @search_id=“sequenceserver_blast_result20150306-24194-15x7j87”,
@querydb=[#<struct SequenceServer::Database name="/root/blast_database/Agabi_varbisH97v3.1.fa",
title=“Agabi_varbisH97v3.1.fa”,
type=“nucleotide”,
nsequences=“13”,
ncharacters=“30417844”,
updated_on=“Feb 4,
2015 1:57 PM\n”>],
@queries=[#],
@program=“blastn”,
@program_version=“BLASTN 2.2.30+”,
@params={:matrix=>[“10”,
“2”,
“-3”,
“5”,
“2”,
“L;m;”],
:evalue=>nil,
:gapopen=>nil,
:gapextend=>nil,
:filters=>nil},
@stats={:nsequences=>“13”,
:ncharacters=>“30417844”,
:hsp_length=>“24”,
:search_space=>“3406763584”,
:kappa=>“0.41”,
:labmda=>“0.625”,
:entropy=>“0.78”}>,
number=1,
def=“Query_1”,
length=136,
hits=[#,
#<struct SequenceServer::BLAST::Hit query=#,

Hey Thomas,

You can access methods defined in the Hit calls within a link constructor. An incomplete list is here - http://www.rubydoc.info/github/yannickwurm/sequenceserver/SequenceServer/BLAST/Hit.

Alignment coordinates are not defined on a hit, but on hsps. Calling hsps method (in link constructor) will return an Array of HSP objects for that Hit. An incomplete list of of methods defined in HSP class is here - http://www.rubydoc.info/github/yannickwurm/sequenceserver/SequenceServer/BLAST/HSP

You will want alignment coordinates on the query sequences for JBrowse, right? For that, I would do:

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

Not sure if I should make a convenience method in Hit calls that directly returns alignment coordinates. Linking out to a genome browser will probably be the strongest use of link construction feature, and will need alignment coordinates for that.

Accordingly contig_id / contig_pre can be obtained by calling either accession or id method within link constructor. For local databases id and accession will almost always be the same. They are different when using NCBI’s nr database and similar (when sequences id in FASTA format have a pipe characters in them).

Regarding the error you are seeing, I think it’s because the URL is malformed. You should encode contig_id and contig_pre. And you should remove the encode self line. encode method is applicable only to Strings. (It replaces whitespace and other relevant chars in the string with % encoding followed in URLs).

You could also refer to hit.rb and hsp.rb source files till we have updated the documentation - https://github.com/yannickwurm/sequenceserver/tree/master/lib/sequenceserver/blast.

I hope this helps. We are really excited to see link constructor feature being used. Please reach out to us if there’s any difficulty.

– Priyam

Dear Priyam,

Thanks for the detailed reply and instructions! This is very helpful indeed. In the end I used these two parameters to jump to the right location in jbrowse:

def jbrowse

contig_id = “Asparagus.V2.0”

contig_pre = “”

r_start = hsps.map(&:sstart).min

r_end = r_start + hsps.map(&:length).max

contig = encode self.accession

hit_database = whichdb

rest = encode self

url = “http://192.0.0.10/jbrowse/?data=#{contig_id}” \

“%2Fjson%2F&tracks=DNA&highlight=&” \

“loc=#{contig_pre}#{contig}” “%3A#{r_start}…#{r_end}”

{

:order => 2,

:title => ‘jbrowse’,

:url => url,

:icon => ‘fa-external-link’

}

end