Mercurial > repos > devteam > cummerbund
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:587c425b4e76 |
---|---|
1 from galaxy import eggs | |
2 eggs.require( 'SQLAlchemy' ) | |
3 eggs.require( 'pysqlite>=2' ) | |
4 from sqlalchemy import * | |
5 from sqlalchemy.sql import and_ | |
6 from sqlalchemy import exceptions as sa_exceptions | |
7 from sqlalchemy.orm import sessionmaker | |
8 from sqlalchemy.orm import scoped_session | |
9 | |
10 def get_genes( database_path ): | |
11 dburi = 'sqlite:///%s' % database_path | |
12 engine = create_engine( dburi ) | |
13 meta = MetaData( bind=engine ) | |
14 db_session = Session = scoped_session( sessionmaker( bind=engine, autoflush=False, autocommit=True ) ) | |
15 gene_ids = db_session.execute( 'select gene_short_name, gene_id from genes order by gene_short_name' ) | |
16 return [ ( gene_id[ 0 ], gene_id[ 1 ], False ) for gene_id in gene_ids ] | |
17 | |
18 def get_samples( database_path ): | |
19 dburi = 'sqlite:///%s' % database_path | |
20 engine = create_engine( dburi ) | |
21 meta = MetaData( bind=engine ) | |
22 db_session = Session = scoped_session( sessionmaker( bind=engine, autoflush=False, autocommit=True ) ) | |
23 samples = db_session.execute( 'select sample_name from samples order by sample_name' ) | |
24 return [ ( sample[ 0 ], sample[ 0 ], False ) for sample in samples ] |