Skip to content

Commit ab0e2f2

Browse files
authored
Merge pull request #2149 from antgonza/improving-artifact-info
Improving artifact info and study listing
2 parents 4c91753 + b114500 commit ab0e2f2

File tree

15 files changed

+443
-424
lines changed

15 files changed

+443
-424
lines changed

qiita_db/test/test_util.py

Lines changed: 55 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -801,98 +801,73 @@ def test_generate_study_list(self):
801801
qdb.user.User('shared@foo.bar'), 'test_study_1', efo=[1],
802802
info=info)
803803

804-
exp_info = [{
805-
'metadata_complete': True,
806-
'ebi_submission_status': 'submitted',
807-
'shared': [('shared@foo.bar', 'Shared')],
808-
'pi': ('PI_dude@foo.bar', 'PIDude'),
809-
'status': 'private',
810-
'proc_data_info': [],
811-
'publication_doi': ['10.100/123456', '10.100/7891011'],
812-
'publication_pid': ['123456', '7891011'],
813-
'study_abstract': (
804+
exp_info = [
805+
{'status': 'private', 'metadata_complete': True,
806+
'study_tags': None, 'publication_doi': [
807+
'10.100/123456', '10.100/7891011'],
808+
'study_title': ('Identification of the Microbiomes for '
809+
'Cannabis Soils'),
810+
'publication_pid': ['123456', '7891011'],
811+
'ebi_submission_status': 'submitted', 'study_id': 1,
812+
'ebi_study_accession': 'EBI123456-BB',
813+
'shared': [('shared@foo.bar', 'Shared')],
814+
'study_abstract': (
814815
'This is a preliminary study to examine the microbiota '
815-
'associated with the Cannabis plant. Soils samples from '
816-
'the bulk soil, soil associated with the roots, and the '
817-
'rhizosphere were extracted and the DNA sequenced. Roots '
818-
'from three independent plants of different strains were '
819-
'examined. These roots were obtained November 11, 2011 from '
820-
'plants that had been harvested in the summer. Future studies '
821-
'will attempt to analyze the soils and rhizospheres from the '
822-
'same location at different time points in the plant '
823-
'lifecycle.'),
824-
'study_id': 1,
825-
'ebi_study_accession': 'EBI123456-BB',
826-
'study_title': ('Identification of the Microbiomes for Cannabis '
827-
'Soils'),
828-
'number_samples_collected': 27,
829-
'study_tags': None
830-
}, {
831-
'metadata_complete': True,
832-
'ebi_submission_status': 'not submitted', 'publication_pid': [],
833-
'study_abstract': 'Some abstract goes here',
834-
'pi': ('lab_dude@foo.bar', 'LabDude'), 'status': 'sandbox',
835-
'proc_data_info': [], 'study_tags': None, 'shared': [],
836-
'publication_doi': [], 'study_id': new_study.id,
837-
'ebi_study_accession': None, 'study_title': 'test_study_1',
838-
'number_samples_collected': 0}]
816+
'associated with the Cannabis plant. Soils samples from the '
817+
'bulk soil, soil associated with the roots, and the '
818+
'rhizosphere were extracted and the DNA sequenced. Roots from '
819+
'three independent plants of different strains were examined. '
820+
'These roots were obtained November 11, 2011 from plants that '
821+
'had been harvested in the summer. Future studies will '
822+
'attempt to analyze the soils and rhizospheres from the same '
823+
'location at different time points in the plant lifecycle.'),
824+
'pi': ('PI_dude@foo.bar', 'PIDude'),
825+
'artifact_biom_ids': [4, 5, 6, 7],
826+
'number_samples_collected': 27},
827+
{'status': 'sandbox', 'metadata_complete': True,
828+
'study_tags': None, 'publication_doi': [],
829+
'study_title': 'test_study_1', 'publication_pid': [],
830+
'ebi_submission_status': 'not submitted',
831+
'study_id': new_study.id, 'ebi_study_accession': None,
832+
'shared': [], 'study_abstract': 'Some abstract goes here',
833+
'pi': ('lab_dude@foo.bar', 'LabDude'),
834+
'artifact_biom_ids': None, 'number_samples_collected': 0}]
839835
obs_info = qdb.util.generate_study_list([1, 2, 3, 4], True)
840836
self.assertEqual(obs_info, exp_info)
841837

