intermine / intermine-ws-python

InterMine Client library in Python
http://www.intermine.org
BSD 2-Clause "Simplified" License
7 stars 34 forks source link

Merge intermine-bio package into intermine-ws-python package #12

Open julie-sullivan opened 6 years ago

julie-sullivan commented 6 years ago

We have an intermine-bio package. Why?

https://github.com/intermine/intermine-ws-bio-python

I don't see a utility in keeping these separate. Just making another dependency. (@justinccdev may disagree?).

Let's merge the functionality into the main intermine package and delete this repo.

What does the bio package do? Here are the docs:

# Get all sequences for proteins on "h", "r", "eve", "bib" and "zen":

    from intermine.webservice import Service
    from interminebio import SequenceQuery

    s = Service("www.flymine.org/query")
    q = SequenceQuery(s, "Gene")

    syms = ["h", "r", "eve", "bib", "zen"] 

    print q.select_sequence("proteins").where(s.model.Gene.symbol == syms).fasta()

# Process the locations of these genes one at a time:

    for line in q.select_sequence("Gene").where(s.model.Gene.symbol == syms).bed():
        process(line)

Here are the end points it uses:

query/fasta
query/gff
query/ned
    LIST_PATH = "/regions/list"
    BED_PATH = "/regions/bed"
    FASTA_PATH = "/regions/fasta"
    GFF3_PATH = "/regions/gff3"

TODO

  1. copy over init and iterators files
  2. rename them something bio specific (I think we want a bio directory?)
  3. write tutorial
  4. test!
yochannah commented 4 years ago

I've added the hacktoberfest label to this issue. Note it's probably better to get started by trying some of the other hacktoberfest issues on this repo before you try this one.

mbasil09 commented 4 years ago

@yochannah I would like to try this.

yochannah commented 4 years ago

@mbasil09 Amazing - please go ahead! 😻

mbasil09 commented 4 years ago

@yochannah I think somewhere along the line the code in interminebio has been changed so much that it doesn't comply with the one in the main intermine repository. I tried changing it to python3, stil no luck. I believe that the links that it tries to open have been updated, which raise errors.

I'll still try to pinpoint those errors and try to fix them.

yochannah commented 4 years ago

that sounds possible, and also like a really good reason to get it merged back into the main package. Thank you so much for tackling this! 😍

mbasil09 commented 4 years ago

@yochannah Any idea where the fasta or bed or gf3 files are stored. The URLs used in interminebio are expired and give error404.

yochannah commented 4 years ago

@mbasil09 I can probably find them - where in interminebio are the broken links?

mbasil09 commented 4 years ago

@yochannah It tries to open this link (which doesn't exist): http://www.flymine.org/query/service/check/query.fasta

it's in this file in the interminebio repository: interminebio/iterators.py (Line 92)

mbasil09 commented 4 years ago

It happens on running this code (taken from the docs of interminebio):

from intermine.webservice import Service from interminebio import SequenceQuery s = Service("www.flymine.org/query") q = SequenceQuery(s, "Gene") syms = ["h", "r", "eve", "bib", "zen"] q=q.select_sequence("proteins").where(s.model.Gene.symbol == syms) print(q.fasta())

yochannah commented 4 years ago

right, I see!

Try taking a look at iodocs (click on flymine) - I suspect it's looking for the gff and fasta endpoints

http://iodocs.apps.intermine.org/

yochannah commented 4 years ago

@mbasil09 I also have a confession to make - I'm not sure how to install intermine bio to test it myself! It doesn't have install docs I can see (sigh) and best guess was to clone it then run python setup.py - do you mind me asking what you did to get it working?

mbasil09 commented 4 years ago

I couldn't get it to install either, the only workaround I found till now was to use it from the cloned directory. We are able to import all the methods from the interminebio directory. Also, all of it is written in python2, so you might want to convert it to python3.

yochannah commented 4 years ago

I think that's a good idea - today's literally the day that python 2 retires 🤣

https://pythonclock.org/