Question on intermine API for fasta?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Question on intermine API for fasta?

Colin
Hi again,
I am trying to use examples similar to those described in the iodocs to load fasta in imjs. I found that I could load the xml using fromXML (yay) and do queries on the standard endpoint like www.flymine.org/query


However, if I change to the fasta endpoint
var mymine = new im.Service({root: '<a href="http://www.flymine.org/query/results/fasta&#39;}">www.flymine.org/query/results/fasta'});

Then it returns
XMLHttpRequest cannot load http://www.flymine.org/query/results/fasta/service/summaryfields?format=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

Is this just a choice of the server to not have CORS enabled on the api?

Thanks,
-Colin

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Question on intermine API for fasta?

Alex Kalderimis-2
Just further to my previous reply, here is an example for using the
FASTA services with the support of the imjs library from javascript:

```:js
  var im = require('imjs');

  var ROOT = 'http://www.flymine.org/query/';
  var query = {
    select: ['*'],
    from: 'Gene',
    where: [['Gene', 'IN', 'PL FlyAtlas_brain_top']]
  };
  var call = function (m) { return function (o) { return o[m](); }; };

  var connection = im.Service.connect({root: ROOT});

  connection.query(query)
            .then(call('getFASTA'))
            .then(console.log.bind(console, 'FASTA:'));

```

All best,

Alex

On Thu, Oct 30, 2014 at 02:47:58AM -0500, Colin wrote:

> Hi again,
> I am trying to use examples similar to those described in the iodocs to
> load fasta in imjs. I found that I could load the xml using fromXML (yay)
> and do queries on the standard endpoint like www.flymine.org/query
>
>
> However, if I change to the fasta endpoint
> var mymine = new im.Service({root: 'www.flymine.org/query/results/fasta'});
>
> Then it returns
> XMLHttpRequest cannot load
> http://www.flymine.org/query/results/fasta/service/summaryfields?format=json.
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost' is therefore not allowed access.
>
> Is this just a choice of the server to not have CORS enabled on the api?
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Question on intermine API for fasta?

Colin
Thanks a lot for this. Is getFASTA documented in imjs or is it just part of the Query object? I found a couple other methods by logging the console output of the Query object but would be interested if I was missing anything.

Also, would it be possible to query the upstream regions of genes using the FASTA query?

-Colin


On Thu, Oct 30, 2014 at 6:23 AM, Alex Kalderimis <[hidden email]> wrote:
Just further to my previous reply, here is an example for using the
FASTA services with the support of the imjs library from javascript:

```:js
  var im = require('imjs');

  var ROOT = 'http://www.flymine.org/query/';
  var query = {
    select: ['*'],
    from: 'Gene',
    where: [['Gene', 'IN', 'PL FlyAtlas_brain_top']]
  };
  var call = function (m) { return function (o) { return o[m](); }; };

  var connection = im.Service.connect({root: ROOT});

  connection.query(query)
            .then(call('getFASTA'))
            .then(console.log.bind(console, 'FASTA:'));

```

All best,

Alex

On Thu, Oct 30, 2014 at 02:47:58AM -0500, Colin wrote:
> Hi again,
> I am trying to use examples similar to those described in the iodocs to
> load fasta in imjs. I found that I could load the xml using fromXML (yay)
> and do queries on the standard endpoint like www.flymine.org/query
>
>
> However, if I change to the fasta endpoint
> var mymine = new im.Service({root: '<a href="http://www.flymine.org/query/results/fasta&#39;}" target="_blank">www.flymine.org/query/results/fasta'});
>
> Then it returns
> XMLHttpRequest cannot load
> http://www.flymine.org/query/results/fasta/service/summaryfields?format=json.
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost' is therefore not allowed access.
>
> Is this just a choice of the server to not have CORS enabled on the api?
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Question on intermine API for fasta?

Alex Kalderimis-2
In reply to this post by Colin

I think these methods aren't actually documented, to my shame, since they are created with metaprogramming which doesn't work well with the API docs generation tool. I will improve that.

The upstream regions can be queried if the database supports it. Take a look at the FlyMine model for an example of this, with the intergenic region collections of Gene for example.

Alex

On 4 Nov 2014 10:39, Colin <[hidden email]> wrote:
Thanks a lot for this. Is getFASTA documented in imjs or is it just part of the Query object? I found a couple other methods by logging the console output of the Query object but would be interested if I was missing anything.

Also, would it be possible to query the upstream regions of genes using the FASTA query?

-Colin


On Thu, Oct 30, 2014 at 6:23 AM, Alex Kalderimis <[hidden email]> wrote:
Just further to my previous reply, here is an example for using the
FASTA services with the support of the imjs library from javascript:

```:js
  var im = require('imjs');

  var ROOT = 'http://www.flymine.org/query/';
  var query = {
    select: ['*'],
    from: 'Gene',
    where: [['Gene', 'IN', 'PL FlyAtlas_brain_top']]
  };
  var call = function (m) { return function (o) { return o[m](); }; };

  var connection = im.Service.connect({root: ROOT});

  connection.query(query)
            .then(call('getFASTA'))
            .then(console.log.bind(console, 'FASTA:'));

```

All best,

Alex

On Thu, Oct 30, 2014 at 02:47:58AM -0500, Colin wrote:
> Hi again,
> I am trying to use examples similar to those described in the iodocs to
> load fasta in imjs. I found that I could load the xml using fromXML (yay)
> and do queries on the standard endpoint like www.flymine.org/query
>
>
> However, if I change to the fasta endpoint
> var mymine = new im.Service({root: '<a href="http://www.flymine.org/query/results/fasta&#39;}" target="_blank">www.flymine.org/query/results/fasta'});
>
> Then it returns
> XMLHttpRequest cannot load
> http://www.flymine.org/query/results/fasta/service/summaryfields?format=json.
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost' is therefore not allowed access.
>
> Is this just a choice of the server to not have CORS enabled on the api?
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev