@@ -113,7 +113,6 @@ class Study(qdb.base.QiitaObject):
113
113
Attributes
114
114
----------
115
115
data_types
116
- efo
117
116
info
118
117
investigation
119
118
name
@@ -302,7 +301,7 @@ def exists(cls, study_title):
302
301
return qdb .sql_connection .TRN .execute_fetchlast ()
303
302
304
303
@classmethod
305
- def create (cls , owner , title , efo , info , investigation = None ):
304
+ def create (cls , owner , title , info , investigation = None ):
306
305
"""Creates a new study on the database
307
306
308
307
Parameters
@@ -311,8 +310,6 @@ def create(cls, owner, title, efo, info, investigation=None):
311
310
the study's owner
312
311
title : str
313
312
Title of the study
314
- efo : list
315
- Experimental Factor Ontology id(s) for the study
316
313
info : dict
317
314
the information attached to the study. All "*_id" keys must pass
318
315
the objects associated with them.
@@ -326,24 +323,19 @@ def create(cls, owner, title, efo, info, investigation=None):
326
323
All required keys not passed
327
324
IncompetentQiitaDeveloperError
328
325
email, study_id, study_status_id, or study_title passed as a key
329
- empty efo list passed
330
326
QiitaDBDuplicateError
331
327
If a study with the given title already exists
332
328
333
329
Notes
334
330
-----
335
- All keys in info, except the efo, must be equal to columns in
336
- qiita.study table in the database.
331
+ All keys in info, must be equal to columns in qiita.study table in the
332
+ database.
337
333
"""
338
334
# make sure not passing non-info columns in the info dict
339
335
if cls ._non_info .intersection (info ):
340
336
raise qdb .exceptions .QiitaDBColumnError (
341
337
"non info keys passed: %s" % cls ._non_info .intersection (info ))
342
338
343
- # make sure efo info passed
344
- if not efo :
345
- raise IncompetentQiitaDeveloperError ("Need EFO information!" )
346
-
347
339
with qdb .sql_connection .TRN :
348
340
if cls .exists (title ):
349
341
raise qdb .exceptions .QiitaDBDuplicateError (
@@ -383,13 +375,6 @@ def create(cls, owner, title, efo, info, investigation=None):
383
375
qdb .sql_connection .TRN .add (sql , data )
384
376
study_id = qdb .sql_connection .TRN .execute_fetchlast ()
385
377
386
- # insert efo information into database
387
- sql = """INSERT INTO qiita.{0}_experimental_factor
388
- (study_id, efo_id)
389
- VALUES (%s, %s)""" .format (cls ._table )
390
- qdb .sql_connection .TRN .add (
391
- sql , [[study_id , e ] for e in efo ], many = True )
392
-
393
378
# Add to both QIITA and given portal (if not QIITA)
394
379
portal_id = qdb .util .convert_to_id (
395
380
qiita_config .portal , 'portal_type' , 'portal' )
@@ -442,10 +427,6 @@ def delete(cls, id_):
442
427
sql = "DELETE FROM qiita.study_portal WHERE study_id = %s"
443
428
qdb .sql_connection .TRN .add (sql , args )
444
429
445
- sql = """DELETE FROM qiita.study_experimental_factor
446
- WHERE study_id = %s"""
447
- qdb .sql_connection .TRN .add (sql , args )
448
-
449
430
sql = "DELETE FROM qiita.study_publication WHERE study_id = %s"
450
431
qdb .sql_connection .TRN .add (sql , args )
451
432
@@ -631,44 +612,6 @@ def info(self, info):
631
612
qdb .sql_connection .TRN .add (sql , data )
632
613
qdb .sql_connection .TRN .execute ()
633
614
634
- @property
635
- def efo (self ):
636
- with qdb .sql_connection .TRN :
637
- sql = """SELECT efo_id FROM qiita.{0}_experimental_factor
638
- WHERE study_id = %s""" .format (self ._table )
639
- qdb .sql_connection .TRN .add (sql , [self ._id ])
640
- return qdb .sql_connection .TRN .execute_fetchflatten ()
641
-
642
- @efo .setter
643
- def efo (self , efo_vals ):
644
- """Sets the efo for the study
645
-
646
- Parameters
647
- ----------
648
- efo_vals : list
649
- Id(s) for the new efo values
650
-
651
- Raises
652
- ------
653
- IncompetentQiitaDeveloperError
654
- Empty efo list passed
655
- """
656
- if not efo_vals :
657
- raise IncompetentQiitaDeveloperError ("Need EFO information!" )
658
- with qdb .sql_connection .TRN :
659
- self ._lock_non_sandbox ()
660
- # wipe out any EFOs currently attached to study
661
- sql = """DELETE FROM qiita.{0}_experimental_factor
662
- WHERE study_id = %s""" .format (self ._table )
663
- qdb .sql_connection .TRN .add (sql , [self ._id ])
664
- # insert new EFO information into database
665
- sql = """INSERT INTO qiita.{0}_experimental_factor
666
- (study_id, efo_id)
667
- VALUES (%s, %s)""" .format (self ._table )
668
- qdb .sql_connection .TRN .add (
669
- sql , [[self ._id , efo ] for efo in efo_vals ], many = True )
670
- qdb .sql_connection .TRN .execute ()
671
-
672
615
@property
673
616
def shared_with (self ):
674
617
"""list of users the study is shared with
0 commit comments