Skip to content

Commit fdfaebc

Browse files
committed
corrections
1 parent 7e991aa commit fdfaebc

File tree

8 files changed

+32
-18
lines changed

8 files changed

+32
-18
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.ipynb_checkpoints
22
.Rhistory
3-
Chapter01/sequence.index
4-
Chapter11/data
3+
__pycache__

Chapter07/Alignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: light
77
# format_version: '1.5'
8-
# jupytext_version: 1.13.6
8+
# jupytext_version: 1.14.0
99
# kernelspec:
1010
# display_name: Python 3 (ipykernel)
1111
# language: python

Chapter10/Clustering.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ def plot_kmeans_pca(trans, kmeans):
116116
plot_kmeans_pca(trans, kmeans4)
117117

118118
pca_predict = my_pca.transform([predict_case])
119-
kmeans.predict(pca_predict)
119+
kmeans4.predict(pca_predict)
120120

121121
last_train = ind_order[-2]
122122
last_train, ind_pop[last_train]
123123

124-
kmeans.predict(trans)[0]
124+
kmeans4.predict(trans)[0]
125+
126+

Chapter10/Decision_Tree.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,27 @@
5050
samples
5151

5252
# + jupyter={"outputs_hidden": false}
53-
trainning_input = samples.iloc[:,:-1]
53+
training_input = samples.iloc[:,:-1]
5454
target = samples.iloc[:,-1].apply(lambda x: 0 if x == 2 else 1)
5555

5656
# + jupyter={"outputs_hidden": false}
5757
clf = tree.DecisionTreeClassifier(max_depth=3)
5858

5959
# + jupyter={"outputs_hidden": false}
60-
clf.fit(trainning_input, target)
60+
clf.fit(training_input, target)
6161

6262
# + jupyter={"outputs_hidden": false}
6363
importances = pd.Series(
6464
clf.feature_importances_ * 100,
65-
index=trainning_input.columns).sort_values(ascending=False)
65+
index=training_input.columns).sort_values(ascending=False)
6666
importances
6767

68+
# + jupyter={"outputs_hidden": false}
69+
100 * clf.score(training_input, target)
70+
6871
# + jupyter={"outputs_hidden": false}
6972
fig, ax = plt.subplots(1, dpi=300)
70-
tree.plot_tree(clf,ax=ax, feature_names=trainning_input.columns, class_names=['Benign', 'Malignant'])
73+
tree.plot_tree(clf,ax=ax, feature_names=training_input.columns, class_names=['Benign', 'Malignant'])
7174
# -
7275

7376

Chapter10/Random_Forest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
target = samples.iloc[:,-1]
5656

5757
# + jupyter={"outputs_hidden": false}
58-
clf = RandomForestClassifier(max_depth=3)
58+
clf = RandomForestClassifier(max_depth=3, n_estimators=200)
5959

6060
# + jupyter={"outputs_hidden": false}
6161
clf.fit(trainning_input, target)
@@ -67,7 +67,9 @@
6767
importances
6868
# -
6969

70-
clf.score(trainning_input, target)
70+
100 * clf.score(trainning_input, target)
71+
72+
7173

7274
for test_size in [0.01, 0.1, 0.2, 0.5, 0.8, 0.9, 0.99]:
7375
X_train, X_test, y_train, y_test = train_test_split(
@@ -77,3 +79,5 @@
7779
score = tclf.score(X_test, y_test)
7880
print(f'{1 - test_size:.1%} {score:.2%}')
7981
# Random number generator
82+
83+

Datasets.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# # Datasets for the book
23
#
34
# Here we provide links to the datasets used in the book.
@@ -13,4 +14,9 @@
1314
# http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/20130502.phase3.sequence.index
1415
#
1516

16-
17+
# # PDB
18+
#
19+
#
20+
# ## Parsing mmCIF files with Biopython
21+
#
22+
# [1TUP.cif](http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=cif&compression=NO&structureId=1TUP)"

docker/Chapter01/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM tiagoantao/bio3
22
MAINTAINER Tiago Antao <[email protected]>
3-
RUN conda create -n bioinformatics-r --clone bionformatics_base
3+
RUN conda create -n bioinformatics_r --clone bionformatics_base
44

5-
RUN conda init bash
6-
RUN conda activate bioinformatics-r; conda install r-ggplot2=3.3.5 r-lazyeval=0.2.2 r-gridextra=2.3 rpy2
7-
CMD conda init bash; conda activate bioinformatics-r; jupyter-lab --ip=0.0.0.0 --no-browser --allow-root --port=9875 --NotebookApp.token='' --NotebookApp.password=''
5+
RUN conda install -n bioinformatics_r r-ggplot2=3.3.5 r-lazyeval=0.2.2 r-gridextra=2.3 rpy2
6+
CMD conda run --no-capture-output -n bioinformatics_r jupyter-lab --ip=0.0.0.0 --no-browser --allow-root --port=9875 --NotebookApp.token='' --NotebookApp.password=''

docker/main/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ RUN git clone https://github.com/PacktPublishing/Bioinformatics-with-Python-Cook
1010
#RUN conda upgrade -n base conda
1111
RUN conda config --add channels conda-forge
1212
RUN conda config --add channels bioconda
13-
RUN conda create -n bionformatics_base --file /Bioinformatics-with-Python-Cookbook-third-Edition/Chapter01/bioinformatics_base.txt
13+
RUN conda create -n bioinformatics_base --file /Bioinformatics-with-Python-Cookbook-third-Edition/Chapter01/bioinformatics_base.txt
14+
RUN pip install pyarrow==8.0.0
1415
RUN conda init bash
1516

1617
EXPOSE 9875
1718

1819
WORKDIR /Bioinformatics-with-Python-Cookbook-third-Edition
1920

2021
RUN echo setterm -foreground magenta >> /etc/bash.bashrc
21-
CMD conda activate bioinformatics_base; jupyter-lab --ip=0.0.0.0 --no-browser --allow-root --port=9875 --NotebookApp.token='' --NotebookApp.password=''
22+
CMD conda run --no-capture-output -n bioinformatics_base jupyter-lab --ip=0.0.0.0 --no-browser --allow-root --port=9875 --NotebookApp.token='' --NotebookApp.password=''

0 commit comments

Comments
 (0)