@@ -1223,7 +1223,7 @@ def supported_filepath_types(artifact_type):
1223
1223
return qdb .sql_connection .TRN .execute_fetchindex ()
1224
1224
1225
1225
1226
- def generate_study_list (study_ids , build_samples ):
1226
+ def generate_study_list (study_ids , build_samples , public_only = False ):
1227
1227
"""Get general study information
1228
1228
1229
1229
Parameters
@@ -1233,6 +1233,8 @@ def generate_study_list(study_ids, build_samples):
1233
1233
build_samples : bool
1234
1234
If true the sample information for each process artifact within each
1235
1235
study will be included
1236
+ public_only : bool, optional
1237
+ If true, return only public BIOM artifacts. Default: false.
1236
1238
1237
1239
Returns
1238
1240
-------
@@ -1289,6 +1291,14 @@ def generate_study_list(study_ids, build_samples):
1289
1291
LEFT JOIN qiita.artifact_type USING (artifact_type_id)
1290
1292
WHERE artifact_type='BIOM' AND
1291
1293
study_id = qiita.study.study_id) AS artifact_biom_ts,
1294
+ - all the BIOM visibility sorted by artifact_id that belong to the study
1295
+ (SELECT array_agg(visibility ORDER BY artifact_id)
1296
+ FROM qiita.study_artifact
1297
+ LEFT JOIN qiita.artifact USING (artifact_id)
1298
+ LEFT JOIN qiita.artifact_type USING (artifact_type_id)
1299
+ LEFT JOIN qiita.visibility USING (visibility_id)
1300
+ WHERE artifact_type='BIOM' AND
1301
+ study_id = qiita.study.study_id) AS artifact_biom_vis,
1292
1302
- all the visibilities of all artifacts that belong to the study
1293
1303
(SELECT array_agg(DISTINCT visibility)
1294
1304
FROM qiita.study_artifact
@@ -1352,6 +1362,13 @@ def generate_study_list(study_ids, build_samples):
1352
1362
LEFT JOIN qiita.artifact_type USING (artifact_type_id)
1353
1363
WHERE artifact_type='BIOM' AND
1354
1364
study_id = qiita.study.study_id) AS artifact_biom_ts,
1365
+ (SELECT array_agg(visibility ORDER BY artifact_id)
1366
+ FROM qiita.study_artifact
1367
+ LEFT JOIN qiita.artifact USING (artifact_id)
1368
+ LEFT JOIN qiita.artifact_type USING (artifact_type_id)
1369
+ LEFT JOIN qiita.visibility USING (visibility_id)
1370
+ WHERE artifact_type='BIOM' AND
1371
+ study_id = qiita.study.study_id) AS artifact_biom_vis,
1355
1372
(SELECT array_agg(DISTINCT visibility)
1356
1373
FROM qiita.study_artifact
1357
1374
LEFT JOIN qiita.artifact USING (artifact_id)
@@ -1414,8 +1431,10 @@ def generate_study_list(study_ids, build_samples):
1414
1431
to_loop = zip (
1415
1432
info ['artifact_biom_ids' ], info ['artifact_biom_dts' ],
1416
1433
info ['artifact_biom_ts' ], info ['artifact_biom_params' ],
1417
- info ['artifact_biom_cmd' ])
1418
- for artifact_id , dt , ts , params , cmd in to_loop :
1434
+ info ['artifact_biom_cmd' ], info ['artifact_biom_vis' ])
1435
+ for artifact_id , dt , ts , params , cmd , vis in to_loop :
1436
+ if public_only and vis != 'public' :
1437
+ continue
1419
1438
proc_info = {'processed_date' : str (ts )}
1420
1439
proc_info ['pid' ] = artifact_id
1421
1440
proc_info ['data_type' ] = dt
@@ -1476,6 +1495,7 @@ def generate_study_list(study_ids, build_samples):
1476
1495
del info ["artifact_biom_ts" ]
1477
1496
del info ["artifact_biom_params" ]
1478
1497
del info ['artifact_biom_cmd' ]
1498
+ del info ['artifact_biom_vis' ]
1479
1499
1480
1500
infolist .append (info )
1481
1501
0 commit comments