Passing Query Sequence through POST?

Hi there,

just a simple question. Can I call the sequenceserver main page in a way that I can populate the Query Sequence field automatically (e.g. through POST)?
If not is it easy to add? I don’t mind adding a few lines to the search.erb view.

Thank you very much,


Do you want to open SS with a different query sequence each time or
with the same query sequence always?

Where is this query sequence sitting? your computer? on the computer
SS is installed on? some third computer?

-- Priyam

The query is different every time. It resides within a MySQL database and the user selects it from a Gbrowse instance. I have a gbrowse plugin that can start ncbi web blast searches using the current sequence in gbrowse and blast settings different than the defaults. I would like to do the same using SS to run a blast against a local database. Ideally I would also like to pass to SS custom blast settings as well.

Interesting usage.

The simplest solution probably is,

1. Use SS from the git repository (or source download - tar.gz or
zip). No gem install.

$ git clone
$ cd sequenceserver
$ gem install bundler
$ bundle install

Rest should follow from website.

2. Redirect users from GBrowse to
(assuming hosts your SS installation)

3. In SS,
  a. modify this [1] line so,

      get '/' do
        qid = params[:qid]
        seq = `mysql -e "select seq from seqs where seq_id=#{qid}"` # 3
        erb :search, :locals => {:sequence => seq, :databases =>

  b. and modify this [2] line so,

      <textarea name="sequence" id="sequence" spellcheck="false"
autofocus="true" placeholder="Paste your sequence(s) here..." >
        <%= sequence %>

I hope this makes sense. Drop us a line is there's any confusion. And
we would like to know once you get this working :slight_smile:

If you already have a URL that can be hit to obtain the desired
sequence, given it's id, from MySQL - say going to shows sequence with id
sequence_id - there's another approach that might be simpler.

[3]: See Ruby's backtick operator and string interpolation syntax
"#{}", if needed.

-- Priyam

I’m interested in this approach. If a script on the server returns a fasta object, like would it be possible to get sequenceserver to accept something like

… and populate query textarea with FASTA returned from sequences.cgi?

Not automatically. You will have to make modifications.

You could curl sequences.cgi with the given qid instead of running a mysql query to get the sequence in the previous example. Or you could use Ruby’s Net::HTTP library.

Alternatively, you could do this client side:

$.get(‘/sequence.cgi’ +, function (data) {

The code is just to give you an idea - it’s not tested.


Hi Priyam,

Thanks fort he prompt reply!

Yes, exactly. In which Ruby script should the example you gave below be implemented?

With kind regards,

Thomas van Gurp

Owner | Bioinformatician

Deena Bioinformatics

+31(317) 702 709

+31(6) 472 421 09

The example in the email/post to which you responded. Here -

There, instead of running a mysql query try to curl sequences.cgi to get the sequence instead.

Ah. The URLs in that post have grown stale … L120 lib/sequenceserver/routes.rb and L148 views/search.erb are the parts you are interested in.

If this works for you, we can try to refine and put a hook in sequenceserver to pre-load sequences given a url and sequence id.


Ok, I will give it a try. Thanks for the pointers. I’ll get back to you as soon as I have it working J