-
Notifications
You must be signed in to change notification settings - Fork 10
Yingying_Exercise 7 #9
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
Open
yunluyingying
wants to merge
10
commits into
lyy005:master
Choose a base branch
from
yunluyingying:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
82ee9e5
yingying
yunluyingying f9a0a11
yingying
yunluyingying 2f0ac49
yingying
yunluyingying 4e81683
yingying
yunluyingying ea48fc4
yingying
yunluyingying caaddc2
yingying
yunluyingying d66b2f9
yingying
yunluyingying 804b5c5
Delete Plot_Question 3_2.png
yunluyingying 89b4262
yingying
yunluyingying 2228238
yingying
yunluyingying 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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Question 1 | ||
| # I am not a big fan of plotnine, so I used the matplotlib and seaborn, which I think are a little bit more popular. | ||
| import pandas as pd | ||
| import matplotlib.pyplot as plt | ||
| data=pd.read_table('/Users/chenyingying/Documents/Intro_Biocom_ND_319_Tutorial7/Lecture11.fasta',header=None) | ||
| df=pd.DataFrame(columns=['ID','Length','%GC']) | ||
| df['ID']=range(1,101,1) | ||
| for i in range(0,100,1): | ||
| temp=data.iloc[i*2+1,0] | ||
| df.iloc[i,1]=len(temp) | ||
| df.iloc[i,2]=100*(temp.count('C')+temp.count('G'))/len(temp) | ||
| fig=plt.figure(figsize=(8,8)) | ||
| fig.suptitle('Histogram') | ||
| ax1 = fig.add_subplot(121) | ||
| ax1=plt.hist(df['Length'],edgecolor="black") | ||
| plt.title('Sequence Length') | ||
| ax2 = fig.add_subplot(122) | ||
| ax2=plt.hist(df['%GC'],edgecolor="black") | ||
| plt.title('%GC') | ||
| # Question 2 | ||
| import pandas as pd | ||
| import seaborn as sns | ||
| data_2=pd.read_table('/Users/chenyingying/Documents/Intro_Biocom_ND_319_Tutorial7/LakeGPP.txt',sep='\t') | ||
| sns.lmplot(x="TP_mgm3", y="GPP_mmolm3d", data=data_2,size=8) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job |
||
| #Question 3 | ||
| import pandas as pd | ||
| import matplotlib.pyplot as plt | ||
| from sklearn.preprocessing import LabelEncoder | ||
| import seaborn as sns | ||
| data_3=pd.read_table('/Users/chenyingying/Documents/Intro_Biocom_ND_319_Tutorial7/data.txt',sep=',') | ||
| le=LabelEncoder() | ||
| le.fit(data_3['region']) | ||
| data_3['Index']=le.transform(data_3['region']) | ||
| # Barplot of mean | ||
| fig=plt.figure(figsize=(8,8)) | ||
| data_3.groupby('region')['observations'].mean().plot.bar() | ||
| plt.title('Barplot of mean') | ||
| # Scatter plot | ||
| f2=sns.pairplot(x_vars=["Index"], y_vars=["observations"], data=data_3, hue="region",size=8) | ||
| f2.set(xticks=[0,1,2,3]) | ||
| f2.set(xticklabels=['east','north','south','west']) | ||
| f2.set(xlabel='region') | ||
| f2.set(title='Scatter plot') | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job. In plotnine, you can make jitter plot with command: |
||
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,26 @@ | ||
| "TP_mgm3" "GPP_mmolm3d" | ||
| 39.8 34.2 | ||
| 9.4 11.8 | ||
| 41.5 74.9 | ||
| 55.9 36.9 | ||
| 13.2 3.8 | ||
| 17.9 34.4 | ||
| 4.4 6.1 | ||
| 7.1 10 | ||
| 23.2 25.5 | ||
| 19.9 7.8 | ||
| 20.2 13.3 | ||
| 34.3 15 | ||
| 34.9 77.9 | ||
| 105.3 144.3 | ||
| 18.6 35 | ||
| 78.3 47.9 | ||
| 15.3 7.1 | ||
| 21.3 60.8 | ||
| 28 28.3 | ||
| 34 13.3 | ||
| 42.5 30.5 | ||
| 29.3 49.1 | ||
| 25.2 7.3 | ||
| 28.1 32.1 | ||
| 13.8 29.7 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Good job