Skip to content

Start improving search #988

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

Closed
wants to merge 19 commits into from
Closed
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
add samples property to ProcessedData object
  • Loading branch information
squirrelo committed Mar 16, 2015
commit 8ab20c7e14604a6e1c6ecb2c01b49984f07926ad
15 changes: 15 additions & 0 deletions qiita_db/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,21 @@ def study(self):
"processed_data_id=%s".format(self._study_processed_table),
[self._id])[0]

@property
def samples(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this function to make use of a single SQL query. Right now is executing at least 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, this is a vestige of the old way of finding processed data samples. Do we want to keep this function still?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you don't need this property, why are you adding it here? Remove then.

"""Returns samples available in this processed data

Returns
-------
generator of str
Sample_ids available according to the prep template
"""
# Get the samples available for the prep template
pid = PreprocessedData(self.preprocessed_data).prep_template
conn_handler = SQLConnectionHandler()
sql = "SELECT sample_id FROM qiita.prep_{0}".format(pid)
return (x[0] for x in conn_handler.execute_fetchall(sql))

def data_type(self, ret_id=False):
"""Returns the data_type or data_type_id

Expand Down