Mercurial > repos > devteam > cummerbund
annotate cummeRbund_options.py @ 0:587c425b4e76 draft
Initial commit with version 1.0.0 of the cummeRbund wrapper.
author | devteam |
---|---|
date | Tue, 23 Dec 2014 15:58:27 -0500 |
parents | |
children | f3012521ea79 |
rev | line source |
---|---|
0
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
1 from galaxy import eggs |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
2 eggs.require( 'SQLAlchemy' ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
3 eggs.require( 'pysqlite>=2' ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
4 from sqlalchemy import * |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
5 from sqlalchemy.sql import and_ |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
6 from sqlalchemy import exceptions as sa_exceptions |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
7 from sqlalchemy.orm import sessionmaker |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
8 from sqlalchemy.orm import scoped_session |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
9 |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
10 def get_genes( database_path ): |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
11 dburi = 'sqlite:///%s' % database_path |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
12 engine = create_engine( dburi ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
13 meta = MetaData( bind=engine ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
14 db_session = Session = scoped_session( sessionmaker( bind=engine, autoflush=False, autocommit=True ) ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
15 gene_ids = db_session.execute( 'select gene_short_name, gene_id from genes order by gene_short_name' ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
16 return [ ( gene_id[ 0 ], gene_id[ 1 ], False ) for gene_id in gene_ids ] |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
17 |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
18 def get_samples( database_path ): |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
19 dburi = 'sqlite:///%s' % database_path |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
20 engine = create_engine( dburi ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
21 meta = MetaData( bind=engine ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
22 db_session = Session = scoped_session( sessionmaker( bind=engine, autoflush=False, autocommit=True ) ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
23 samples = db_session.execute( 'select sample_name from samples order by sample_name' ) |
587c425b4e76
Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff
changeset
|
24 return [ ( sample[ 0 ], sample[ 0 ], False ) for sample in samples ] |