842838
qdb.artifact.Artifact(4).visibility = 'public'
843839
exp_info[0]['status'] = 'public'
844-
exp_info[0]['proc_data_info'] = [
845-
{'data_type': '18S', 'name': 'BIOM',
846-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
847-
'pid': 4, 'processed_date': '2012-10-02 17:30:00',
848-
'params': {'similarity': 0.97, 'reference_name': 'Greengenes',
849-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
850-
'threads': 1, u'sortmerna_coverage': 0.97,
851-
'reference_version': '13_8'}},
852-
{'data_type': '18S', 'name': 'BIOM',
853-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
854-
'pid': 5, 'processed_date': '2012-10-02 17:30:00',
855-
'params': {'similarity': 0.97, 'reference_name': 'Greengenes',
856-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
857-
'threads': 1, 'sortmerna_coverage': 0.97,
858-
'reference_version': '13_8'}},
859-
{'data_type': '16S', 'name': 'BIOM',
860-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
861-
'pid': 6, 'processed_date': '2012-10-02 17:30:00',
862-
'params': {'similarity': 0.97, 'reference_name': 'Silva',
863-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
864-
'threads': 1, 'sortmerna_coverage': 0.97,
865-
'reference_version': 'test'}}]
866840
obs_info = qdb.util.generate_study_list([1, 2, 3, 4], True)
867841
self.assertEqual(obs_info, exp_info)
868842

869-
exp_info[0]['proc_data_info'] = [
870-
{'data_type': '18S', 'name': 'BIOM',
871-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
872-
'pid': 4, 'processed_date': '2012-10-02 17:30:00',
873-
'params': {'similarity': 0.97, 'reference_name': 'Greengenes',
874-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
875-
'threads': 1, 'sortmerna_coverage': 0.97,
876-
'reference_version': '13_8'}},
877-
{'data_type': '18S', 'name': 'BIOM',
878-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
879-
'pid': 5, 'processed_date': '2012-10-02 17:30:00',
880-
'params': {'similarity': 0.97, 'reference_name': 'Greengenes',
881-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
882-
'threads': 1, 'sortmerna_coverage': 0.97,
883-
'reference_version': '13_8'}},
884-
{'data_type': '16S', 'name': 'BIOM',
885-
'algorithm': 'QIIME v1.9.1 (Pick closed-reference OTUs)',
886-
'pid': 6, 'processed_date': '2012-10-02 17:30:00',
887-
'params': {'similarity': 0.97, 'reference_name': 'Silva',
888-
'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000,
889-
'threads': 1, 'sortmerna_coverage': 0.97,
890-
'reference_version': 'test'}},
891-
{'processed_date': '2012-10-02 17:30:00', 'pid': 7, 'name': 'BIOM',
892-
'data_type': '16S'}]
893843
obs_info = qdb.util.generate_study_list([1, 2, 3, 4], False)
894844
self.assertEqual(obs_info, exp_info)
895845

846+
def test_get_artifacts_bioms_information(self):
847+
# we are gonna test that it ignores 1 and 2 cause they are not biom,
848+
# 4 has all information and 7 and 8 don't
849+
obs = qdb.util.get_artifacts_bioms_information([1, 2, 4, 7, 8])
850+
# not testing timestamp
851+
for i in range(len(obs)):
852+
del obs[i]['timestamp']
853+
854+
exp = [
855+
{'files': ['1_study_1001_closed_reference_otu_table.biom'],
856+
'target_subfragment': ['V4'], 'data_type': '18S',
857+
'parameters': {
858+
'reference': 1, 'similarity': 0.97, 'sortmerna_e_value': 1,
859+
'sortmerna_max_pos': 10000, 'input_data': 2, 'threads': 1,
860+
'sortmerna_coverage': 0.97}, 'name': 'BIOM',
861+
'algorithm': ('Pick closed-reference OTUs, QIIMEv1.9.1 '
862+
'| barcode_type 8, defaults'), 'artifact_id': 4},
863+
{'files': [], 'target_subfragment': ['V4'], 'data_type': '16S',
864+
'parameters': {}, 'name': 'BIOM', 'algorithm': '',
865+
'artifact_id': 7},
866+
{'files': ['biom_table.biom'], 'target_subfragment': [],
867+
'data_type': '18S', 'parameters': {}, 'name': 'noname',
868+
'algorithm': '', 'artifact_id': 8}]
869+
self.assertEqual(obs, exp)
870+
896871

897872
if __name__ == '__main__':
898873
main()

0 commit comments

Comments
 (0)