initial commit
commit
5ba788a7a0
Binary file not shown.
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# DeepDrug3D"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Create pocket lists\n",
|
||||
"4 pockets are created :\n",
|
||||
" + control\n",
|
||||
" + steroid\n",
|
||||
" + heme\n",
|
||||
" + nucleotide"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"control.list\", \"r\") as filin:\n",
|
||||
" control = filin.read()\n",
|
||||
"control = control.split(\"\\n\")\n",
|
||||
"control.pop()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"steroid.list\", \"r\") as filin:\n",
|
||||
" steroid = filin.read()\n",
|
||||
"steroid = steroid.split(\"\\n\")\n",
|
||||
"steroid.pop()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"heme.list\", \"r\") as filin:\n",
|
||||
" heme = filin.read()\n",
|
||||
"heme = heme.split(\"\\n\")\n",
|
||||
"heme.pop()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"nucleotide.list\", \"r\") as filin:\n",
|
||||
" nucleotide = filin.read()\n",
|
||||
"nucleotide = nucleotide.split(\"\\n\")\n",
|
||||
"nucleotide.pop()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,387 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import keras\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"from sklearn.preprocessing import LabelEncoder\n",
|
||||
"from keras.models import Sequential\n",
|
||||
"from keras.layers import Dense, Flatten, TimeDistributed\n",
|
||||
"from keras import Input, Model\n",
|
||||
"from keras.layers import add, Activation\n",
|
||||
"#from keras.utils import plot_model # Needs pydot.\n",
|
||||
"from keras.layers import Conv1D, AveragePooling1D"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def file_to_dataframe(filename):\n",
|
||||
" \"\"\"\n",
|
||||
" Returns a pandas dataframe ncol = len(longest_sequence),\n",
|
||||
" nrow = number of sequences\n",
|
||||
" \n",
|
||||
" Arguments :\n",
|
||||
" - filename : str\n",
|
||||
" path to file\n",
|
||||
" Takes a path to a files containing any sequences, must be 1 sequence\n",
|
||||
" per line.\n",
|
||||
" \n",
|
||||
" Sequences shorter than longest_sequence are completed with '0' char.\n",
|
||||
" \"\"\"\n",
|
||||
" filin = open(filename)\n",
|
||||
" fastas0 = filin.read()\n",
|
||||
" fastas0 = fastas0.split('\\n')\n",
|
||||
" nmax = len(max(fastas0, key=len))\n",
|
||||
" fastas = []\n",
|
||||
" for fasta in fastas0:\n",
|
||||
" fastas.append(fasta + (nmax - len(fasta)) * '0')\n",
|
||||
" \n",
|
||||
" seqs = pd.DataFrame(index=range(len(fastas)), columns=range(nmax))\n",
|
||||
" \n",
|
||||
" for i, fasta in enumerate(fastas):\n",
|
||||
" seqs.loc[i] = pd.Series(list(fasta))\n",
|
||||
" \n",
|
||||
" return seqs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def model_sequential(): # créer un objet modèle\n",
|
||||
" \"\"\"\n",
|
||||
" Return a simple sequentiel model\n",
|
||||
" \n",
|
||||
" Returns :\n",
|
||||
" - model : keras.Model\n",
|
||||
" \"\"\"\n",
|
||||
" inputs = Input(shape=(759,21)) # 759 aa, 21 car onehot\n",
|
||||
" conv_1 = Conv1D(25, (5), padding=\"same\", activation=\"relu\",\n",
|
||||
" kernel_initializer=\"he_normal\")(inputs)\n",
|
||||
" conv_2 = Conv1D(35, (5), padding=\"same\", activation=\"relu\",\n",
|
||||
" kernel_initializer=\"he_normal\")(conv_1)\n",
|
||||
" output = TimeDistributed(Dense(4, activation='softmax'))(conv_2)\n",
|
||||
" model = Model(inputs=inputs, outputs=output)\n",
|
||||
" print(model.summary)\n",
|
||||
" model.compile(optimizer=\"adam\", loss=\"categorical_crossentropy\",\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
" return model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def char_to_onehot(df, ncol=0):\n",
|
||||
" \"\"\"\n",
|
||||
" Returns the given str-encoded dataframe into a onehot encoded dataframe as an array object\n",
|
||||
" \n",
|
||||
" * Arguments:\n",
|
||||
" - df : pandas.DataFrame, the dataframe containing the sequences, cell \n",
|
||||
" containing strings.\n",
|
||||
" - ncol : int, Optionnal. the number of col used to build the LabelEncoder\n",
|
||||
" which will transform the df cells into int(categorical).\n",
|
||||
" \"\"\"\n",
|
||||
" classes = LabelEncoder()\n",
|
||||
" classes.fit(df[ncol])\n",
|
||||
" df_categorical = df.apply(func=classes.transform, axis=0)\n",
|
||||
" df_onehot = keras.utils.to_categorical(df_categorical)\n",
|
||||
" return df_onehot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def true_accuracy(predictions, onehot_Y_test):\n",
|
||||
" \"\"\"\n",
|
||||
" Computes the accuracy ignoring the \"0\" of the DataFrame.\n",
|
||||
" \n",
|
||||
" * Arguments :\n",
|
||||
" - predictions : numpy.array, output of the model, onehot encoded.\n",
|
||||
" - onehot_Y_test : numpy.array, the true values, onehot encoded.\n",
|
||||
" \n",
|
||||
" * Returns :\n",
|
||||
" - acc_coor : int, accuracy corrected, not considering '0' predictions\n",
|
||||
" \"\"\"\n",
|
||||
" tp = 0\n",
|
||||
" tn = 0\n",
|
||||
" fn = 0\n",
|
||||
" fp = 0\n",
|
||||
" tot = 0\n",
|
||||
"\n",
|
||||
" for i in range(len(predictions)):\n",
|
||||
" for j in range(len(predictions[i])):\n",
|
||||
" if onehot_Y_test[i, j, 3] != 0.:\n",
|
||||
" predmax = -1\n",
|
||||
" predict_class = -1\n",
|
||||
" true_class = -1\n",
|
||||
" for k in range(len(predictions[i, j])):\n",
|
||||
" if predmax < predictions[i, j, k]:\n",
|
||||
" predmax = predictions[i, j, k]\n",
|
||||
" predict_class = k\n",
|
||||
" if onehot_Y_test[i, j, k] == 1.:\n",
|
||||
" true_class = k\n",
|
||||
" if predict_class == true_class:\n",
|
||||
" tp = tp+1\n",
|
||||
" tot = tot + 1\n",
|
||||
" acc_corr = tp/tot*100\n",
|
||||
" return acc_corr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create dataframe from files\n",
|
||||
"fasta = file_to_dataframe(\"data/train.fasta\")\n",
|
||||
"fasta = fasta.replace(\"X\", \"A\") # 'X' in fasta sequences are replace with 'A'\n",
|
||||
"dssp = file_to_dataframe(\"data/train.dssp\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Writes Dataframes to csv files\n",
|
||||
"fasta.to_csv(path_or_buf=\"data/train_fasta.csv\")\n",
|
||||
"dssp.to_csv(path_or_buf=\"data/train_dssp.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To onehot\n",
|
||||
"fasta_onehot = char_to_onehot(fasta, 0)\n",
|
||||
"dssp_onehot = char_to_onehot(dssp, 2)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Divides the dataset in train and test subsets\n",
|
||||
"fasta_train = fasta_onehot[0:1000,]\n",
|
||||
"dssp_train = dssp_onehot[0:1000,]\n",
|
||||
"fasta_test = fasta_onehot[1000:,]\n",
|
||||
"dssp_test = dssp_onehot[1000:]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<bound method Network.summary of <keras.engine.training.Model object at 0x7f68cfb7b0d0>>\n",
|
||||
"Epoch 1/30\n",
|
||||
"1000/1000 [==============================] - 2s 2ms/step - loss: 0.7467 - acc: 0.7447\n",
|
||||
"Epoch 2/30\n",
|
||||
"1000/1000 [==============================] - 1s 974us/step - loss: 0.2610 - acc: 0.8944\n",
|
||||
"Epoch 3/30\n",
|
||||
"1000/1000 [==============================] - 1s 964us/step - loss: 0.2053 - acc: 0.9086\n",
|
||||
"Epoch 4/30\n",
|
||||
"1000/1000 [==============================] - 1s 994us/step - loss: 0.1899 - acc: 0.9154\n",
|
||||
"Epoch 5/30\n",
|
||||
"1000/1000 [==============================] - 1s 986us/step - loss: 0.1817 - acc: 0.9193\n",
|
||||
"Epoch 6/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1790 - acc: 0.9201\n",
|
||||
"Epoch 7/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1759 - acc: 0.9217\n",
|
||||
"Epoch 8/30\n",
|
||||
"1000/1000 [==============================] - 1s 960us/step - loss: 0.1743 - acc: 0.9222\n",
|
||||
"Epoch 9/30\n",
|
||||
"1000/1000 [==============================] - 1s 977us/step - loss: 0.1735 - acc: 0.9226\n",
|
||||
"Epoch 10/30\n",
|
||||
"1000/1000 [==============================] - 1s 963us/step - loss: 0.1727 - acc: 0.9228\n",
|
||||
"Epoch 11/30\n",
|
||||
"1000/1000 [==============================] - 1s 999us/step - loss: 0.1712 - acc: 0.9239\n",
|
||||
"Epoch 12/30\n",
|
||||
"1000/1000 [==============================] - 1s 963us/step - loss: 0.1702 - acc: 0.9243\n",
|
||||
"Epoch 13/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1695 - acc: 0.9249\n",
|
||||
"Epoch 14/30\n",
|
||||
"1000/1000 [==============================] - 1s 978us/step - loss: 0.1687 - acc: 0.9252\n",
|
||||
"Epoch 15/30\n",
|
||||
"1000/1000 [==============================] - 1s 981us/step - loss: 0.1678 - acc: 0.9257\n",
|
||||
"Epoch 16/30\n",
|
||||
"1000/1000 [==============================] - 1s 985us/step - loss: 0.1669 - acc: 0.9260\n",
|
||||
"Epoch 17/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1661 - acc: 0.9267\n",
|
||||
"Epoch 18/30\n",
|
||||
"1000/1000 [==============================] - 1s 1000us/step - loss: 0.1656 - acc: 0.9269\n",
|
||||
"Epoch 19/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1650 - acc: 0.9273\n",
|
||||
"Epoch 20/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1640 - acc: 0.9277\n",
|
||||
"Epoch 21/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1637 - acc: 0.9281\n",
|
||||
"Epoch 22/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1630 - acc: 0.9285\n",
|
||||
"Epoch 23/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1621 - acc: 0.9289\n",
|
||||
"Epoch 24/30\n",
|
||||
"1000/1000 [==============================] - 1s 992us/step - loss: 0.1619 - acc: 0.9289\n",
|
||||
"Epoch 25/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1616 - acc: 0.9291\n",
|
||||
"Epoch 26/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1616 - acc: 0.9291\n",
|
||||
"Epoch 27/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1608 - acc: 0.9296\n",
|
||||
"Epoch 28/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1604 - acc: 0.9297\n",
|
||||
"Epoch 29/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1601 - acc: 0.9298\n",
|
||||
"Epoch 30/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1597 - acc: 0.9300\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<keras.callbacks.History at 0x7f68cfcf6050>"
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"model = model_sequential()\n",
|
||||
"model.fit(fasta_train, dssp_train, epochs=30, batch_size=30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"predictions = model.predict(fasta_test, batch_size=30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"accuracy : 68.06409539780138\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"accuracy : {}\".format(true_accuracy(predictions, dssp_test)))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# DeepDrug3D"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Create pocket lists\n",
|
||||
"4 pockets are created :\n",
|
||||
" + control\n",
|
||||
" + steroid\n",
|
||||
" + heme\n",
|
||||
" + nucleotide"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"''"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"with open(\"control.list\", \"r\") as filin:\n",
|
||||
" control = filin.read()\n",
|
||||
"control = control.split(\"\\n\")\n",
|
||||
"control.pop()\n",
|
||||
"\n",
|
||||
"with open(\"steroid.list\", \"r\") as filin:\n",
|
||||
" steroid = filin.read()\n",
|
||||
"steroid = steroid.split(\"\\n\")\n",
|
||||
"steroid.pop()\n",
|
||||
"\n",
|
||||
"with open(\"heme.list\", \"r\") as filin:\n",
|
||||
" heme = filin.read()\n",
|
||||
"heme = heme.split(\"\\n\")\n",
|
||||
"heme.pop()\n",
|
||||
"\n",
|
||||
"with open(\"nucleotide.list\", \"r\") as filin:\n",
|
||||
" nucleotide = filin.read()\n",
|
||||
"nucleotide = nucleotide.split(\"\\n\")\n",
|
||||
"nucleotide.pop()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
name: projet-dl
|
||||
channels:
|
||||
- defaults
|
||||
dependencies:
|
||||
- _libgcc_mutex=0.1=main
|
||||
- attrs=19.1.0=py37_1
|
||||
- backcall=0.1.0=py37_0
|
||||
- blas=1.0=mkl
|
||||
- bleach=3.1.0=py37_0
|
||||
- ca-certificates=2019.5.15=1
|
||||
- certifi=2019.6.16=py37_1
|
||||
- dbus=1.13.6=h746ee38_0
|
||||
- decorator=4.4.0=py37_1
|
||||
- defusedxml=0.6.0=py_0
|
||||
- entrypoints=0.3=py37_0
|
||||
- expat=2.2.6=he6710b0_0
|
||||
- fontconfig=2.13.0=h9420a91_0
|
||||
- freetype=2.9.1=h8a8886c_1
|
||||
- glib=2.56.2=hd408876_0
|
||||
- gmp=6.1.2=h6c8ec71_1
|
||||
- gst-plugins-base=1.14.0=hbbd80ab_1
|
||||
- gstreamer=1.14.0=hb453b48_1
|
||||
- icu=58.2=h9c2bf20_1
|
||||
- intel-openmp=2019.4=243
|
||||
- ipykernel=5.1.2=py37h39e3cac_0
|
||||
- ipython=7.8.0=py37h39e3cac_0
|
||||
- ipython_genutils=0.2.0=py37_0
|
||||
- ipywidgets=7.5.1=py_0
|
||||
- jedi=0.15.1=py37_0
|
||||
- jinja2=2.10.1=py37_0
|
||||
- jpeg=9b=h024ee3a_2
|
||||
- json5=0.8.5=py_0
|
||||
- jsonschema=3.0.2=py37_0
|
||||
- jupyter=1.0.0=py37_7
|
||||
- jupyter_client=5.3.1=py_0
|
||||
- jupyter_console=6.0.0=py37_0
|
||||
- jupyter_core=4.5.0=py_0
|
||||
- jupyterlab=1.1.3=pyhf63ae98_0
|
||||
- jupyterlab_server=1.0.0=py_1
|
||||
- libedit=3.1.20181209=hc058e9b_0
|
||||
- libffi=3.2.1=hd88cf55_4
|
||||
- libgcc-ng=9.1.0=hdf63c60_0
|
||||
- libgfortran-ng=7.3.0=hdf63c60_0
|
||||
- libpng=1.6.37=hbc83047_0
|
||||
- libsodium=1.0.16=h1bed415_0
|
||||
- libstdcxx-ng=9.1.0=hdf63c60_0
|
||||
- libuuid=1.0.3=h1bed415_2
|
||||
- libxcb=1.13=h1bed415_1
|
||||
- libxml2=2.9.9=hea5a465_1
|
||||
- markupsafe=1.1.1=py37h7b6447c_0
|
||||
- mistune=0.8.4=py37h7b6447c_0
|
||||
- mkl=2019.4=243
|
||||
- mkl-service=2.3.0=py37he904b0f_0
|
||||
- mkl_fft=1.0.14=py37ha843d7b_0
|
||||
- mkl_random=1.0.2=py37hd81dba3_0
|
||||
- nbconvert=5.5.0=py_0
|
||||
- nbformat=4.4.0=py37_0
|
||||
- ncurses=6.1=he6710b0_1
|
||||
- notebook=6.0.1=py37_0
|
||||
- numpy=1.16.5=py37h7e9f1db_0
|
||||
- numpy-base=1.16.5=py37hde5b4d6_0
|
||||
- openssl=1.1.1d=h7b6447c_1
|
||||
- pandas=0.25.1=py37he6710b0_0
|
||||
- pandoc=2.2.3.2=0
|
||||
- pandocfilters=1.4.2=py37_1
|
||||
- parso=0.5.1=py_0
|
||||
- pcre=8.43=he6710b0_0
|
||||
- pexpect=4.7.0=py37_0
|
||||
- pickleshare=0.7.5=py37_0
|
||||
- pip=19.2.2=py37_0
|
||||
- prometheus_client=0.7.1=py_0
|
||||
- prompt_toolkit=2.0.9=py37_0
|
||||
- ptyprocess=0.6.0=py37_0
|
||||
- pygments=2.4.2=py_0
|
||||
- pyqt=5.9.2=py37h05f1152_2
|
||||
- pyrsistent=0.14.11=py37h7b6447c_0
|
||||
- python=3.7.4=h265db76_1
|
||||
- python-dateutil=2.8.0=py37_0
|
||||
- pytz=2019.2=py_0
|
||||
- pyzmq=18.1.0=py37he6710b0_0
|
||||
- qt=5.9.7=h5867ecd_1
|
||||
- qtconsole=4.5.5=py_0
|
||||
- readline=7.0=h7b6447c_5
|
||||
- scipy=1.3.1=py37h7c811a0_0
|
||||
- send2trash=1.5.0=py37_0
|
||||
- setuptools=41.0.1=py37_0
|
||||
- sip=4.19.8=py37hf484d3e_0
|
||||
- six=1.12.0=py37_0
|
||||
- sqlite=3.29.0=h7b6447c_0
|
||||
- terminado=0.8.2=py37_0
|
||||
- testpath=0.4.2=py37_0
|
||||
- tk=8.6.8=hbc83047_0
|
||||
- tornado=6.0.3=py37h7b6447c_0
|
||||
- traitlets=4.3.2=py37_0
|
||||
- wcwidth=0.1.7=py37_0
|
||||
- webencodings=0.5.1=py37_1
|
||||
- wheel=0.33.4=py37_0
|
||||
- widgetsnbextension=3.5.1=py37_0
|
||||
- xz=5.2.4=h14c3975_4
|
||||
- zeromq=4.3.1=he6710b0_3
|
||||
- zlib=1.2.11=h7b6447c_3
|
||||
- pip:
|
||||
- biopython==1.74
|
||||
- cycler==0.10.0
|
||||
- griddataformats==0.5.0
|
||||
- gsd==1.8.1
|
||||
- joblib==0.13.2
|
||||
- kiwisolver==1.1.0
|
||||
- matplotlib==3.1.1
|
||||
- mdanalysis==0.20.1
|
||||
- mmtf-python==1.1.2
|
||||
- mock==3.0.5
|
||||
- msgpack==0.6.1
|
||||
- networkx==2.3
|
||||
- pbxplore==1.3.8
|
||||
- pillow==6.1.0
|
||||
- pyclustering==0.9.1
|
||||
- pyparsing==2.4.2
|
||||
- keras
|
||||
- sklearn
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,596 @@
|
|||
101mA00
|
||||
1a2sA00
|
||||
1a4eD00
|
||||
1a4fA00
|
||||
1a4fB00
|
||||
1a56A00
|
||||
1a7vA00
|
||||
1a9wB00
|
||||
1akkA00
|
||||
1allA00
|
||||
1aqeA00
|
||||
1ashA00
|
||||
1b7vA00
|
||||
1b82A00
|
||||
1b8dA01
|
||||
1bbhA00
|
||||
1bbpA00
|
||||
1bccD01
|
||||
1be3C00
|
||||
1binA00
|
||||
1bvbA03
|
||||
1bz1A00
|
||||
1c2nA00
|
||||
1c52A00
|
||||
1c6oA00
|
||||
1c6sA00
|
||||
1c7dA00
|
||||
1cc5A00
|
||||
1cchA00
|
||||
1ccrA00
|
||||
1cg5A00
|
||||
1cg5B00
|
||||
1ci3A00
|
||||
1cl6A00
|
||||
1cnoG00
|
||||
1co6A00
|
||||
1cpcA00
|
||||
1cpcB00
|
||||
1cpqA00
|
||||
1ctmA00
|
||||
1cxaA00
|
||||
1cxyA00
|
||||
1cyfA00
|
||||
1cyjA00
|
||||
1d06A00
|
||||
1d1vA00
|
||||
1d4cA02
|
||||
1d7cA01
|
||||
1d8uA00
|
||||
1dlwA00
|
||||
1dm1A00
|
||||
1drmA00
|
||||
1dvhA00
|
||||
1dvvA00
|
||||
1dw0A00
|
||||
1dxtB00
|
||||
1e29A00
|
||||
1ebtA00
|
||||
1ecaA00
|
||||
1egyA00
|
||||
1etpA01
|
||||
1euoA00
|
||||
1ew6A00
|
||||
1ezvC00
|
||||
1f1cA00
|
||||
1f4uA00
|
||||
1f5oA00
|
||||
1f99A00
|
||||
1f99B00
|
||||
1fcbA00
|
||||
1fcdD01
|
||||
1fdhB00
|
||||
1fftE01
|
||||
1fhfA00
|
||||
1fj0A00
|
||||
1fs7A01
|
||||
1ft9A00
|
||||
1gcvA00
|
||||
1gcvB00
|
||||
1gdiA00
|
||||
1gdvA00
|
||||
1gjqA00
|
||||
1gksA00
|
||||
1gm4A02
|
||||
1gqaA00
|
||||
1gu2A00
|
||||
1gu6B01
|
||||
1gwsA14
|
||||
1gyoA03
|
||||
1h1oB02
|
||||
1h21A01
|
||||
1h31A01
|
||||
1h31B00
|
||||
1h97A00
|
||||
1hbgA00
|
||||
1hbhA00
|
||||
1hbhB00
|
||||
1hbrA00
|
||||
1hdsD00
|
||||
1he2A01
|
||||
1hlbA00
|
||||
1hlmA00
|
||||
1hroA00
|
||||
1i7yA00
|
||||
1iqcB01
|
||||
1it2A00
|
||||
1ithA00
|
||||
1iw1A01
|
||||
1ix3A00
|
||||
1izoA00
|
||||
1j0pA00
|
||||
1j77A00
|
||||
1jdlA00
|
||||
1jebA00
|
||||
1jjuA01
|
||||
1jmxA01
|
||||
1jniA01
|
||||
1jrxA02
|
||||
1kibA00
|
||||
1kn1B00
|
||||
1kqgC00
|
||||
1kr7A00
|
||||
1kwjA00
|
||||
1kx2A00
|
||||
1lhsA00
|
||||
1liaB00
|
||||
1ls9A00
|
||||
1ly8B03
|
||||
1m1pA01
|
||||
1m56A01
|
||||
1m7sA00
|
||||
1mg2D00
|
||||
1mhlB04
|
||||
1mj4A00
|
||||
1mjtA01
|
||||
1mqfA00
|
||||
1mwbA00
|
||||
1mytA00
|
||||
1n5uA05
|
||||
1ngkB00
|
||||
1nr6A00
|
||||
1ntfA00
|
||||
1oagA00
|
||||
1oahB02
|
||||
1ofwA09
|
||||
1ogyB01
|
||||
1oj6B00
|
||||
1or4A00
|
||||
1os6A02
|
||||
1outA00
|
||||
1outB00
|
||||
1prhA00
|
||||
1q90A00
|
||||
1qdbC04
|
||||
1qgwA00
|
||||
1qgwD02
|
||||
1qjsA00
|
||||
1qksA00
|
||||
1qn1A01
|
||||
1qn2A00
|
||||
1qwlA00
|
||||
1r3qA00
|
||||
1rz6A00
|
||||
1s56B00
|
||||
1s5lP00
|
||||
1s66A00
|
||||
1schB00
|
||||
1si8A00
|
||||
1sk7A00
|
||||
1soxA01
|
||||
1sp3A07
|
||||
1spgA00
|
||||
1spgB00
|
||||
1suoA00
|
||||
1sy7B00
|
||||
1t88A00
|
||||
1tguC00
|
||||
1tu9A00
|
||||
1u17A00
|
||||
1uvxA00
|
||||
1ux8A00
|
||||
1v4uA00
|
||||
1v4wB00
|
||||
1v75A00
|
||||
1w2lA00
|
||||
1w5cB14
|
||||
1w7oA03
|
||||
1we1A00
|
||||
1wmuB00
|
||||
1woxB00
|
||||
1wveB00
|
||||
1x3kA00
|
||||
1x3xA00
|
||||
1x9fA00
|
||||
1x9fB00
|
||||
1x9fD00
|
||||
1x9fG00
|
||||
1xbnA00
|
||||
1xf6B01
|
||||
1xq5A00
|
||||
1xq5B00
|
||||
1yeaA00
|
||||
1yhuA00
|
||||
1yhuB00
|
||||
1yhuC00
|
||||
1yiqA01
|
||||
1yq4D00
|
||||
1z1nA16
|
||||
1z24A00
|
||||
1zrtB00
|
||||
1zzhB01
|
||||
2a3mA03
|
||||
2amoB00
|
||||
2bh4A00
|
||||
2bk9A00
|
||||
2bkmA00
|
||||
2blfB00
|
||||
2bq4B03
|
||||
2bz9A00
|
||||
2c0kA00
|
||||
2c1dA00
|
||||
2c1dB00
|
||||
2c1vA01
|
||||
2c2cA00
|
||||
2c7jA00
|
||||
2c7jB01
|
||||
2c8sA00
|
||||
2ccyA00
|
||||
2civA01
|
||||
2czsA00
|
||||
2d09A00
|
||||
2d0sA00
|
||||
2d0wA00
|
||||
2d1eA00
|
||||
2d2mA00
|
||||
2d2mB00
|
||||
2d2mD00
|
||||
2dc3A00
|
||||
2dgeA00
|
||||
2e74A01
|
||||
2e84A14
|
||||
2eimA03
|
||||
2flqB01
|
||||
2fmyA00
|
||||
2fw5A01
|
||||
2fynA01
|
||||
2fynB00
|
||||
2hpdB00
|
||||
2hreA00
|
||||
2i89A00
|
||||
2i96A00
|
||||
2ibjA00
|
||||
2ig3A00
|
||||
2iufA00
|
||||
2ivfC00
|
||||
2j0pA00
|
||||
2j8wA00
|
||||
2je2A00
|
||||
2jxmB00
|
||||
2k2nA00
|
||||
2k3vA03
|
||||
2k78A00
|
||||
2l4dA00
|
||||
2noxB00
|
||||
2nwbA00
|
||||
2nzaA00
|
||||
2olpA00
|
||||
2oolA00
|
||||
2oyyA00
|
||||
2ozyA04
|
||||
2pbjD00
|
||||
2q2oA00
|
||||
2q7aA01
|
||||
2q8qA00
|
||||
2qppB00
|
||||
2r1hA00
|
||||
2r1hB00
|
||||
2r4zB00
|
||||
2r79A00
|
||||
2rfbA00
|
||||
2ri4D00
|
||||
2uulA00
|
||||
2uulB00
|
||||
2uydA00
|
||||
2v7iA00
|
||||
2vgrC00
|
||||
2vhdA00
|
||||
2vjhA01
|
||||
2vjhB00
|
||||
2vjrA00
|
||||
2vjrB01
|
||||
2vjtB00
|
||||
2vr0A06
|
||||
2vr0F03
|
||||
2vywA00
|
||||
2vzwB00
|
||||
2w31A00
|
||||
2wh8B00
|
||||
2wtgA00
|
||||
2wy4A00
|
||||
2x9oA00
|
||||
2xkrA00
|
||||
2xleA00
|
||||
2xq1O00
|
||||
2xtsB00
|
||||
2xykB00
|
||||
2y4eB01
|
||||
2y8hA00
|
||||
2ybqA01
|
||||
2yevB02
|
||||
2yiuB00
|
||||
2yk3A00
|
||||
2ynmC00
|
||||
2yp1C01
|
||||
2zboA00
|
||||
2zdoD00
|
||||
2zdpA00
|
||||
2zfoC00
|
||||
2zonD00
|
||||
2zooA00
|
||||
2zt9C01
|
||||
2zzsA00
|
||||
3a15B00
|
||||
3a4hA00
|
||||
3a9fA00
|
||||
3ae3D00
|
||||
3aeqA00
|
||||
3aq5A00
|
||||
3at5A00
|
||||
3at5B00
|
||||
3awmA00
|
||||
3ayfA01
|
||||
3b42A00
|
||||
3bcqA00
|
||||
3bcqB00
|
||||
3bk9A01
|
||||
3bxuB02
|
||||
3caoA03
|
||||
3cp5A00
|
||||
3cslB00
|
||||
3cwbC03
|
||||
3cx5D00
|
||||
3czhA01
|
||||
3dbmA00
|
||||
3dmiA00
|
||||
3dp5A00
|
||||
3dr0A00
|
||||
3dsjA00
|
||||
3e4wA00
|
||||
3e65B00
|
||||
3egwC00
|
||||
3ej6B03
|
||||
3ejeH01
|
||||
3ellA00
|
||||
3emmA00
|
||||
3fjwA00
|
||||
3gasA00
|
||||
3gm6A04
|
||||
3gw9A00
|
||||
3h4nB00
|
||||
3h8tA00
|
||||
3hf4A00
|
||||
3hq8A01
|
||||
3hx9A00
|
||||
3hyuA00
|
||||
3hyuB00
|
||||
3ia8A00
|
||||
3jbbI00
|
||||
3lf5A00
|
||||
3lxiB00
|
||||
3m5qA02
|
||||
3m97A00
|
||||
3mgxA00
|
||||
3mk7A01
|
||||
3mk7B01
|
||||
3mk7C01
|
||||
3mkbB00
|
||||
3ml1B01
|
||||
3mvcA00
|
||||
3nerB00
|
||||
3nn2B00
|
||||
3notA00
|
||||
3nu1A01
|
||||
3o0rC00
|
||||
3o0rD00
|
||||
3o5cA00
|
||||
3oa8B00
|
||||
3ocdA00
|
||||
3ov0A02
|
||||
3p3zA00
|
||||
3pc3A00
|
||||
3ph2A00
|
||||
3pmqA04
|
||||
3pt7B00
|
||||
3q08A00
|
||||
3qjtA00
|
||||
3qnsA00
|
||||
3qpiB00
|
||||
3qqrB00
|
||||
3qugA00
|
||||
3qzpB00
|
||||
3r9cA00
|
||||
3rivA00
|
||||
3rtlB01
|
||||
3rwlA00
|
||||
3s1iA00
|
||||
3sikB00
|
||||
3swjA01
|
||||
3t3zB00
|
||||
3t6dA01
|
||||
3tf8B00
|
||||
3tktA00
|
||||
3tm9A00
|
||||
3u8pB00
|
||||
3ubrA01
|
||||
3ucpA02
|
||||
3ut2A00
|
||||
3vliA00
|
||||
3vlmA00
|
||||
3volA00
|
||||
3vp5A00
|
||||
3vreB00
|
||||
3w2zA00
|
||||
3wctA00
|
||||
3wctB00
|
||||
3wctC00
|
||||
3wcuD00
|
||||
3wfxA00
|
||||
3wmmA00
|
||||
3x15A00
|
||||
3zbyB00
|
||||
3zhwA00
|
||||
3ziyA00
|
||||
3zjhB00
|
||||
4aamA00
|
||||
4atjB00
|
||||
4b2nA01
|
||||
4b2yA00
|
||||
4b4yA00
|
||||
4b7fA01
|
||||
4b8nB00
|
||||
4bf4D00
|
||||
4bjaA00
|
||||
4bwiA01
|
||||
4c0nA00
|
||||
4cabA00
|
||||
4cdpA00
|
||||
4cx9A00
|
||||
4czoA00
|
||||
4d1nC01
|
||||
4e04B00
|
||||
4e37B00
|
||||
4egnB00
|
||||
4eieA00
|
||||
4ejgE00
|
||||
4f0tB01
|
||||
4fa4B00
|
||||
4fofA00
|
||||
4g1bA00
|
||||
4g1xA00
|
||||
4gd3I00
|
||||
4gl5A00
|
||||
4gu7A00
|
||||
4gydA00
|
||||
4h0mA01
|
||||
4h2lB00
|
||||
4h8qA00
|
||||
4hkaA00
|
||||
4hrrA00
|
||||
4hrrB00
|
||||
4i3bA00
|
||||
4i8vC00
|
||||
4i91A00
|
||||
4j20A00
|
||||
4j6dB00
|
||||
4jetA00
|
||||
4jj0A01
|
||||
4jouA00
|
||||
4kmgA00
|
||||
4l0dA01
|
||||
4l2mA00
|
||||
4l6gA00
|
||||
4l6vS19
|
||||
4ljiA00
|
||||
4lm6A00
|
||||
4lm6B01
|
||||
4lm8A04
|
||||
4lmhD09
|
||||
4lmsA00
|
||||
4lmsC01
|
||||
4lmxC01
|
||||
4n4jA07
|
||||
4n4oA00
|
||||
4n73A00
|
||||
4nk2A00
|
||||
4o1wA00
|
||||
4o4sG00
|
||||
4o7gB00
|
||||
4oqrA00
|
||||
4ourB01
|
||||
4pwaD01
|
||||
4pwvA00
|
||||
4qi3A00
|
||||
4qi7A00
|
||||
4qoqA00
|
||||
4r1zA00
|
||||
4rknA08
|
||||
4rlrA00
|
||||
4rm4A00
|
||||
4tx3A00
|
||||
4u72A00
|
||||
4u8uA00
|
||||
4u8uB00
|
||||
4u8uC00
|
||||
4u8uD00
|
||||
4u99A00
|
||||
4ubsA06
|
||||
4uc1A05
|
||||
4uiiA00
|
||||
4uiqA00
|
||||
4uurA00
|
||||
4uylB00
|
||||
4uzvA00
|
||||
4v2kA00
|
||||
4w7jC00
|
||||
4wnuB00
|
||||
4x8yA00
|
||||
4xdiA00
|
||||
4xe3A00
|
||||
4xkbA00
|
||||
4xmhA01
|
||||
4xtqA00
|
||||
4xxiA00
|
||||
4xxlA00
|
||||
4xydB00
|
||||
4y7sA00
|
||||
4ympB00
|
||||
4yt3A00
|
||||
4zgxJ00
|
||||
4zvbA00
|
||||
5a13B00
|
||||
5akpA00
|
||||
5aqdA01
|
||||
5aqdM03
|
||||
5aurA00
|
||||
5b3iA00
|
||||
5b3vB01
|
||||
5b50A00
|
||||
5b6qA00
|
||||
5bv2B00
|
||||
5bv5A00
|
||||
5c2vC01
|
||||
5cx7E00
|
||||
5d1vA00
|
||||
5de0C00
|
||||
5dfxA00
|
||||
5f1aA01
|
||||
5f6zA00
|
||||
5ff1B05
|
||||
5foiA00
|
||||
5fujA00
|
||||
5fygA00
|
||||
5gj3A00
|
||||
5gweA00
|
||||
5hh3B00
|
||||
5irvC00
|
||||
5jggA00
|
||||
5jnzB00
|
||||
5k8zB01
|
||||
5kyoA00
|
||||
5kzlA00
|
||||
5l8rE04
|
||||
5l91A00
|
||||
5llyC00
|
||||
5lo9A02
|
||||
5loqC01
|
||||
5lthA00
|
||||
5mapB00
|
||||
5mg1A00
|
||||
5o0tA01
|
||||
5o1lB00
|
||||
5oheF00
|
||||
5t2kB00
|
||||
5ti9C00
|
||||
5tiaD00
|
||||
5v3uA00
|
||||
5vbuA00
|
||||
5vcgA00
|
||||
5x24A00
|
||||
5xnlC16
|
||||
5xnlD16
|
||||
5xnlV04
|
||||
5xnlW16
|
||||
5xnmA18
|
||||
5y1iA00
|
||||
5y8aA00
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,387 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import keras\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"from sklearn.preprocessing import LabelEncoder\n",
|
||||
"from keras.models import Sequential\n",
|
||||
"from keras.layers import Dense, Flatten, TimeDistributed\n",
|
||||
"from keras import Input, Model\n",
|
||||
"from keras.layers import add, Activation\n",
|
||||
"#from keras.utils import plot_model # Needs pydot.\n",
|
||||
"from keras.layers import Conv1D, AveragePooling1D"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def file_to_dataframe(filename):\n",
|
||||
" \"\"\"\n",
|
||||
" Returns a pandas dataframe ncol = len(longest_sequence),\n",
|
||||
" nrow = number of sequences\n",
|
||||
" \n",
|
||||
" Arguments :\n",
|
||||
" - filename : str\n",
|
||||
" path to file\n",
|
||||
" Takes a path to a files containing any sequences, must be 1 sequence\n",
|
||||
" per line.\n",
|
||||
" \n",
|
||||
" Sequences shorter than longest_sequence are completed with '0' char.\n",
|
||||
" \"\"\"\n",
|
||||
" filin = open(filename)\n",
|
||||
" fastas0 = filin.read()\n",
|
||||
" fastas0 = fastas0.split('\\n')\n",
|
||||
" nmax = len(max(fastas0, key=len))\n",
|
||||
" fastas = []\n",
|
||||
" for fasta in fastas0:\n",
|
||||
" fastas.append(fasta + (nmax - len(fasta)) * '0')\n",
|
||||
" \n",
|
||||
" seqs = pd.DataFrame(index=range(len(fastas)), columns=range(nmax))\n",
|
||||
" \n",
|
||||
" for i, fasta in enumerate(fastas):\n",
|
||||
" seqs.loc[i] = pd.Series(list(fasta))\n",
|
||||
" \n",
|
||||
" return seqs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def model_sequential(): # créer un objet modèle\n",
|
||||
" \"\"\"\n",
|
||||
" Return a simple sequentiel model\n",
|
||||
" \n",
|
||||
" Returns :\n",
|
||||
" - model : keras.Model\n",
|
||||
" \"\"\"\n",
|
||||
" inputs = Input(shape=(759,21)) # 759 aa, 21 car onehot\n",
|
||||
" conv_1 = Conv1D(25, (5), padding=\"same\", activation=\"relu\",\n",
|
||||
" kernel_initializer=\"he_normal\")(inputs)\n",
|
||||
" conv_2 = Conv1D(35, (5), padding=\"same\", activation=\"relu\",\n",
|
||||
" kernel_initializer=\"he_normal\")(conv_1)\n",
|
||||
" output = TimeDistributed(Dense(4, activation='softmax'))(conv_2)\n",
|
||||
" model = Model(inputs=inputs, outputs=output)\n",
|
||||
" print(model.summary)\n",
|
||||
" model.compile(optimizer=\"adam\", loss=\"categorical_crossentropy\",\n",
|
||||
" metrics=[\"accuracy\"])\n",
|
||||
" return model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def char_to_onehot(df, ncol=0):\n",
|
||||
" \"\"\"\n",
|
||||
" Returns the given str-encoded dataframe into a onehot encoded dataframe as an array object\n",
|
||||
" \n",
|
||||
" * Arguments:\n",
|
||||
" - df : pandas.DataFrame, the dataframe containing the sequences, cell \n",
|
||||
" containing strings.\n",
|
||||
" - ncol : int, Optionnal. the number of col used to build the LabelEncoder\n",
|
||||
" which will transform the df cells into int(categorical).\n",
|
||||
" \"\"\"\n",
|
||||
" classes = LabelEncoder()\n",
|
||||
" classes.fit(df[ncol])\n",
|
||||
" df_categorical = df.apply(func=classes.transform, axis=0)\n",
|
||||
" df_onehot = keras.utils.to_categorical(df_categorical)\n",
|
||||
" return df_onehot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def true_accuracy(predictions, onehot_Y_test):\n",
|
||||
" \"\"\"\n",
|
||||
" Computes the accuracy ignoring the \"0\" of the DataFrame.\n",
|
||||
" \n",
|
||||
" * Arguments :\n",
|
||||
" - predictions : numpy.array, output of the model, onehot encoded.\n",
|
||||
" - onehot_Y_test : numpy.array, the true values, onehot encoded.\n",
|
||||
" \n",
|
||||
" * Returns :\n",
|
||||
" - acc_coor : int, accuracy corrected, not considering '0' predictions\n",
|
||||
" \"\"\"\n",
|
||||
" tp = 0\n",
|
||||
" tn = 0\n",
|
||||
" fn = 0\n",
|
||||
" fp = 0\n",
|
||||
" tot = 0\n",
|
||||
"\n",
|
||||
" for i in range(len(predictions)):\n",
|
||||
" for j in range(len(predictions[i])):\n",
|
||||
" if onehot_Y_test[i, j, 3] != 0.:\n",
|
||||
" predmax = -1\n",
|
||||
" predict_class = -1\n",
|
||||
" true_class = -1\n",
|
||||
" for k in range(len(predictions[i, j])):\n",
|
||||
" if predmax < predictions[i, j, k]:\n",
|
||||
" predmax = predictions[i, j, k]\n",
|
||||
" predict_class = k\n",
|
||||
" if onehot_Y_test[i, j, k] == 1.:\n",
|
||||
" true_class = k\n",
|
||||
" if predict_class == true_class:\n",
|
||||
" tp = tp+1\n",
|
||||
" tot = tot + 1\n",
|
||||
" acc_corr = tp/tot*100\n",
|
||||
" return acc_corr"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create dataframe from files\n",
|
||||
"fasta = file_to_dataframe(\"data/train.fasta\")\n",
|
||||
"fasta = fasta.replace(\"X\", \"A\") # 'X' in fasta sequences are replace with 'A'\n",
|
||||
"dssp = file_to_dataframe(\"data/train.dssp\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Writes Dataframes to csv files\n",
|
||||
"fasta.to_csv(path_or_buf=\"data/train_fasta.csv\")\n",
|
||||
"dssp.to_csv(path_or_buf=\"data/train_dssp.csv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To onehot\n",
|
||||
"fasta_onehot = char_to_onehot(fasta, 0)\n",
|
||||
"dssp_onehot = char_to_onehot(dssp, 2)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Divides the dataset in train and test subsets\n",
|
||||
"fasta_train = fasta_onehot[0:1000,]\n",
|
||||
"dssp_train = dssp_onehot[0:1000,]\n",
|
||||
"fasta_test = fasta_onehot[1000:,]\n",
|
||||
"dssp_test = dssp_onehot[1000:]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<bound method Network.summary of <keras.engine.training.Model object at 0x7f68cfb7b0d0>>\n",
|
||||
"Epoch 1/30\n",
|
||||
"1000/1000 [==============================] - 2s 2ms/step - loss: 0.7467 - acc: 0.7447\n",
|
||||
"Epoch 2/30\n",
|
||||
"1000/1000 [==============================] - 1s 974us/step - loss: 0.2610 - acc: 0.8944\n",
|
||||
"Epoch 3/30\n",
|
||||
"1000/1000 [==============================] - 1s 964us/step - loss: 0.2053 - acc: 0.9086\n",
|
||||
"Epoch 4/30\n",
|
||||
"1000/1000 [==============================] - 1s 994us/step - loss: 0.1899 - acc: 0.9154\n",
|
||||
"Epoch 5/30\n",
|
||||
"1000/1000 [==============================] - 1s 986us/step - loss: 0.1817 - acc: 0.9193\n",
|
||||
"Epoch 6/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1790 - acc: 0.9201\n",
|
||||
"Epoch 7/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1759 - acc: 0.9217\n",
|
||||
"Epoch 8/30\n",
|
||||
"1000/1000 [==============================] - 1s 960us/step - loss: 0.1743 - acc: 0.9222\n",
|
||||
"Epoch 9/30\n",
|
||||
"1000/1000 [==============================] - 1s 977us/step - loss: 0.1735 - acc: 0.9226\n",
|
||||
"Epoch 10/30\n",
|
||||
"1000/1000 [==============================] - 1s 963us/step - loss: 0.1727 - acc: 0.9228\n",
|
||||
"Epoch 11/30\n",
|
||||
"1000/1000 [==============================] - 1s 999us/step - loss: 0.1712 - acc: 0.9239\n",
|
||||
"Epoch 12/30\n",
|
||||
"1000/1000 [==============================] - 1s 963us/step - loss: 0.1702 - acc: 0.9243\n",
|
||||
"Epoch 13/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1695 - acc: 0.9249\n",
|
||||
"Epoch 14/30\n",
|
||||
"1000/1000 [==============================] - 1s 978us/step - loss: 0.1687 - acc: 0.9252\n",
|
||||
"Epoch 15/30\n",
|
||||
"1000/1000 [==============================] - 1s 981us/step - loss: 0.1678 - acc: 0.9257\n",
|
||||
"Epoch 16/30\n",
|
||||
"1000/1000 [==============================] - 1s 985us/step - loss: 0.1669 - acc: 0.9260\n",
|
||||
"Epoch 17/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1661 - acc: 0.9267\n",
|
||||
"Epoch 18/30\n",
|
||||
"1000/1000 [==============================] - 1s 1000us/step - loss: 0.1656 - acc: 0.9269\n",
|
||||
"Epoch 19/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1650 - acc: 0.9273\n",
|
||||
"Epoch 20/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1640 - acc: 0.9277\n",
|
||||
"Epoch 21/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1637 - acc: 0.9281\n",
|
||||
"Epoch 22/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1630 - acc: 0.9285\n",
|
||||
"Epoch 23/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1621 - acc: 0.9289\n",
|
||||
"Epoch 24/30\n",
|
||||
"1000/1000 [==============================] - 1s 992us/step - loss: 0.1619 - acc: 0.9289\n",
|
||||
"Epoch 25/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1616 - acc: 0.9291\n",
|
||||
"Epoch 26/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1616 - acc: 0.9291\n",
|
||||
"Epoch 27/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1608 - acc: 0.9296\n",
|
||||
"Epoch 28/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1604 - acc: 0.9297\n",
|
||||
"Epoch 29/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1601 - acc: 0.9298\n",
|
||||
"Epoch 30/30\n",
|
||||
"1000/1000 [==============================] - 1s 1ms/step - loss: 0.1597 - acc: 0.9300\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<keras.callbacks.History at 0x7f68cfcf6050>"
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"model = model_sequential()\n",
|
||||
"model.fit(fasta_train, dssp_train, epochs=30, batch_size=30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"predictions = model.predict(fasta_test, batch_size=30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"accuracy : 68.06409539780138\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"accuracy : {}\".format(true_accuracy(predictions, dssp_test)))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
1a28A00
|
||||
1afsA01
|
||||
1aquA01
|
||||
1coyA00
|
||||
1dbbB00
|
||||
1dbjA00
|
||||
1eupA02
|
||||
1fdtA00
|
||||
1h60A01
|
||||
1hv5E01
|
||||
1i7gA01
|
||||
1jnhB00
|
||||
1kdkA00
|
||||
1nfqA01
|
||||
1ogzA00
|
||||
1oh0B00
|
||||
1q13A01
|
||||
1q20A01
|
||||
1vpoB00
|
||||
1x8jA01
|
||||
1xj7A01
|
||||
1xnxA00
|
||||
1xv9B00
|
||||
1y5rA01
|
||||
1yb1A00
|
||||
2aaxA00
|
||||
2d06A01
|
||||
2hzqA00
|
||||
2ipgA01
|
||||
2o5yB00
|
||||
2qp4A00
|
||||
2v95A00
|
||||
2vctA00
|
||||
3burA01
|
||||
3eauA02
|
||||
3gn8A01
|
||||
3kdmB00
|
||||
3mnpA01
|
||||
3oikA00
|
||||
3ollA00
|
||||
3q95B00
|
||||
3rukD01
|
||||
3s79A01
|
||||
3wo2C02
|
||||
4c3yH02
|
||||
4c49A00
|
||||
4dvqA01
|
||||
4j6cA00
|
||||
4jvlA01
|
||||
4l1wA01
|
||||
4ltwA00
|
||||
4pleA02
|
||||
4qckA00
|
||||
4qdcA00
|
||||
4qdfB00
|
||||
4qf7A00
|
||||
4r1zA01
|
||||
4r21B01
|
||||
4ubtA01
|
||||
4x1gA00
|
||||
4y8wC01
|
||||
5a1pA01
|
||||
5hgcA00
|
||||
5hs6A01
|
||||
5if6A00
|
||||
5l91A04
|
||||
5lurA00
|
||||
5vb2D05
|
||||
6f88A01
|
||||
Loading…
Reference in New Issue