annotate cummeRbund_options.py @ 1:f3012521ea79 draft

Uploaded fixed cummeRbund_options.py
author devteam
date Fri, 13 Mar 2015 15:30:17 -0400
parents 587c425b4e76
children ac2ebc60ef5d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.orm import sessionmaker
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
7 from sqlalchemy.orm import scoped_session
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
8
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
9 def get_genes( database_path ):
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
10 dburi = 'sqlite:///%s' % database_path
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
11 engine = create_engine( dburi )
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
12 meta = MetaData( bind=engine )
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
13 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
14 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
15 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
16
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
17 def get_samples( database_path ):
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
18 dburi = 'sqlite:///%s' % database_path
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
19 engine = create_engine( dburi )
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
20 meta = MetaData( bind=engine )
587c425b4e76 Initial commit with version 1.0.0 of the cummeRbund wrapper.
devteam
parents:
diff changeset
21 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
22 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
23 return [ ( sample[ 0 ], sample[ 0 ], False ) for sample in samples ]