-
Couldn't load subscription status.
- Fork 79
Add specimen_id attribute to the study object #2649
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
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a800073
Add specimen identifier to the study table
ElDeveloper d8d92ce
Add specimen_id_column to study object
ElDeveloper b0862d9
ENH: Add unique_columns method to template objects
ElDeveloper 7f0258c
Remove maxDiff
ElDeveloper 4415834
ENH: Send response data back to the client
ElDeveloper c97df88
Make study's specimen_id_column nullable
ElDeveloper 24f4f90
Generalize study_tags_patch_request to be study-wide
ElDeveloper 0d5a9b9
Add Study patch handler
ElDeveloper 4739a7a
Update UI with the new patch handlers
ElDeveloper 3e6f3a6
Add missing attribute
ElDeveloper fe192b7
ENH: Add prepopulate of the UI
ElDeveloper ea0aa85
ENH: Add checks to prevent deletion of a specimen_id column
ElDeveloper 59d9231
DOC: Delete comment
ElDeveloper c03c608
TST: Fix broken tests
ElDeveloper e7f96f1
PERF: Don't precompute unique columns
ElDeveloper 2158765
Merge branch 'dev' of git://github.com/biocore/qiita into specimen-id
ElDeveloper 94dd6ba
ENH: Add help and make specimen column deselectable
ElDeveloper f35fbd2
ENH: Sort column names
ElDeveloper 170275f
BUG: Fix column width for update button
ElDeveloper 4f0e112
DOC: Remove reference to labman
ElDeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -647,13 +647,24 @@ def delete_column(self, column_name): | |
| If the `column_name` doesn't exist | ||
| QiitaDBOperationNotPermittedError | ||
| If a the info file can't be updated | ||
| If the column_name is selected as a specimen_id_column in the | ||
| study. | ||
| """ | ||
| if column_name not in self.categories(): | ||
| raise qdb.exceptions.QiitaDBColumnError( | ||
| "'%s' not in info file %d" % (column_name, self._id)) | ||
| if not self.can_be_updated(columns={column_name}): | ||
| raise qdb.exceptions.QiitaDBOperationNotPermittedError( | ||
| '%s cannot be deleted' % column_name) | ||
|
|
||
| # if a tube identifier column is selected disallow its deletion | ||
| specimen_id_column = qdb.study.Study(self.study_id).specimen_id_column | ||
| if specimen_id_column == column_name: | ||
| raise qdb.exceptions.QiitaDBOperationNotPermittedError( | ||
| '"%s" cannot be deleted, this column is currently selected' | ||
| ' as the tube identifier (specimen_id_column)' % | ||
| column_name) | ||
|
|
||
| with qdb.sql_connection.TRN: | ||
| sql = 'ALTER TABLE qiita.%s%d DROP COLUMN %s' % ( | ||
| self._table_prefix, self._id, column_name) | ||
|
|
@@ -1516,3 +1527,17 @@ def validate(self, restriction_dict): | |
| "columns:\n\t%s.\nSee the Templates tutorial for a description" | ||
| " of these fields." % ";\n\t".join(warning_msg), | ||
| qdb.exceptions.QiitaDBWarning) | ||
|
|
||
| def unique_columns(self): | ||
| """Get the unique columns in a template object | ||
|
|
||
| Returns | ||
| ------- | ||
| set of str | ||
| Returns a set of the columns that are unique in a template object. | ||
| """ | ||
|
|
||
| df = self.to_dataframe() | ||
|
|
||
| n = len(df) | ||
| return {k for k, v in df.nunique().items() if v == n} | ||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- August 22, 2018 | ||
| -- add specimen_id_column to study table (needed to plate samples in labman) | ||
|
|
||
| ALTER TABLE qiita.study ADD specimen_id_column varchar(256); | ||
|
|
||
| COMMENT ON COLUMN qiita.study.specimen_id_column IS 'The name of the column that describes the specimen identifiers (such as what is written on the tubes).'; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna be extremely slow for large info files. Examples from the real system:
As you can imagine something blocking for 1min 16s is not desirable and more in the sample info page which is pretty common and we normally expect fasts replies.
Options: