Skip to content

List proc data in search #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implement suggestions
  • Loading branch information
squirrelo committed Apr 13, 2015
commit c16b4294ad7f1bcf09c11dc337304d990d6ce927
12 changes: 6 additions & 6 deletions qiita_pet/handlers/study_handlers/listing_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _get_shared_links_for_study(study):
return ", ".join(shared)


def _build_single_study_info(study, info):
def _build_single_study_info(study, info, study_proc, proc_samples):
"""Clean up and add to the study info for HTML purposes

Parameters
Expand Down Expand Up @@ -75,6 +75,9 @@ def _build_single_study_info(study, info):
info["pi"] = study_person_linkifier((PI.email, PI.name))
del info["principal_investigator_id"]
del info["email"]
# Build the proc data info list for the child row in datatable
info["proc_data_info"] = _build_single_proc_data_info(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving this here!

study, study_proc, proc_samples)
return info


Expand Down Expand Up @@ -174,11 +177,8 @@ def _build_study_info(user, study_proc=None, proc_samples=None):
for pid in proc_data:
proc_samples[pid] = ProcessedData(pid).samples

study_info = _build_single_study_info(study, info)
# Build the proc data info list for the child row in datatable
study_info["proc_data_info"] = _build_single_proc_data_info(
study, study_proc, proc_samples)

study_info = _build_single_study_info(study, info, study_proc,
proc_samples)
infolist.append(study_info)
return infolist

Expand Down
66 changes: 9 additions & 57 deletions qiita_pet/test/test_study_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,6 @@ class TestHelpers(TestHandlerBase):
database = True

def setUp(self):
self.single_exp = {
'study_id': 1,
'status': 'private',
'study_abstract':
'This is a preliminary study to examine the microbiota '
'associated with the Cannabis plant. Soils samples '
'from the bulk soil, soil associated with the roots, '
'and the rhizosphere were extracted and the DNA '
'sequenced. Roots from three independent plants of '
'different strains were examined. These roots were '
'obtained November 11, 2011 from plants that had been '
'harvested in the summer. Future studies will attempt '
'to analyze the soils and rhizospheres from the same '
'location at different time points in the plant '
'lifecycle.',
'metadata_complete': True,
'study_title':
'Identification of the Microbiomes for Cannabis Soils',
'num_raw_data': 4,
'number_samples_collected': 27,
'shared':
'<a target="_blank" href="mailto:shared@foo.bar">Shared</a>',
'pmid': '<a target="_blank" href="http://www.ncbi.nlm.nih.gov/'
'pubmed/123456">123456</a>, <a target="_blank" href="http:'
'//www.ncbi.nlm.nih.gov/pubmed/7891011">7891011</a>',
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">'
'PIDude</a>'
}
self.proc_data_exp = [{
'pid': 1,
'processed_date': '2012-10-01 09:30:27',
Expand All @@ -66,9 +38,9 @@ def setUp(self):
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
}]
self.exp = [{
self.single_exp = {
'study_id': 1,
'status': 'public',
'status': 'private',
'study_abstract':
'This is a preliminary study to examine the microbiota '
'associated with the Cannabis plant. Soils samples '
Expand All @@ -93,30 +65,9 @@ def setUp(self):
'//www.ncbi.nlm.nih.gov/pubmed/7891011">7891011</a>',
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">'
'PIDude</a>',
'proc_data_info': [{
'pid': 1,
'processed_date': '2012-10-01 09:30:27',
'data_type': '18S',
'algorithm': 'uclust',
'reference_name': 'Greengenes',
'reference_version': '13_8',
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
'similarity': 0.97,
'enable_rev_strand_match': True,
'suppress_new_clusters': True,
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
}]
}]
'proc_data_info': self.proc_data_exp
}
self.exp = [self.single_exp]
super(TestHelpers, self).setUp()

def test_get_shared_links_for_study(self):
Expand All @@ -125,6 +76,8 @@ def test_get_shared_links_for_study(self):
self.assertEqual(obs, exp)

def test_build_single_study_info(self):
study_proc = {1: [1]}
proc_samples = {1: self.proc_data_exp[0]['samples']}
study_info = {
'study_id': 1,
'email': 'test@foo.bar',
Expand All @@ -147,7 +100,8 @@ def test_build_single_study_info(self):
'location at different time points in the plant '
'lifecycle.'
}
obs = _build_single_study_info(Study(1), study_info)
obs = _build_single_study_info(Study(1), study_info, study_proc,
proc_samples)
self.assertEqual(obs, self.single_exp)

def test_build_single_proc_data_info(self):
Expand All @@ -157,12 +111,10 @@ def test_build_single_proc_data_info(self):
self.assertEqual(obs, self.proc_data_exp)

def test_build_study_info(self):
ProcessedData(1).status = 'public'
obs = _build_study_info(User('test@foo.bar'))
self.assertEqual(obs, self.exp)

def test_build_study_info_new_study(self):
ProcessedData(1).status = 'public'
info = {
'timeseries_type_id': 1,
'portal_type_id': 1,
Expand Down