-
Notifications
You must be signed in to change notification settings - Fork 81
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
8 collapse samples #169
Merged
Merged
8 collapse samples #169
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6d47355
Merge branch '5-alpha_diversity' into 8-collapse_samples
wasade 8abbd9d
Merge branch '6-beta_diversity' into 8-collapse_samples
wasade dfe0ca7
Merge branch '7-taxonomy_summaries' into 8-collapse_samples
wasade 3b9335d
get travis to run collapse
wasade 3da1630
updated chp refs for 8
wasade 4629d96
added collapse samples
wasade 4944d16
Merge branch 'master' of github.com:qiime/American-Gut into 8-collaps…
wasade 323c9f4
Merge branch 'master' of github.com:qiime/American-Gut into 8-collaps…
wasade File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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,211 @@ | ||
Some of the per-results figures require various slices and perspectives of the data. This notebook performs these necessary additional summarizations. | ||
|
||
```python | ||
>>> import os | ||
... | ||
>>> import americangut.notebook_environment as agenv | ||
>>> import americangut.util as agu | ||
... | ||
>>> import qiime_default_reference as qdr | ||
... | ||
>>> chp_path = agenv.activate('8') | ||
``` | ||
|
||
Let's make sure we have the paths we need. | ||
|
||
```python | ||
>>> ag_100nt_biom = agu.get_existing_path(agenv.paths['ag-100nt-biom']) | ||
>>> ag_cleaned_md = agu.get_existing_path(agenv.paths['ag-cleaned-md']) | ||
``` | ||
|
||
And let's setup all the paths that we're going to create. | ||
|
||
```python | ||
>>> ag_100nt_1k_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-biom']) | ||
>>> ag_100nt_1k_fecal_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-fecal-biom']) | ||
>>> ag_100nt_1k_skin_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-skin-biom']) | ||
>>> ag_100nt_1k_oral_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-oral-biom']) | ||
... | ||
>>> ag_100nt_1k_fecal_sex_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-fecal-sex-biom']) | ||
>>> ag_100nt_1k_fecal_diet_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-fecal-diet-biom']) | ||
>>> ag_100nt_1k_fecal_age_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-fecal-age-biom']) | ||
>>> ag_100nt_1k_fecal_bmi_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-fecal-bmi-biom']) | ||
... | ||
>>> ag_100nt_1k_oral_sex_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-oral-sex-biom']) | ||
>>> ag_100nt_1k_oral_diet_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-oral-diet-biom']) | ||
>>> ag_100nt_1k_oral_age_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-oral-age-biom']) | ||
>>> ag_100nt_1k_oral_flossing_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-oral-flossing-biom']) | ||
... | ||
>>> ag_100nt_1k_skin_sex_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-skin-sex-biom']) | ||
>>> ag_100nt_1k_skin_cosmetics_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-skin-cosmetics-biom']) | ||
>>> ag_100nt_1k_skin_age_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-skin-age-biom']) | ||
>>> ag_100nt_1k_skin_hand_biom = agu.get_new_path(agenv.paths['ag-100nt-1k-skin-hand-biom']) | ||
... | ||
>>> # A file path that was necessary for the system call but not used after the fact | ||
>>> ignored = 'foo' | ||
``` | ||
|
||
First, we're going to operate on rarefied data again. | ||
|
||
```python | ||
>>> depth = agenv.get_rarefaction_depth() | ||
``` | ||
|
||
```python | ||
>>> !single_rarefaction.py -i $ag_100nt_biom \ | ||
... -o $ag_100nt_1k_biom \ | ||
... -d $depth | ||
``` | ||
|
||
Next, we're going to partition the data into per-body site tables. | ||
|
||
```python | ||
>>> !filter_samples_from_otu_table.py -i $ag_100nt_1k_biom \ | ||
... -o $ag_100nt_1k_fecal_biom \ | ||
... -m $ag_cleaned_md \ | ||
... -s "SIMPLE_BODY_SITE:FECAL" | ||
``` | ||
|
||
```python | ||
>>> !filter_samples_from_otu_table.py -i $ag_100nt_1k_biom \ | ||
... -o $ag_100nt_1k_skin_biom \ | ||
... -m $ag_cleaned_md \ | ||
... -s "SIMPLE_BODY_SITE:SKIN" | ||
``` | ||
|
||
```python | ||
>>> !filter_samples_from_otu_table.py -i $ag_100nt_1k_biom \ | ||
... -o $ag_100nt_1k_oral_biom \ | ||
... -m $ag_cleaned_md \ | ||
... -s "SIMPLE_BODY_SITE:ORAL" | ||
``` | ||
|
||
Finally, within each body site, we're going to collapse over categories of interest. | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_fecal_sex_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_fecal_biom \ | ||
... --collapse_fields "SEX" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_fecal_diet_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_fecal_biom \ | ||
... --collapse_fields "DIET_TYPE" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_fecal_age_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_fecal_biom \ | ||
... --collapse_fields "AGE_CAT" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_fecal_bmi_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_fecal_biom \ | ||
... --collapse_fields "BMI_CAT" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_oral_sex_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_oral_biom \ | ||
... --collapse_fields "SEX" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_oral_diet_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_oral_biom \ | ||
... --collapse_fields "DIET_TYPE" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_oral_age_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_oral_biom \ | ||
... --collapse_fields "AGE_CAT" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_oral_flossing_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_oral_biom \ | ||
... --collapse_fields "FLOSSING_FREQUENCY" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_skin_sex_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_skin_biom \ | ||
... --collapse_fields "SEX" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_skin_cosmetics_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_skin_biom \ | ||
... --collapse_fields "COSMETICS_FREQUENCY" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_skin_age_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_skin_biom \ | ||
... --collapse_fields "AGE_CAT" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
```python | ||
>>> !collapse_samples.py -m $ag_cleaned_md \ | ||
... --output_biom_fp $ag_100nt_1k_skin_hand_biom \ | ||
... --normalize \ | ||
... -b $ag_100nt_1k_skin_biom \ | ||
... --collapse_fields "DOMINANT_HAND" \ | ||
... --output_mapping_fp $ignored | ||
``` | ||
|
||
As usual, let's make sure we have files. | ||
|
||
```python | ||
>>> assert os.stat(ag_100nt_1k_fecal_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_skin_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_oral_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_fecal_sex_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_fecal_diet_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_fecal_age_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_fecal_bmi_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_oral_sex_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_oral_diet_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_oral_age_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_oral_flossing_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_skin_sex_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_skin_hand_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_skin_age_biom).st_size > 0 | ||
>>> assert os.stat(ag_100nt_1k_skin_cosmetics_biom).st_size > 0 | ||
``` |
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.
Is this a placeholder for future use? It's only set here
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.
Can add a comment if you'd like, but there was a file path that was necessary for the call but not used after the fact
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.
Ah, yeah a comment would be good.