Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Standard packaging for genologics #1

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c5fd08d
Packaging according to official distribute guide http://guide.python-…
Sep 4, 2012
e532c53
Attaching sequencing delivery report in a project level or attribute …
Feb 18, 2013
261415c
Basic package arrangements for proof of concept task on attaching del…
Feb 18, 2013
d35d183
Finished proof of concept for Delivery report, fixed instance bug on …
Feb 18, 2013
f7ff594
_instance does not exist on self
Feb 19, 2013
527b372
Switching to a more userfriendly configuration system
Feb 19, 2013
555324b
URI type supported
Feb 19, 2013
b643c21
Examples cleanup regarding credentials
Feb 19, 2013
bab6110
Merge pull request #1 from brainstorm/master
Feb 19, 2013
e3ec870
Does not pip-install if it's not tarball
Feb 19, 2013
15ad3ee
Merge pull request #2 from brainstorm/master
Feb 19, 2013
c281236
get application
Feb 25, 2013
fd6e2ef
Merge branch 'master' of https://github.com/SciLifeLab/genologics
Mar 4, 2013
c25ee94
Add __init__.py to package and classifiers to setup.py
Mar 4, 2013
9a72f71
Userfriendly warning for missing config file
Mar 4, 2013
6758411
Merge pull request #3 from brainstorm/master
Mar 4, 2013
9050a60
Remove old endpoints and enter new ones
guillermo-carrasco Apr 29, 2013
6632cd0
Notes removed from project
guillermo-carrasco Apr 29, 2013
6e3eda7
Merge branch 'feature/apiv2' into develop
guillermo-carrasco Apr 29, 2013
6fea595
Merge pull request #6 from guillermo-carrasco/develop
Apr 29, 2013
b1ccee9
Removing faulty caching mechanism, thanks @mayabrandi. Version bump.
May 7, 2013
1d5e0f4
Merge pull request #8 from brainstorm/master
guillermo-carrasco May 7, 2013
f7fef25
uppdate
mayabrandi May 30, 2013
b822c96
init
mayabrandi May 30, 2013
0a8770d
Adding scripts folder, will be the endpoint for deployment
Jun 25, 2013
3c244d8
Add attach delivery report as a deploy test example
Jun 25, 2013
5da1222
Merge @mayabrandi changes
Jun 25, 2013
6a73cf3
in sync
mayabrandi Jul 1, 2013
660faad
first commit of the LIMS2DB paccage
mayabrandi Jul 1, 2013
bbedcf0
Cleanup @mayabrandi commit
Jul 3, 2013
c6898de
Tab indentation fix. Date delta fix.
mayabrandi Jul 4, 2013
41b0137
taken away testing date
mayabrandi Jul 4, 2013
fa31a80
Merge pull request #11 from mayabrandi/master
mayabrandi Jul 4, 2013
0031b67
temp solution for loading status from google docs
mayabrandi Jul 4, 2013
f801a32
Merge pull request #12 from mayabrandi/master
Jul 4, 2013
614f4b1
Conflict
Jul 4, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
site_*.py
*.pyc
*~
41 changes: 28 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,37 @@ instance to the database.

### Installation

The 'genologics' directory should be made accessible in your Python path,
by whatever method suits your installation.
```
pip install genologics
```

or for the cutting edge version:

```
pip install https://github.com/SciLifeLab/genologics/tarball/master
```

### Usage

The client script imports the class Lims from the genologics.lims module,
and instantiates it with the required arguments:
The URL and credentials should be wrintten in a new file in any
of those config files (ordered by preference):

```
$HOME/.genologicsrc, .genologicsrc, genologics.conf, genologics.cfg
```

or if installed system_wide:

- Base URI of the server, including the port number, but excluding
the '/api/v1' segment of the path.
- User name of the account on the server.
- Password of the account on the server.
```
/etc/genologics.conf
```

```
[genologics]
BASEURI=https://yourlims.example.com:8443
USERNAME=your_username
PASSWORD=your_password
```

### Example scripts

Expand All @@ -43,13 +62,9 @@ NOTE: The example files rely on specific entities and configurations
on the server, and use base URI, user name and password, so to work
for your server, all these must be reviewed and modified.

### Caveats

The interface has not been used much yet, so it is not properly debugged.
### Known bugs

Known issues:
- Artifact state is part of its URL (as a query parameter).
It is not entirely clear how to deal with this in the Lims.cache:
Currently, an artifact that has the current state may be represented
by a URL that includes the state, and another that does not contain it.

5 changes: 0 additions & 5 deletions __init__.py

This file was deleted.

31 changes: 31 additions & 0 deletions examples/attach_delivery_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Python interface to GenoLogics LIMS via its REST API.

Usage example: Attach customer delivery report to LIMS



Roman Valls Guimera, Science for Life Laboratory, Stockholm, Sweden.
"""

import codecs
from pprint import pprint
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
lims.check_version()

project = Project(lims, id="P193")

print 'UDFs:'
pprint(project.udf.items())

print 'files:'
for file in project.files:
print file.content_location

project.udf['Delivery Report'] = "http://example.com/delivery_note.pdf"
project.put()
26 changes: 26 additions & 0 deletions examples/get_application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Python interface to GenoLogics LIMS via its REST API.

Usage example: Attach customer delivery report to LIMS



Roman Valls Guimera, Science for Life Laboratory, Stockholm, Sweden.
"""

import codecs
from pprint import pprint
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
lims.check_version()

project = Project(lims, id="P193")

print 'UDFs:'
pprint(project.udf.items())

print project.udf['Application']
5 changes: 2 additions & 3 deletions examples/get_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Usage example: Get artifacts and artifact info.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
Expand All @@ -12,8 +12,7 @@
from genologics.lims import Lims

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
19 changes: 16 additions & 3 deletions examples/get_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Usage example: Get some containers.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
Expand All @@ -12,8 +12,7 @@
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand All @@ -39,3 +38,17 @@

containertype = container.type
print containertype, containertype.name, containertype.x_dimension, containertype.y_dimension



containers = lims.get_containers(type='Illumina Flow Cell',state='Populated')
for container in containers:
print container.name
print container.id
print container.placements.keys()
arts=lims.get_artifacts(containername=container.name)
for art in arts:
print art.name
print art.type
print art.udf.items()
print art.parent_process.type.name
5 changes: 2 additions & 3 deletions examples/get_labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Usage example: Get labs and lab info.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
Expand All @@ -11,8 +11,7 @@
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
5 changes: 2 additions & 3 deletions examples/get_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

Usage example: Get some processes.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""

from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
11 changes: 3 additions & 8 deletions examples/get_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Usage example: Get some projects.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
Expand All @@ -12,8 +12,7 @@
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand All @@ -29,7 +28,7 @@
print len(projects), 'projects opened since', day

# Get the project with the specified LIMS id, and print some info.
project = Project(lims, id='KRA61')
project = Project(lims, id='P193')
print project, project.name, project.open_date, project.close_date

print ' UDFs:'
Expand All @@ -45,10 +44,6 @@
value = codecs.encode(value, 'UTF-8')
print ' ', key, '=', value

print ' notes:'
for note in project.notes:
print note.uri, note.content

print ' files:'
for file in project.files:
print file.id
Expand Down
6 changes: 3 additions & 3 deletions examples/get_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Usage examples: Get some samples, and sample info.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""

from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD

from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
4 changes: 2 additions & 2 deletions examples/get_samples2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

Usage examples: Get some samples, and sample info.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""

from genologics.lims import *

from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD
lims = Lims(BASEURI, USERNAME, PASSWORD)
lims.check_version()

Expand Down
5 changes: 2 additions & 3 deletions examples/set_project_queued.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Example usage: Set the UDF 'Queued' of a project.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
Expand All @@ -12,8 +12,7 @@
from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
5 changes: 2 additions & 3 deletions examples/set_sample_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

Example usage: Set the name and a UDF of a sample.

NOTE: You need to set the BASEURI, USERNAME AND PASSWORD.


Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""

from genologics.lims import *

# Login parameters for connecting to a LIMS instance.
# NOTE: Modify according to your setup.
from genologics.site_cloud import BASEURI, USERNAME, PASSWORD
from genologics.config import BASEURI, USERNAME, PASSWORD

# Create the LIMS interface instance, and check the connection and version.
lims = Lims(BASEURI, USERNAME, PASSWORD)
Expand Down
Empty file added genologics/__init__.py
Empty file.
22 changes: 22 additions & 0 deletions genologics/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import sys
import warnings

import ConfigParser

config = ConfigParser.SafeConfigParser()
try:
conf_file = config.read([os.path.expanduser('~/.genologicsrc'), '.genologicsrc',
'genologics.conf', 'genologics.cfg', '/etc/genologics.conf'])

# First config file found wins
config.readfp(open(conf_file[0]))

BASEURI = config.get('genologics', 'BASEURI').rstrip()
USERNAME = config.get('genologics', 'USERNAME').rstrip()
PASSWORD = config.get('genologics', 'PASSWORD').rstrip()
except:
warnings.warn("Please make sure you've created your own Genologics configuration file (i.e: ~/.genologicsrc) as stated in README.md")
sys.exit(-1)


Loading