# HG changeset patch
# User rakesh4osdd
# Date 1623417588 0
# Node ID c5ffaf5288fed2022ce40446d54b77df71980b82
# Parent 62226cd1acb569c66bfd714cc00041cf0d4aa047
Deleted selected files
diff -r 62226cd1acb5 -r c5ffaf5288fe clsi_profile_type2.py
--- a/clsi_profile_type2.py Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-#!/usr/bin/env python
-# coding: utf-8
-
-# In[1245]:
-
-
-# ASIST module2 | map AST result to the CLSI breakporints with combination antibiotics
-# By rakesh4osdd@gmail.com, 06-Jun-2021
-import pandas as pd
-import re
-import sys
-
-
-# In[1246]:
-
-
-# cross check MIC values
-def sus_res(mic):
- #print(mic)
- #print ((mic,pd.isna(mic[1]),pd.isna(mic[0]),'\n')
- if not (pd.isna(mic[0]) or pd.isna(mic[1]) or pd.isna(mic[2])):#check for NaN value
- #remove unwanted whitespace
- o_mic = mic[0].replace(' ', '')
- s_mic = mic[1].replace(' ', '')
- r_mic = mic[2].replace(' ', '')
- #print (o_mic,s_mic,r_mic)
- #print (type(o_mic),type(s_mic),type(r_mic))
- if '/' in s_mic: #check for combination antibiotics
- #print ('combination antibiotics')
- try:
- if '/' in o_mic:
- #print ('input combination')
- if (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(o_mic.split('/')[1]) <= float(s_mic.split('/')[1])):
- strain_type='Susceptible'
- elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(o_mic.split('/')[1]) >= float(r_mic.split('/')[1])):
- strain_type='Resistant'
- else:
- strain_type='Intermediate'
- else:
- #print ('single')
- if float(o_mic)==0:
- strain_type='Strain could not classified'
- elif (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(1) <= float(s_mic.split('/')[1])):
- strain_type='Susceptible'
- elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(1) >= float(r_mic.split('/')[1])):
- strain_type='Resistant'
- else:
- strain_type='Intermediate'
- except ValueError:
- strain_type='Strain could not classified'
- else: #single antibiotics
- #print('single antibiotics')
- if o_mic:
- if float(o_mic)==0:
- strain_type='Strain could not classified'
- elif (float(o_mic) <= float(s_mic)):
- strain_type='Susceptible'
- elif (float(o_mic) >= float(r_mic)):
- strain_type='Resistant'
- else:
- strain_type='Intermediate'
- else:
- strain_type='Strain could not classified'
- else:
- strain_type='Strain could not classified'
- return(strain_type)
-
-
-# In[ ]:
-
-# for input argument
-input_user = sys.argv[1]
-input_clsi = sys.argv[2]
-output_table = sys.argv[3]
-
-# In[1247]:
-
-
-"""
-input_user='input_ast_comb2.csv'
-input_clsi='clsi_profile_comb.csv'
-output_profile=input_user+'_profile.csv'
-output_table=input_user+'_table.csv'
-
-"""
-
-# In[1248]:
-
-
-# read user AST data with selected 3 columns
-strain_mic=pd.read_csv(input_user, sep=',', usecols =['Strain name', 'Antibiotics', 'MIC'],na_filter=False)
-
-
-# In[1249]:
-
-
-clsi_bp=pd.read_csv(input_clsi,sep=',')
-
-
-# In[1290]:
-
-
-#clsi_bp.head(2)
-#strain_mic
-
-
-# In[1251]:
-
-
-# convert MIC to numbers sMIC, rMIC
-clsi_bp['s_mic'] =clsi_bp[['Susceptible']].applymap(lambda x: (re.sub(r'[^0-9.\/]', '', x)))
-clsi_bp['r_mic'] =clsi_bp[['Resistant']].applymap(lambda x: (re.sub(r'[^0-9.\/]', '', x)))
-
-
-# In[1252]:
-
-
-# Read only numbers in MIC values
-#try:
-strain_mic['o_mic']=strain_mic[['MIC']].applymap(lambda x: (re.sub(r'[^0-9.\/]','', x)))
-#except TypeError:
-# print('Waring: Error in MIC value')
-
-
-# In[1289]:
-
-
-#strain_mic.head()
-
-
-# In[1254]:
-
-
-# capitalize each Antibiotic Name for comparision with removing whitespace
-strain_mic['Antibiotics']=strain_mic['Antibiotics'].str.capitalize().str.replace(" ","")
-clsi_bp['Antibiotics']=clsi_bp['Antibiotics'].str.capitalize().str.replace(" ","")
-
-
-# In[1255]:
-
-
-#compare CLSI Antibiotics only
-#result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner', indicator=True)[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','_merge']]
-try:
- result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner')[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic']]
-except KeyError:
- print('Waring: Error in input Values')
-
-
-# In[1256]:
-
-
-#compare MIC values and assign Susceptible and Resistant to Strain
-#try:
-result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic']].apply(sus_res,axis = 1)
-#except ValueError:
-# print('Waring: Error in input MIC value')
-
-
-# In[1288]:
-
-
-#result
-
-
-# In[1258]:
-
-
-#result[['Strain name', 'Antibiotics', 'MIC','s_mic','r_mic','CLSI_profile']].to_csv(output_profile,sep=',', index=False, encoding='utf-8-sig')
-
-
-# In[1259]:
-
-
-#create a pivot table for ASIST
-table=result[['Strain name', 'Antibiotics','CLSI_profile']].drop_duplicates()
-result_table=pd.pivot_table(table, values ='CLSI_profile', index =['Strain name'],columns =['Antibiotics'], aggfunc = lambda x: ' '.join(x))
-
-
-# In[1261]:
-
-
-result_table
-
-
-# In[1264]:
-
-
-#result_table.to_csv(output_table,na_rep='NA')
-
-
-# In[1282]:
-
-
-# reorder the Antibiotics for ASIST
-clsi_ab=['Amikacin','Tobramycin','Gentamycin','Imipenem','Meropenem','Doripenem','Ciprofloxacin','Levofloxacin',
- 'Piperacillin/tazobactam','Ticarcillin/clavulanicacid','Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime',
- 'Trimethoprim/sulfamethoxazole','Ampicillin/sulbactam','Colistin','Polymyxinb','Tetracycline','Doxicycline ',
- 'Minocycline']
-result_selected=result_table.filter(clsi_ab)
-
-
-# In[1283]:
-
-
-result_selected.shape
-
-
-# In[1284]:
-
-
-result_table.shape
-
-
-# In[1285]:
-
-
-result_selected.insert(0,'Resistance_phenotype','')
-
-
-# In[1286]:
-
-
-result_selected.to_csv(output_table,na_rep='NA')
-
-
-# In[1287]:
-
-
-#rename headers
-result_selected.rename(columns = {'Ticarcillin/clavulanicacid':'Ticarcillin/clavulanic acid','Piperacillin/tazobactam':'Piperacillin/ tazobactam','Trimethoprim/sulfamethoxazole': 'Trimethoprim/ sulfamethoxazole','Ampicillin/sulbactam':'Ampicillin/ sulbactam', 'Polymyxinb': 'Polymyxin B'} )
-
-
-# In[ ]:
-
-
-
-
-
-# In[ ]:
-
-
-
-
diff -r 62226cd1acb5 -r c5ffaf5288fe clsi_profile_type2_linux-Copy1.ipynb
--- a/clsi_profile_type2_linux-Copy1.ipynb Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2461 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "id": "967b1345",
- "metadata": {},
- "outputs": [],
- "source": [
- "# ASIST module2 | map AST result to the CLSI breakporints with combination antibiotics\n",
- "# By rakesh4osdd@gmail.com, 06-Jun-2021\n",
- "import pandas as pd\n",
- "import re\n",
- "import sys"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "id": "39e25c15",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "1.2.4 2.2.1\n"
- ]
- }
- ],
- "source": [
- "print(pd.__version__, re.__version__)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 175,
- "id": "c96d7c62",
- "metadata": {},
- "outputs": [],
- "source": [
- "# cross check MIC values\n",
- "def sus_res(mic):\n",
- " print(mic)\n",
- " #print ((mic,pd.isna(mic[1]),pd.isna(mic[0]),'\\n')\n",
- " if not (pd.isna(mic[0]) or pd.isna(mic[1]) or pd.isna(mic[2])):#check for NaN value\n",
- " #remove unwanted whitespace\n",
- " o_mic = mic[0].replace(' ', '')\n",
- " s_mic = mic[1].replace(' ', '')\n",
- " r_mic = mic[2].replace(' ', '')\n",
- " i_mic = mic[3].replace(' ', '')\n",
- " print(imic(o_mic,i_mic))\n",
- " #print (o_mic,s_mic,r_mic)\n",
- " #print (type(o_mic),type(s_mic),type(r_mic))\n",
- " if '/' in s_mic: #check for combination antibiotics\n",
- " #print ('combination antibiotics')\n",
- " try:\n",
- " if '/' in o_mic:\n",
- " #print ('input combination')\n",
- " if (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(o_mic.split('/')[1]) <= float(s_mic.split('/')[1])):\n",
- " strain_type='Susceptible'\n",
- " elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(o_mic.split('/')[1]) >= float(r_mic.split('/')[1])):\n",
- " strain_type='Resistant'\n",
- " elif (imic(o_mic,i_mic)):\n",
- " strain_type='Intermediate-1' \n",
- " else:\n",
- " strain_type='Intermediate-2'\n",
- " else: \n",
- " #print ('single')\n",
- " if float(o_mic)==0:\n",
- " strain_type='Strain could not classified'\n",
- " elif (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(1) <= float(s_mic.split('/')[1])):\n",
- " strain_type='Susceptible'\n",
- " elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(1) >= float(r_mic.split('/')[1])):\n",
- " strain_type='Resistant'\n",
- " else:\n",
- " strain_type='Intermediate-3'\n",
- " except ValueError:\n",
- " strain_type='Strain could not classified-1'\n",
- " elif (s_mic == '-'):\n",
- " if o_mic:\n",
- " if float(o_mic)==0:\n",
- " strain_type='Strain could not classified-2'\n",
- " #elif (float(o_mic) <= float(s_mic)):\n",
- " # strain_type='Susceptible'\n",
- " elif (float(o_mic) >= float(r_mic)):\n",
- " strain_type='Resistant'\n",
- " elif (imic(o_mic,i_mic)):\n",
- " strain_type='Intermediat-4'\n",
- " else:\n",
- " strain_type='Intermediate-5'\n",
- " else:\n",
- " strain_type='Strain could not classified-3'\n",
- " else: #single antibiotics\n",
- " #print('single antibiotics')\n",
- " if o_mic:\n",
- " if float(o_mic)==0:\n",
- " strain_type='Strain could not classified-4'\n",
- " elif (float(o_mic) <= float(s_mic)):\n",
- " strain_type='Susceptible'\n",
- " elif (float(o_mic) >= float(r_mic)):\n",
- " strain_type='Resistant'\n",
- " else:\n",
- " strain_type='Intermediate-6'\n",
- " else:\n",
- " strain_type='Strain could not classified-5'\n",
- " else:\n",
- " strain_type='Strain could not classified-6'\n",
- " return(strain_type)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 176,
- "id": "dbc70e34",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "['32/2', '16/4', '128/4', '32/4-64/4']\n",
- "32/2 32/4-64/4\n",
- "False\n",
- "32/2 32/4-64/4\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "'Intermediate-2'"
- ]
- },
- "execution_count": 176,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "mic=['32/2','16/4','128/4','32/4-64/4']\n",
- "sus_res(mic)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "653b096e",
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 202,
- "id": "626a1e3f",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "65/4 64/4 s\n",
- "65 4 64 4 s\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "'Strain could not classified-5'"
- ]
- },
- "execution_count": 202,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "def check_mic(mic1,mic2,mic_type):\n",
- " print(mic1,mic2,mic_type)\n",
- " m1a = mic1.split('/')[0]\n",
- " m1b = mic1.split('/')[1]\n",
- " if '-' in mic2: # for intermediate only\n",
- " m2a = mic2.split('-')[0].split('/')[0]\n",
- " m2b = mic2.split('-')[0].split('/')[1]\n",
- " m2aa = mic2.split('-')[1].split('/')[0]\n",
- " m2bb = mic2.split('-')[1].split('/')[1]\n",
- " if (float(m2aa)>=float(m1a)>=float(m2a) and float(m2b)>=float(m1b)>=float(m2b)):\n",
- " #print('intermediate')\n",
- " mic_type='Intermediate-1'\n",
- " else:\n",
- " #print('not define')\n",
- " mic_type='Strain could not classified-1'\n",
- " #print (m1a,m1b,m2a,m2b,m2aa,m2bb)\n",
- " else:\n",
- " m2a = mic2.split('/')[0]\n",
- " m2b = mic2.split('/')[1]\n",
- " print(m1a,m1b,m2a,m2b,mic_type)\n",
- " if mic_type=='s':\n",
- " if (float(m1a)<=float(m2a) and float(m1b)<=float(m2b)):\n",
- " mic_type='Susceptible'\n",
- " else:\n",
- " mic_type='Strain could not classified-5'\n",
- " elif mic_type=='r':\n",
- " if (float(m1a)>=float(m2a) and float(m1b)>=float(m2b)):\n",
- " mic_type='Resistant'\n",
- " else:\n",
- " mic_type='Strain could not classified-4'\n",
- " elif mic_type=='i':\n",
- " if (float(m1a)==float(m2a) and float(m1b)==float(m2b)):\n",
- " mic_type='Intermediate-2'\n",
- " else:\n",
- " mic_type='Strain could not classified-3'\n",
- " else:\n",
- " mic_type='Strain could not classified-2'\n",
- " return(mic_type)\n",
- " \n",
- "check_mic('65/4','64/4','s')\n",
- "# float(mic1.split('/')[0]) <= float(mic2.split('/')[0]) and float(mic1.split('/')[1]) <= float(mic2.split('/')[1])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 171,
- "id": "19905924",
- "metadata": {},
- "outputs": [],
- "source": [
- "#compare MIC values and assign Susceptible and Resistant to Strain\n",
- "#try:\n",
- "#result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic','i_mic']].apply(sus_res,axis = 1)\n",
- "#except ValueError:\n",
- "# print('Waring: Error in input MIC value')\n",
- "#result[['o_mic','s_mic','r_mic','i_mic']].apply(sus_res,axis = 1)\n",
- "#del result['CLSI_profile']"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 42,
- "id": "7784b77d",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'input_user = sys.argv[1]\\ninput_clsi = sys.argv[2]\\noutput_table = sys.argv[3]'"
- ]
- },
- "execution_count": 42,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# for input argument\n",
- "\"\"\"input_user = sys.argv[1]\n",
- "input_clsi = sys.argv[2]\n",
- "output_table = sys.argv[3]\"\"\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 43,
- "id": "1dee9127",
- "metadata": {},
- "outputs": [],
- "source": [
- "input_user='input.csv'\n",
- "input_clsi='clsi.csv'\n",
- "output_profile=input_user+'_profile.csv'\n",
- "output_table=input_user+'_table.csv'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "id": "14c5cfd3",
- "metadata": {},
- "outputs": [],
- "source": [
- "# read user AST data with selected 3 columns\n",
- "strain_mic=pd.read_csv(input_user, sep=',', usecols =['Strain name', 'Antibiotics', 'MIC'],na_filter=False)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "id": "77135cb7",
- "metadata": {},
- "outputs": [],
- "source": [
- "clsi_bp=pd.read_csv(input_clsi,sep=',')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "id": "2ec1cbec",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Antibiotics | \n",
- " Susceptible | \n",
- " Resistant | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " Amikacin | \n",
- " ≤ 16 | \n",
- " ≥ 64 | \n",
- " 32 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " Tobramycin | \n",
- " ≤ 4 | \n",
- " ≥ 16 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " Gentamicin | \n",
- " ≤ 4 | \n",
- " ≥ 16 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " Netilmicin | \n",
- " ≤ 8 | \n",
- " ≥ 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " Imipenem | \n",
- " ≤ 2 | \n",
- " ≥ 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " Meropenem | \n",
- " ≤ 2 | \n",
- " ≥ 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " Doripenem | \n",
- " ≤ 2 | \n",
- " ≥ 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " Ciprofloxacin | \n",
- " ≤ 1 | \n",
- " ≥ 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " Levofloxacin | \n",
- " ≤ 2 | \n",
- " ≥ 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " Piperacillin/ tazobactam | \n",
- " ≤ 16/4 | \n",
- " ≥ 128/4 | \n",
- " 32/4-64/4 | \n",
- "
\n",
- " \n",
- " 10 | \n",
- " Ticarcillin/ clavulanic acid | \n",
- " ≤ 16/2 | \n",
- " ≥ 128/2 | \n",
- " 32/2-64/2 | \n",
- "
\n",
- " \n",
- " 11 | \n",
- " Cefotaxime | \n",
- " ≤ 8 | \n",
- " ≥ 64 | \n",
- " 16-32 | \n",
- "
\n",
- " \n",
- " 12 | \n",
- " Ceftriaxone | \n",
- " ≤ 8 | \n",
- " ≥ 64 | \n",
- " 16-32 | \n",
- "
\n",
- " \n",
- " 13 | \n",
- " Ceftazidime | \n",
- " ≤ 8 | \n",
- " ≥ 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 14 | \n",
- " Cefepime | \n",
- " ≤ 8 | \n",
- " ≥ 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 15 | \n",
- " Trimethoprim/ sulfamethoxazole | \n",
- " ≤ 2/38 | \n",
- " ≥ 4/76 | \n",
- " - | \n",
- "
\n",
- " \n",
- " 16 | \n",
- " Ampicillin/ sulbactam | \n",
- " ≤ 8/4 | \n",
- " ≥ 32/16 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 17 | \n",
- " Colistin | \n",
- " - | \n",
- " ≥ 4 | \n",
- " ≤ 2 | \n",
- "
\n",
- " \n",
- " 18 | \n",
- " Polymyxin B | \n",
- " - | \n",
- " ≥ 4 | \n",
- " ≤ 2 | \n",
- "
\n",
- " \n",
- " 19 | \n",
- " Tetracycline | \n",
- " ≤ 4 | \n",
- " ≥ 16 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 20 | \n",
- " Doxycycline | \n",
- " ≤ 4 | \n",
- " ≥ 16 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 21 | \n",
- " Minocycline | \n",
- " ≤ 4 | \n",
- " ≥ 16 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Antibiotics Susceptible Resistant Intermediate\n",
- "0 Amikacin ≤ 16 ≥ 64 32\n",
- "1 Tobramycin ≤ 4 ≥ 16 8\n",
- "2 Gentamicin ≤ 4 ≥ 16 8\n",
- "3 Netilmicin ≤ 8 ≥ 32 16\n",
- "4 Imipenem ≤ 2 ≥ 8 4\n",
- "5 Meropenem ≤ 2 ≥ 8 4\n",
- "6 Doripenem ≤ 2 ≥ 8 4\n",
- "7 Ciprofloxacin ≤ 1 ≥ 4 2\n",
- "8 Levofloxacin ≤ 2 ≥ 8 4\n",
- "9 Piperacillin/ tazobactam ≤ 16/4 ≥ 128/4 32/4-64/4\n",
- "10 Ticarcillin/ clavulanic acid ≤ 16/2 ≥ 128/2 32/2-64/2\n",
- "11 Cefotaxime ≤ 8 ≥ 64 16-32\n",
- "12 Ceftriaxone ≤ 8 ≥ 64 16-32\n",
- "13 Ceftazidime ≤ 8 ≥ 32 16\n",
- "14 Cefepime ≤ 8 ≥ 32 16\n",
- "15 Trimethoprim/ sulfamethoxazole ≤ 2/38 ≥ 4/76 -\n",
- "16 Ampicillin/ sulbactam ≤ 8/4 ≥ 32/16 16/8\n",
- "17 Colistin - ≥ 4 ≤ 2\n",
- "18 Polymyxin B - ≥ 4 ≤ 2\n",
- "19 Tetracycline ≤ 4 ≥ 16 8\n",
- "20 Doxycycline ≤ 4 ≥ 16 8\n",
- "21 Minocycline ≤ 4 ≥ 16 8"
- ]
- },
- "execution_count": 10,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "clsi_bp\n",
- "#strain_mic"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 19,
- "id": "860505f7",
- "metadata": {},
- "outputs": [],
- "source": [
- "# convert MIC to numbers sMIC, rMIC\n",
- "clsi_bp['s_mic'] =clsi_bp[['Susceptible']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))\n",
- "clsi_bp['r_mic'] =clsi_bp[['Resistant']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))\n",
- "clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 20,
- "id": "cad964a6",
- "metadata": {},
- "outputs": [],
- "source": [
- "#clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 21,
- "id": "2b6c02f5",
- "metadata": {},
- "outputs": [],
- "source": [
- "# Read only numbers in MIC values\n",
- "#try:\n",
- "strain_mic['o_mic']=strain_mic[['MIC']].applymap(lambda x: (re.sub(r'[^0-9.\\/]','', x)))\n",
- "#except TypeError:\n",
- "# print('Waring: Error in MIC value')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "id": "942fefb2",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Strain name | \n",
- " Antibiotics | \n",
- " MIC | \n",
- " o_mic | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 0.1 | \n",
- " 0.1 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 1 | \n",
- " 1 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 2 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ampicillin | \n",
- " 0 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ampicillin/sulbactam | \n",
- " mg/L | \n",
- " / | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Piperacillin/tazobactam | \n",
- " 0 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Cefazolin | \n",
- " 64 | \n",
- " 64 | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ceftriaxone | \n",
- " 16 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Cefepime | \n",
- " 8 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Meropenem | \n",
- " 0.25 | \n",
- " 0.25 | \n",
- "
\n",
- " \n",
- " 10 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Imipenem | \n",
- " 1 | \n",
- " 1 | \n",
- "
\n",
- " \n",
- " 11 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Tigecycline | \n",
- " 0.5 | \n",
- " 0.5 | \n",
- "
\n",
- " \n",
- " 12 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ceftazidime | \n",
- " >128 | \n",
- " 128 | \n",
- "
\n",
- " \n",
- " 13 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Cefepime | \n",
- " >256 | \n",
- " 256 | \n",
- "
\n",
- " \n",
- " 14 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ciprofloxacin | \n",
- " >32 | \n",
- " 32 | \n",
- "
\n",
- " \n",
- " 15 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Colistin | \n",
- " | \n",
- " | \n",
- "
\n",
- " \n",
- " 16 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- "
\n",
- " \n",
- " 17 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ampicillin/sulbactam | \n",
- " >=0.3 mg/L | \n",
- " 0.3/ | \n",
- "
\n",
- " \n",
- " 18 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ticarcillin/clavulanicacid | \n",
- " >=128/2 | \n",
- " 128/2 | \n",
- "
\n",
- " \n",
- " 19 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Piperacillin/tazobactam | \n",
- " NA | \n",
- " | \n",
- "
\n",
- " \n",
- " 20 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- "
\n",
- " \n",
- " 21 | \n",
- " Acinetobacter baumannii ORAB01 | \n",
- " Piperacillin/tazobactam | \n",
- " >64/4 | \n",
- " 64/4 | \n",
- "
\n",
- " \n",
- " 22 | \n",
- " Acinetobacter baumannii strain MRSN7100 | \n",
- " Amoxicillin/clavulanicacid | \n",
- " 16/8 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 23 | \n",
- " Acinetobacter baumannii strain MRSN7168 | \n",
- " Amoxicillin/clavulanicacid | \n",
- " 16/8 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 24 | \n",
- " Acinetobacter baumannii strain MRSN7336 | \n",
- " Amoxicillin/clavulanicacid | \n",
- " 16/8 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 25 | \n",
- " Acinetobacter baumannii strain MRSN7834 | \n",
- " Amoxicillin/clavulanicacid | \n",
- " 16/8 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 26 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0305 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- "
\n",
- " \n",
- " 27 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0306 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- "
\n",
- " \n",
- " 28 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0307 | \n",
- " Polymyxinb | \n",
- " 8 | \n",
- " 8 | \n",
- "
\n",
- " \n",
- " 29 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0308 | \n",
- " Polymyxinb | \n",
- " 4 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Strain name \\\n",
- "0 Acinetobacter baumannii A85 \n",
- "1 Acinetobacter baumannii A85 \n",
- "2 Acinetobacter baumannii A85 \n",
- "3 Acinetobacter baumannii AB307-0294 \n",
- "4 Acinetobacter baumannii AB307-0294 \n",
- "5 Acinetobacter baumannii AB307-0294 \n",
- "6 Acinetobacter baumannii AB307-0294 \n",
- "7 Acinetobacter baumannii AB307-0294 \n",
- "8 Acinetobacter baumannii AB307-0294 \n",
- "9 Acinetobacter baumannii AB307-0294 \n",
- "10 Acinetobacter baumannii AB307-0294 \n",
- "11 Acinetobacter baumannii AB307-0294 \n",
- "12 Acinetobacter baumannii AB5075-UW \n",
- "13 Acinetobacter baumannii AB5075-UW \n",
- "14 Acinetobacter baumannii AB5075-UW \n",
- "15 Acinetobacter baumannii DU202 \n",
- "16 Acinetobacter baumannii DU202 \n",
- "17 Acinetobacter baumannii DU202 \n",
- "18 Acinetobacter baumannii DU202 \n",
- "19 Acinetobacter baumannii DU202 \n",
- "20 Acinetobacter baumannii DU202 \n",
- "21 Acinetobacter baumannii ORAB01 \n",
- "22 Acinetobacter baumannii strain MRSN7100 \n",
- "23 Acinetobacter baumannii strain MRSN7168 \n",
- "24 Acinetobacter baumannii strain MRSN7336 \n",
- "25 Acinetobacter baumannii strain MRSN7834 \n",
- "26 Acinetobacter baumannii strain FDA-CDC-AR_0305 \n",
- "27 Acinetobacter baumannii strain FDA-CDC-AR_0306 \n",
- "28 Acinetobacter baumannii strain FDA-CDC-AR_0307 \n",
- "29 Acinetobacter baumannii strain FDA-CDC-AR_0308 \n",
- "\n",
- " Antibiotics MIC o_mic \n",
- "0 Colistin 0.1 0.1 \n",
- "1 Colistin 1 1 \n",
- "2 Colistin 2 2 \n",
- "3 Ampicillin 0 0 \n",
- "4 Ampicillin/sulbactam mg/L / \n",
- "5 Piperacillin/tazobactam 0 0 \n",
- "6 Cefazolin 64 64 \n",
- "7 Ceftriaxone 16 16 \n",
- "8 Cefepime 8 8 \n",
- "9 Meropenem 0.25 0.25 \n",
- "10 Imipenem 1 1 \n",
- "11 Tigecycline 0.5 0.5 \n",
- "12 Ceftazidime >128 128 \n",
- "13 Cefepime >256 256 \n",
- "14 Ciprofloxacin >32 32 \n",
- "15 Colistin \n",
- "16 Trimethoprim/sulfamethoxazole 8/152 8/152 \n",
- "17 Ampicillin/sulbactam >=0.3 mg/L 0.3/ \n",
- "18 Ticarcillin/clavulanicacid >=128/2 128/2 \n",
- "19 Piperacillin/tazobactam NA \n",
- "20 Trimethoprim/sulfamethoxazole 8/152 8/152 \n",
- "21 Piperacillin/tazobactam >64/4 64/4 \n",
- "22 Amoxicillin/clavulanicacid 16/8 16/8 \n",
- "23 Amoxicillin/clavulanicacid 16/8 16/8 \n",
- "24 Amoxicillin/clavulanicacid 16/8 16/8 \n",
- "25 Amoxicillin/clavulanicacid 16/8 16/8 \n",
- "26 Polymyxinb 1 1 \n",
- "27 Polymyxinb 1 1 \n",
- "28 Polymyxinb 8 8 \n",
- "29 Polymyxinb 4 4 "
- ]
- },
- "execution_count": 22,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "strain_mic"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "id": "bba6b0a2",
- "metadata": {},
- "outputs": [],
- "source": [
- "# capitalize each Antibiotic Name for comparision with removing whitespace\n",
- "strain_mic['Antibiotics']=strain_mic['Antibiotics'].str.capitalize().str.replace(\" \",\"\")\n",
- "clsi_bp['Antibiotics']=clsi_bp['Antibiotics'].str.capitalize().str.replace(\" \",\"\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 53,
- "id": "ea403928",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Strain name | \n",
- " Antibiotics | \n",
- " MIC | \n",
- " o_mic | \n",
- " s_mic | \n",
- " r_mic | \n",
- " i_mic | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 0.1 | \n",
- " 0.1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 2 | \n",
- " 2 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Colistin | \n",
- " | \n",
- " | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ampicillin/sulbactam | \n",
- " mg/L | \n",
- " / | \n",
- " 8/4 | \n",
- " 32/16 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ampicillin/sulbactam | \n",
- " >=0.3 mg/L | \n",
- " 0.3/ | \n",
- " 8/4 | \n",
- " 32/16 | \n",
- " 16/8 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Piperacillin/tazobactam | \n",
- " 0 | \n",
- " 0 | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Piperacillin/tazobactam | \n",
- " NA | \n",
- " | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " Acinetobacter baumannii ORAB01 | \n",
- " Piperacillin/tazobactam | \n",
- " >64/4 | \n",
- " 64/4 | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ceftriaxone | \n",
- " 16 | \n",
- " 16 | \n",
- " 8 | \n",
- " 64 | \n",
- " 16-32 | \n",
- "
\n",
- " \n",
- " 10 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Cefepime | \n",
- " 8 | \n",
- " 8 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 11 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Cefepime | \n",
- " >256 | \n",
- " 256 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 12 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Meropenem | \n",
- " 0.25 | \n",
- " 0.25 | \n",
- " 2 | \n",
- " 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 13 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Imipenem | \n",
- " 1 | \n",
- " 1 | \n",
- " 2 | \n",
- " 8 | \n",
- " 4 | \n",
- "
\n",
- " \n",
- " 14 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ceftazidime | \n",
- " >128 | \n",
- " 128 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- "
\n",
- " \n",
- " 15 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ciprofloxacin | \n",
- " >32 | \n",
- " 32 | \n",
- " 1 | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 16 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- " 2/38 | \n",
- " 4/76 | \n",
- " - | \n",
- "
\n",
- " \n",
- " 17 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- " 2/38 | \n",
- " 4/76 | \n",
- " - | \n",
- "
\n",
- " \n",
- " 18 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ticarcillin/clavulanicacid | \n",
- " >=128/2 | \n",
- " 128/2 | \n",
- " 16/2 | \n",
- " 128/2 | \n",
- " 32/2-64/2 | \n",
- "
\n",
- " \n",
- " 19 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0305 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 20 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0306 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 21 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0307 | \n",
- " Polymyxinb | \n",
- " 8 | \n",
- " 8 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- " 22 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0308 | \n",
- " Polymyxinb | \n",
- " 4 | \n",
- " 4 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Strain name \\\n",
- "0 Acinetobacter baumannii A85 \n",
- "1 Acinetobacter baumannii A85 \n",
- "2 Acinetobacter baumannii A85 \n",
- "3 Acinetobacter baumannii DU202 \n",
- "4 Acinetobacter baumannii AB307-0294 \n",
- "5 Acinetobacter baumannii DU202 \n",
- "6 Acinetobacter baumannii AB307-0294 \n",
- "7 Acinetobacter baumannii DU202 \n",
- "8 Acinetobacter baumannii ORAB01 \n",
- "9 Acinetobacter baumannii AB307-0294 \n",
- "10 Acinetobacter baumannii AB307-0294 \n",
- "11 Acinetobacter baumannii AB5075-UW \n",
- "12 Acinetobacter baumannii AB307-0294 \n",
- "13 Acinetobacter baumannii AB307-0294 \n",
- "14 Acinetobacter baumannii AB5075-UW \n",
- "15 Acinetobacter baumannii AB5075-UW \n",
- "16 Acinetobacter baumannii DU202 \n",
- "17 Acinetobacter baumannii DU202 \n",
- "18 Acinetobacter baumannii DU202 \n",
- "19 Acinetobacter baumannii strain FDA-CDC-AR_0305 \n",
- "20 Acinetobacter baumannii strain FDA-CDC-AR_0306 \n",
- "21 Acinetobacter baumannii strain FDA-CDC-AR_0307 \n",
- "22 Acinetobacter baumannii strain FDA-CDC-AR_0308 \n",
- "\n",
- " Antibiotics MIC o_mic s_mic r_mic i_mic \n",
- "0 Colistin 0.1 0.1 - 4 2 \n",
- "1 Colistin 1 1 - 4 2 \n",
- "2 Colistin 2 2 - 4 2 \n",
- "3 Colistin - 4 2 \n",
- "4 Ampicillin/sulbactam mg/L / 8/4 32/16 16/8 \n",
- "5 Ampicillin/sulbactam >=0.3 mg/L 0.3/ 8/4 32/16 16/8 \n",
- "6 Piperacillin/tazobactam 0 0 16/4 128/4 32/4-64/4 \n",
- "7 Piperacillin/tazobactam NA 16/4 128/4 32/4-64/4 \n",
- "8 Piperacillin/tazobactam >64/4 64/4 16/4 128/4 32/4-64/4 \n",
- "9 Ceftriaxone 16 16 8 64 16-32 \n",
- "10 Cefepime 8 8 8 32 16 \n",
- "11 Cefepime >256 256 8 32 16 \n",
- "12 Meropenem 0.25 0.25 2 8 4 \n",
- "13 Imipenem 1 1 2 8 4 \n",
- "14 Ceftazidime >128 128 8 32 16 \n",
- "15 Ciprofloxacin >32 32 1 4 2 \n",
- "16 Trimethoprim/sulfamethoxazole 8/152 8/152 2/38 4/76 - \n",
- "17 Trimethoprim/sulfamethoxazole 8/152 8/152 2/38 4/76 - \n",
- "18 Ticarcillin/clavulanicacid >=128/2 128/2 16/2 128/2 32/2-64/2 \n",
- "19 Polymyxinb 1 1 - 4 2 \n",
- "20 Polymyxinb 1 1 - 4 2 \n",
- "21 Polymyxinb 8 8 - 4 2 \n",
- "22 Polymyxinb 4 4 - 4 2 "
- ]
- },
- "execution_count": 53,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#compare CLSI Antibiotics only\n",
- "#result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner', indicator=True)[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','_merge']]\n",
- "try:\n",
- " result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner')[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','i_mic']]\n",
- "except KeyError:\n",
- " print('Waring: Error in input Values')\n",
- "result"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 44,
- "id": "44f7e35d",
- "metadata": {},
- "outputs": [
- {
- "ename": "ValueError",
- "evalue": "could not broadcast input array from shape (23,) into shape (23,1)",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m#compare MIC values and assign Susceptible and Resistant to Strain\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;31m#try:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'CLSI_profile'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'o_mic'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m's_mic'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'r_mic'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'i_mic'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msus_res\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0maxis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;31m#except ValueError:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;31m# print('Waring: Error in input MIC value')\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m__setitem__\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m 3158\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setitem_frame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3159\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mSeries\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndarray\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIndex\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3160\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setitem_array\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3161\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3162\u001b[0m \u001b[0;31m# set column\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m_setitem_array\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m 3196\u001b[0m )[1]\n\u001b[1;32m 3197\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_setitem_copy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3198\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miloc\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3199\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3200\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_setitem_frame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/indexing.py\u001b[0m in \u001b[0;36m__setitem__\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m 690\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 691\u001b[0m \u001b[0miloc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"iloc\"\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miloc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 692\u001b[0;31m \u001b[0miloc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setitem_with_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 693\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 694\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_validate_key\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/indexing.py\u001b[0m in \u001b[0;36m_setitem_with_indexer\u001b[0;34m(self, indexer, value, name)\u001b[0m\n\u001b[1;32m 1635\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setitem_with_indexer_split_path\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1636\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1637\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_setitem_single_block\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1638\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1639\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_setitem_with_indexer_split_path\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/indexing.py\u001b[0m in \u001b[0;36m_setitem_single_block\u001b[0;34m(self, indexer, value, name)\u001b[0m\n\u001b[1;32m 1859\u001b[0m \u001b[0;31m# actually do the set\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1860\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_consolidate_inplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1861\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mgr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mgr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1862\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_maybe_update_cacher\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mclear\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1863\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/internals/managers.py\u001b[0m in \u001b[0;36msetitem\u001b[0;34m(self, indexer, value)\u001b[0m\n\u001b[1;32m 566\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 567\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0msetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0;34m\"BlockManager\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 568\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"setitem\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 569\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 570\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mputmask\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmask\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnew\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0malign\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbool\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mint\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/internals/managers.py\u001b[0m in \u001b[0;36mapply\u001b[0;34m(self, f, align_keys, ignore_failures, **kwargs)\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0mapplied\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 426\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 427\u001b[0;31m \u001b[0mapplied\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 428\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mTypeError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mNotImplementedError\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 429\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mignore_failures\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m~/miniconda3/lib/python3.9/site-packages/pandas/core/internals/blocks.py\u001b[0m in \u001b[0;36msetitem\u001b[0;34m(self, indexer, value)\u001b[0m\n\u001b[1;32m 1033\u001b[0m \u001b[0;31m# set\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1034\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1035\u001b[0;31m \u001b[0mvalues\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1036\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1037\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtranspose\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mValueError\u001b[0m: could not broadcast input array from shape (23,) into shape (23,1)"
- ]
- }
- ],
- "source": [
- "#compare MIC values and assign Susceptible and Resistant to Strain\n",
- "#try:\n",
- "result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic','i_mic']].apply(sus_res,axis = 1)\n",
- "#except ValueError:\n",
- "# print('Waring: Error in input MIC value')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 61,
- "id": "30c2a7a3",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Strain name | \n",
- " Antibiotics | \n",
- " MIC | \n",
- " o_mic | \n",
- " s_mic | \n",
- " r_mic | \n",
- " i_mic | \n",
- " CLSI_profile | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 0.1 | \n",
- " 0.1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " Acinetobacter baumannii A85 | \n",
- " Colistin | \n",
- " 2 | \n",
- " 2 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " IntermediatE | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Colistin | \n",
- " | \n",
- " | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Strain could not classified | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ampicillin/sulbactam | \n",
- " mg/L | \n",
- " / | \n",
- " 8/4 | \n",
- " 32/16 | \n",
- " 16/8 | \n",
- " Strain could not classified | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ampicillin/sulbactam | \n",
- " >=0.3 mg/L | \n",
- " 0.3/ | \n",
- " 8/4 | \n",
- " 32/16 | \n",
- " 16/8 | \n",
- " Strain could not classified | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Piperacillin/tazobactam | \n",
- " 0 | \n",
- " 0 | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- " Strain could not classified | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Piperacillin/tazobactam | \n",
- " NA | \n",
- " | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- " Strain could not classified | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " Acinetobacter baumannii ORAB01 | \n",
- " Piperacillin/tazobactam | \n",
- " >64/4 | \n",
- " 64/4 | \n",
- " 16/4 | \n",
- " 128/4 | \n",
- " 32/4-64/4 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Ceftriaxone | \n",
- " 16 | \n",
- " 16 | \n",
- " 8 | \n",
- " 64 | \n",
- " 16-32 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 10 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Cefepime | \n",
- " 8 | \n",
- " 8 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- " Susceptible | \n",
- "
\n",
- " \n",
- " 11 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Cefepime | \n",
- " >256 | \n",
- " 256 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 12 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Meropenem | \n",
- " 0.25 | \n",
- " 0.25 | \n",
- " 2 | \n",
- " 8 | \n",
- " 4 | \n",
- " Susceptible | \n",
- "
\n",
- " \n",
- " 13 | \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Imipenem | \n",
- " 1 | \n",
- " 1 | \n",
- " 2 | \n",
- " 8 | \n",
- " 4 | \n",
- " Susceptible | \n",
- "
\n",
- " \n",
- " 14 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ceftazidime | \n",
- " >128 | \n",
- " 128 | \n",
- " 8 | \n",
- " 32 | \n",
- " 16 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 15 | \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " Ciprofloxacin | \n",
- " >32 | \n",
- " 32 | \n",
- " 1 | \n",
- " 4 | \n",
- " 2 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 16 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- " 2/38 | \n",
- " 4/76 | \n",
- " - | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 17 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- " 8/152 | \n",
- " 8/152 | \n",
- " 2/38 | \n",
- " 4/76 | \n",
- " - | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 18 | \n",
- " Acinetobacter baumannii DU202 | \n",
- " Ticarcillin/clavulanicacid | \n",
- " >=128/2 | \n",
- " 128/2 | \n",
- " 16/2 | \n",
- " 128/2 | \n",
- " 32/2-64/2 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 19 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0305 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 20 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0306 | \n",
- " Polymyxinb | \n",
- " 1 | \n",
- " 1 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Intermediate | \n",
- "
\n",
- " \n",
- " 21 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0307 | \n",
- " Polymyxinb | \n",
- " 8 | \n",
- " 8 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " 22 | \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0308 | \n",
- " Polymyxinb | \n",
- " 4 | \n",
- " 4 | \n",
- " - | \n",
- " 4 | \n",
- " 2 | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Strain name \\\n",
- "0 Acinetobacter baumannii A85 \n",
- "1 Acinetobacter baumannii A85 \n",
- "2 Acinetobacter baumannii A85 \n",
- "3 Acinetobacter baumannii DU202 \n",
- "4 Acinetobacter baumannii AB307-0294 \n",
- "5 Acinetobacter baumannii DU202 \n",
- "6 Acinetobacter baumannii AB307-0294 \n",
- "7 Acinetobacter baumannii DU202 \n",
- "8 Acinetobacter baumannii ORAB01 \n",
- "9 Acinetobacter baumannii AB307-0294 \n",
- "10 Acinetobacter baumannii AB307-0294 \n",
- "11 Acinetobacter baumannii AB5075-UW \n",
- "12 Acinetobacter baumannii AB307-0294 \n",
- "13 Acinetobacter baumannii AB307-0294 \n",
- "14 Acinetobacter baumannii AB5075-UW \n",
- "15 Acinetobacter baumannii AB5075-UW \n",
- "16 Acinetobacter baumannii DU202 \n",
- "17 Acinetobacter baumannii DU202 \n",
- "18 Acinetobacter baumannii DU202 \n",
- "19 Acinetobacter baumannii strain FDA-CDC-AR_0305 \n",
- "20 Acinetobacter baumannii strain FDA-CDC-AR_0306 \n",
- "21 Acinetobacter baumannii strain FDA-CDC-AR_0307 \n",
- "22 Acinetobacter baumannii strain FDA-CDC-AR_0308 \n",
- "\n",
- " Antibiotics MIC o_mic s_mic r_mic i_mic \\\n",
- "0 Colistin 0.1 0.1 - 4 2 \n",
- "1 Colistin 1 1 - 4 2 \n",
- "2 Colistin 2 2 - 4 2 \n",
- "3 Colistin - 4 2 \n",
- "4 Ampicillin/sulbactam mg/L / 8/4 32/16 16/8 \n",
- "5 Ampicillin/sulbactam >=0.3 mg/L 0.3/ 8/4 32/16 16/8 \n",
- "6 Piperacillin/tazobactam 0 0 16/4 128/4 32/4-64/4 \n",
- "7 Piperacillin/tazobactam NA 16/4 128/4 32/4-64/4 \n",
- "8 Piperacillin/tazobactam >64/4 64/4 16/4 128/4 32/4-64/4 \n",
- "9 Ceftriaxone 16 16 8 64 16-32 \n",
- "10 Cefepime 8 8 8 32 16 \n",
- "11 Cefepime >256 256 8 32 16 \n",
- "12 Meropenem 0.25 0.25 2 8 4 \n",
- "13 Imipenem 1 1 2 8 4 \n",
- "14 Ceftazidime >128 128 8 32 16 \n",
- "15 Ciprofloxacin >32 32 1 4 2 \n",
- "16 Trimethoprim/sulfamethoxazole 8/152 8/152 2/38 4/76 - \n",
- "17 Trimethoprim/sulfamethoxazole 8/152 8/152 2/38 4/76 - \n",
- "18 Ticarcillin/clavulanicacid >=128/2 128/2 16/2 128/2 32/2-64/2 \n",
- "19 Polymyxinb 1 1 - 4 2 \n",
- "20 Polymyxinb 1 1 - 4 2 \n",
- "21 Polymyxinb 8 8 - 4 2 \n",
- "22 Polymyxinb 4 4 - 4 2 \n",
- "\n",
- " CLSI_profile \n",
- "0 Intermediate \n",
- "1 Intermediate \n",
- "2 IntermediatE \n",
- "3 Strain could not classified \n",
- "4 Strain could not classified \n",
- "5 Strain could not classified \n",
- "6 Strain could not classified \n",
- "7 Strain could not classified \n",
- "8 Intermediate \n",
- "9 Intermediate \n",
- "10 Susceptible \n",
- "11 Resistant \n",
- "12 Susceptible \n",
- "13 Susceptible \n",
- "14 Resistant \n",
- "15 Resistant \n",
- "16 Resistant \n",
- "17 Resistant \n",
- "18 Resistant \n",
- "19 Intermediate \n",
- "20 Intermediate \n",
- "21 Resistant \n",
- "22 Resistant "
- ]
- },
- "execution_count": 61,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "result"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "id": "ab7d8379",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result[['Strain name', 'Antibiotics', 'MIC','s_mic','r_mic','CLSI_profile']].to_csv(output_profile,sep=',', index=False, encoding='utf-8-sig')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "id": "a426ae2b",
- "metadata": {},
- "outputs": [],
- "source": [
- "#create a pivot table for ASIST\n",
- "table=result[['Strain name', 'Antibiotics','CLSI_profile']].drop_duplicates()\n",
- "result_table=pd.pivot_table(table, values ='CLSI_profile', index =['Strain name'],columns =['Antibiotics'], aggfunc = lambda x: ' '.join(x))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 18,
- "id": "df439a58",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " Antibiotics | \n",
- " Ampicillin/sulbactam | \n",
- " Cefepime | \n",
- " Ceftazidime | \n",
- " Ceftriaxone | \n",
- " Ciprofloxacin | \n",
- " Colistin | \n",
- " Imipenem | \n",
- " Meropenem | \n",
- " Piperacillin/tazobactam | \n",
- " Polymyxinb | \n",
- " Ticarcillin/clavulanicacid | \n",
- " Trimethoprim/sulfamethoxazole | \n",
- "
\n",
- " \n",
- " Strain name | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " Acinetobacter baumannii A85 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " Strain could not classified | \n",
- " Susceptible | \n",
- " NaN | \n",
- " Intermediate | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- " Susceptible | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " NaN | \n",
- " Resistant | \n",
- " Resistant | \n",
- " NaN | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii DU202 | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " NaN | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " Resistant | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii ORAB01 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Intermediate | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0305 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0306 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0307 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0308 | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- "Antibiotics Ampicillin/sulbactam \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 Strain could not classified \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Cefepime Ceftazidime \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN NaN \n",
- "Acinetobacter baumannii AB307-0294 Susceptible NaN \n",
- "Acinetobacter baumannii AB5075-UW Resistant Resistant \n",
- "Acinetobacter baumannii DU202 NaN NaN \n",
- "Acinetobacter baumannii ORAB01 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN NaN \n",
- "\n",
- "Antibiotics Ceftriaxone Ciprofloxacin \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN NaN \n",
- "Acinetobacter baumannii AB307-0294 Intermediate NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN Resistant \n",
- "Acinetobacter baumannii DU202 NaN NaN \n",
- "Acinetobacter baumannii ORAB01 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN NaN \n",
- "\n",
- "Antibiotics Colistin \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 Susceptible \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Imipenem Meropenem \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN NaN \n",
- "Acinetobacter baumannii AB307-0294 Susceptible Susceptible \n",
- "Acinetobacter baumannii AB5075-UW NaN NaN \n",
- "Acinetobacter baumannii DU202 NaN NaN \n",
- "Acinetobacter baumannii ORAB01 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN NaN \n",
- "\n",
- "Antibiotics Piperacillin/tazobactam \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 Strain could not classified \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 Intermediate \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Polymyxinb \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 NaN \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 Susceptible \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 Susceptible \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 Resistant \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 Resistant \n",
- "\n",
- "Antibiotics Ticarcillin/clavulanicacid \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Resistant \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Trimethoprim/sulfamethoxazole \n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Resistant \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN "
- ]
- },
- "execution_count": 18,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "result_table"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 19,
- "id": "ee19e872",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result_table.to_csv(output_table,na_rep='NA')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 20,
- "id": "692ab948",
- "metadata": {},
- "outputs": [],
- "source": [
- "# reorder the Antibiotics for ASIST\n",
- "clsi_ab=['Amikacin','Tobramycin','Gentamycin','Imipenem','Meropenem','Doripenem','Ciprofloxacin','Levofloxacin',\n",
- " 'Piperacillin/tazobactam','Ticarcillin/clavulanicacid','Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime',\n",
- " 'Trimethoprim/sulfamethoxazole','Ampicillin/sulbactam','Colistin','Polymyxinb','Tetracycline','Doxicycline ',\n",
- " 'Minocycline']\n",
- "result_selected=result_table.filter(clsi_ab)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 21,
- "id": "e0d983b9",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(9, 12)"
- ]
- },
- "execution_count": 21,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "result_selected.shape"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "id": "04376d0a",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(9, 12)"
- ]
- },
- "execution_count": 22,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "result_table.shape"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "id": "1b0a4d77",
- "metadata": {},
- "outputs": [],
- "source": [
- "result_selected.insert(0,'Resistance_phenotype','')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 24,
- "id": "d36dcdab",
- "metadata": {},
- "outputs": [],
- "source": [
- "result_selected.to_csv(output_table,na_rep='NA')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 25,
- "id": "5c162c07",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " Antibiotics | \n",
- " Resistance_phenotype | \n",
- " Imipenem | \n",
- " Meropenem | \n",
- " Ciprofloxacin | \n",
- " Piperacillin/ tazobactam | \n",
- " Ticarcillin/clavulanic acid | \n",
- " Ceftriaxone | \n",
- " Ceftazidime | \n",
- " Cefepime | \n",
- " Trimethoprim/ sulfamethoxazole | \n",
- " Ampicillin/ sulbactam | \n",
- " Colistin | \n",
- " Polymyxin B | \n",
- "
\n",
- " \n",
- " Strain name | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- " | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " Acinetobacter baumannii A85 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii AB307-0294 | \n",
- " | \n",
- " Susceptible | \n",
- " Susceptible | \n",
- " NaN | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " Intermediate | \n",
- " NaN | \n",
- " Susceptible | \n",
- " NaN | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii AB5075-UW | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii DU202 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Strain could not classified | \n",
- " Resistant | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- " Strain could not classified | \n",
- " Strain could not classified | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii ORAB01 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Intermediate | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0305 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0306 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Susceptible | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0307 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- " Acinetobacter baumannii strain FDA-CDC-AR_0308 | \n",
- " | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " NaN | \n",
- " Resistant | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- "Antibiotics Resistance_phenotype \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 \n",
- "Acinetobacter baumannii AB307-0294 \n",
- "Acinetobacter baumannii AB5075-UW \n",
- "Acinetobacter baumannii DU202 \n",
- "Acinetobacter baumannii ORAB01 \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 \n",
- "\n",
- "Antibiotics Imipenem Meropenem \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN NaN \n",
- "Acinetobacter baumannii AB307-0294 Susceptible Susceptible \n",
- "Acinetobacter baumannii AB5075-UW NaN NaN \n",
- "Acinetobacter baumannii DU202 NaN NaN \n",
- "Acinetobacter baumannii ORAB01 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN NaN \n",
- "\n",
- "Antibiotics Ciprofloxacin \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW Resistant \n",
- "Acinetobacter baumannii DU202 NaN \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Piperacillin/ tazobactam \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 Strain could not classified \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 Intermediate \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Ticarcillin/clavulanic acid \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Resistant \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Ceftriaxone Ceftazidime \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN NaN \n",
- "Acinetobacter baumannii AB307-0294 Intermediate NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN Resistant \n",
- "Acinetobacter baumannii DU202 NaN NaN \n",
- "Acinetobacter baumannii ORAB01 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN NaN \n",
- "\n",
- "Antibiotics Cefepime \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 Susceptible \n",
- "Acinetobacter baumannii AB5075-UW Resistant \n",
- "Acinetobacter baumannii DU202 NaN \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Trimethoprim/ sulfamethoxazole \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Resistant \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Ampicillin/ sulbactam \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 Strain could not classified \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Colistin \\\n",
- "Strain name \n",
- "Acinetobacter baumannii A85 Susceptible \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 Strain could not classified \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 NaN \n",
- "\n",
- "Antibiotics Polymyxin B \n",
- "Strain name \n",
- "Acinetobacter baumannii A85 NaN \n",
- "Acinetobacter baumannii AB307-0294 NaN \n",
- "Acinetobacter baumannii AB5075-UW NaN \n",
- "Acinetobacter baumannii DU202 NaN \n",
- "Acinetobacter baumannii ORAB01 NaN \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0305 Susceptible \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0306 Susceptible \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0307 Resistant \n",
- "Acinetobacter baumannii strain FDA-CDC-AR_0308 Resistant "
- ]
- },
- "execution_count": 25,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#rename headers\n",
- "result_selected.rename(columns = {'Ticarcillin/clavulanicacid':'Ticarcillin/clavulanic acid','Piperacillin/tazobactam':'Piperacillin/ tazobactam','Trimethoprim/sulfamethoxazole': 'Trimethoprim/ sulfamethoxazole','Ampicillin/sulbactam':'Ampicillin/ sulbactam', 'Polymyxinb': 'Polymyxin B'} )"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "00cd53d4",
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "475401df",
- "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.9.1"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff -r 62226cd1acb5 -r c5ffaf5288fe clsi_profile_type2_linux.ipynb
--- a/clsi_profile_type2_linux.ipynb Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,447 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 206,
- "id": "967b1345",
- "metadata": {},
- "outputs": [],
- "source": [
- "# ASIST module2 | map AST result to the CLSI breakporints with combination antibiotics\n",
- "# By rakesh4osdd@gmail.com, 06-Jun-2021\n",
- "import pandas as pd\n",
- "import re\n",
- "import sys"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 207,
- "id": "39e25c15",
- "metadata": {},
- "outputs": [],
- "source": [
- "#print(pd.__version__, re.__version__)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 208,
- "id": "43115c0a",
- "metadata": {},
- "outputs": [],
- "source": [
- "# compare two MIC value strings\n",
- "def check_mic(mic1,mic2,mic_type):\n",
- " #print(mic1,mic2,mic_type)\n",
- " try:\n",
- " if '/' in mic1:\n",
- " m1a = mic1.split('/')[0]\n",
- " m1b = mic1.split('/')[1]\n",
- " if float(m1a)==0 or float(m1b)==0:\n",
- " strain_type='Strain could not be classified'\n",
- " return(strain_type) \n",
- " elif '/' in mic2:\n",
- " m1a = mic1\n",
- " if float(m1a)==0:\n",
- " strain_type='Strain could not be classified'\n",
- " return(strain_type) \n",
- " m1b = '1'\n",
- " elif float(mic1)==0:\n",
- " strain_type='Strain could not be classified'\n",
- " return(strain_type)\n",
- " else:\n",
- " m1a = mic1\n",
- " \n",
- " if '-' in mic2:\n",
- " m2a = mic2.split('-')[0]\n",
- " m2b = mic2.split('-')[1] \n",
- " \n",
- " except ValueError:\n",
- " strain_type='Strain could not be classified' \n",
- " return(strain_type)\n",
- " try:\n",
- " if '-' in mic2 and mic_type == 'i': # for intermediate only\n",
- " if '/' in mic2:\n",
- " m2a = mic2.split('-')[0].split('/')[0]\n",
- " m2b = mic2.split('-')[0].split('/')[1]\n",
- " m2aa = mic2.split('-')[1].split('/')[0]\n",
- " m2bb = mic2.split('-')[1].split('/')[1]\n",
- " if (float(m2aa)>=float(m1a)>=float(m2a) and float(m2bb)>=float(m1b)>=float(m2b)):\n",
- " #print('intermediate')\n",
- " m_type='Intermediate'\n",
- " else:\n",
- " #print('not define')\n",
- " m_type='Strain could not be classified'\n",
- " else:\n",
- " m2a = mic2.split('-')[0]\n",
- " m2b = mic2.split('-')[1] \n",
- " if (float(m2b)>=float(m1a)>=float(m2a)):\n",
- " #print('intermediate')\n",
- " m_type='Intermediate'\n",
- " else:\n",
- " #print('not define')\n",
- " m_type='Strain could not be classified' \n",
- " #print (m1a,m1b,m2a,m2b,m2aa,m2bb)\n",
- " elif '/' in mic2:\n",
- " m2a = mic2.split('/')[0]\n",
- " m2b = mic2.split('/')[1]\n",
- " #print(m1a,m1b,m2a,m2b,mic_type)\n",
- " if (mic_type=='s' and (float(m1a)<=float(m2a) and float(m1b)<=float(m2b))):\n",
- " m_type='Susceptible'\n",
- " elif (mic_type=='r' and (float(m1a)>=float(m2a) and float(m1b)>=float(m2b))):\n",
- " m_type='Resistant'\n",
- " elif (mic_type=='i' and (float(m1a)==float(m2a) and float(m1b)==float(m2b))):\n",
- " m_type='Intermediate'\n",
- " else:\n",
- " m_type='Strain could not be classified'\n",
- " elif '-' in mic2:\n",
- " m_type='Strain could not be classified'\n",
- " else:\n",
- " m2a=mic2\n",
- " if (mic_type=='s' and (float(m1a)<=float(m2a))):\n",
- " m_type='Susceptible'\n",
- " elif (mic_type=='r' and (float(m1a)>=float(m2a))):\n",
- " m_type='Resistant'\n",
- " elif (mic_type=='i' and (float(m1a)==float(m2a))):\n",
- " m_type='Intermediate'\n",
- " else:\n",
- " m_type='Strain could not be classified-1' \n",
- " except IndexError:\n",
- " strain_type='Strain could not be classified-2' \n",
- " return(strain_type)\n",
- " \n",
- " return(m_type)\n",
- "\n",
- "#check_mic('65','32-64','i')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 209,
- "id": "0448ebf3",
- "metadata": {},
- "outputs": [],
- "source": [
- "# compare MIC value in pandas list\n",
- "def sus_res_int(mic):\n",
- " #print(mic)\n",
- " o_mic = mic[0].replace(' ', '')\n",
- " s_mic = mic[1].replace(' ', '')\n",
- " r_mic = mic[2].replace(' ', '')\n",
- " i_mic = mic[3].replace(' ', '')\n",
- " try:\n",
- " if check_mic(o_mic,s_mic,'s')=='Susceptible':\n",
- " strain_type='Susceptible'\n",
- " elif check_mic(o_mic,r_mic,'r')=='Resistant':\n",
- " strain_type='Resistant'\n",
- " elif check_mic(o_mic,i_mic,'i')=='Intermediate':\n",
- " strain_type='Intermediate' \n",
- " else:\n",
- " strain_type='Strain could not be classified'\n",
- " except ValueError:\n",
- " strain_type='Strain could not be classified' \n",
- " return(strain_type)\n",
- "\n",
- "#mic=['128','16/4','128/4','32/4-64/4']\n",
- "#sus_res_int(mic)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 210,
- "id": "7784b77d",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'input_user = sys.argv[1]\\ninput_clsi = sys.argv[2]\\noutput_table = sys.argv[3]'"
- ]
- },
- "execution_count": 210,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# for input argument\n",
- "\"\"\"input_user = sys.argv[1]\n",
- "input_clsi = sys.argv[2]\n",
- "output_table = sys.argv[3]\"\"\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 211,
- "id": "1dee9127",
- "metadata": {},
- "outputs": [],
- "source": [
- "input_user='input.csv'\n",
- "input_clsi='clsi.csv'\n",
- "output_profile=input_user+'_profile.csv'\n",
- "output_table=input_user+'_table.csv'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 212,
- "id": "14c5cfd3",
- "metadata": {},
- "outputs": [],
- "source": [
- "# read user AST data with selected 3 columns\n",
- "strain_mic=pd.read_csv(input_user, sep=',', usecols =['Strain name', 'Antibiotics', 'MIC'],na_filter=False)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 213,
- "id": "77135cb7",
- "metadata": {},
- "outputs": [],
- "source": [
- "clsi_bp=pd.read_csv(input_clsi,sep=',')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 214,
- "id": "2ec1cbec",
- "metadata": {},
- "outputs": [],
- "source": [
- "#clsi_bp\n",
- "#strain_mic"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 215,
- "id": "860505f7",
- "metadata": {},
- "outputs": [],
- "source": [
- "# convert MIC to numbers sMIC, rMIC\n",
- "clsi_bp['s_mic'] =clsi_bp[['Susceptible']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))\n",
- "clsi_bp['r_mic'] =clsi_bp[['Resistant']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))\n",
- "clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 216,
- "id": "3eee0538",
- "metadata": {},
- "outputs": [],
- "source": [
- "#clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 217,
- "id": "2b6c02f5",
- "metadata": {},
- "outputs": [],
- "source": [
- "# Read only numbers in MIC values\n",
- "#try:\n",
- "strain_mic['o_mic']=strain_mic[['MIC']].applymap(lambda x: (re.sub(r'[^0-9.\\/]','', x)))\n",
- "#except TypeError:\n",
- "# print('Waring: Error in MIC value')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 218,
- "id": "942fefb2",
- "metadata": {},
- "outputs": [],
- "source": [
- "#strain_mic"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 219,
- "id": "bba6b0a2",
- "metadata": {},
- "outputs": [],
- "source": [
- "# capitalize each Antibiotic Name for comparision with removing whitespace\n",
- "strain_mic['Antibiotics']=strain_mic['Antibiotics'].str.capitalize().str.replace(\" \",\"\")\n",
- "clsi_bp['Antibiotics']=clsi_bp['Antibiotics'].str.capitalize().str.replace(\" \",\"\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 220,
- "id": "ea403928",
- "metadata": {},
- "outputs": [],
- "source": [
- "#compare CLSI Antibiotics only\n",
- "#result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner', indicator=True)[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','_merge']]\n",
- "try:\n",
- " result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner')[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','i_mic']]\n",
- "except KeyError:\n",
- " print('Waring: Error in input Values')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 221,
- "id": "44f7e35d",
- "metadata": {},
- "outputs": [],
- "source": [
- "#compare MIC values and assign Susceptible and Resistant to Strain\n",
- "#try:\n",
- "result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic','i_mic']].apply(sus_res_int,axis = 1)\n",
- "#except ValueError:\n",
- "# print('Waring: Error in input MIC value')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 222,
- "id": "30c2a7a3",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 223,
- "id": "ab7d8379",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result[['Strain name', 'Antibiotics', 'MIC','s_mic','r_mic','CLSI_profile']].to_csv(output_profile,sep=',', index=False, encoding='utf-8-sig')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 224,
- "id": "a426ae2b",
- "metadata": {},
- "outputs": [],
- "source": [
- "#create a pivot table for ASIST\n",
- "table=result[['Strain name', 'Antibiotics','CLSI_profile']].drop_duplicates()\n",
- "result_table=pd.pivot_table(table, values ='CLSI_profile', index =['Strain name'],columns =['Antibiotics'], aggfunc = lambda x: ' '.join(x))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 225,
- "id": "df439a58",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result_table"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 226,
- "id": "ee19e872",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result_table.to_csv(output_table,na_rep='NA')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 227,
- "id": "692ab948",
- "metadata": {},
- "outputs": [],
- "source": [
- "# reorder the Antibiotics for ASIST\n",
- "clsi_ab=['Amikacin','Tobramycin','Gentamycin','Imipenem','Meropenem','Doripenem','Ciprofloxacin','Levofloxacin',\n",
- " 'Piperacillin/tazobactam','Ticarcillin/clavulanicacid','Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime',\n",
- " 'Trimethoprim/sulfamethoxazole','Ampicillin/sulbactam','Colistin','Polymyxinb','Tetracycline','Doxicycline ',\n",
- " 'Minocycline']\n",
- "result_selected=result_table.filter(clsi_ab)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 228,
- "id": "e0d983b9",
- "metadata": {},
- "outputs": [],
- "source": [
- "#print(result_selected.shape, result_table.shape)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 229,
- "id": "1b0a4d77",
- "metadata": {},
- "outputs": [],
- "source": [
- "result_selected.insert(0,'Resistance_phenotype','')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 230,
- "id": "5c162c07",
- "metadata": {},
- "outputs": [],
- "source": [
- "#rename headers\n",
- "result_selected=result_selected.rename(columns = {'Ticarcillin/clavulanicacid':'Ticarcillin/clavulanic acid','Piperacillin/tazobactam':'Piperacillin/ tazobactam','Trimethoprim/sulfamethoxazole': 'Trimethoprim/ sulfamethoxazole','Ampicillin/sulbactam':'Ampicillin/ sulbactam', 'Polymyxinb': 'Polymyxin B'} )"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 231,
- "id": "00cd53d4",
- "metadata": {},
- "outputs": [],
- "source": [
- "#result_selected"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 232,
- "id": "d36dcdab",
- "metadata": {},
- "outputs": [],
- "source": [
- "result_selected.to_csv(output_table,na_rep='NA')"
- ]
- }
- ],
- "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.9.1"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/clsi.csv
--- a/dump/clsi.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-Antibiotics,Susceptible,Resistant
-Amikacin,≤ 16,≥ 64
-Tobramycin,≤ 4,≥ 16
-Gentamicin,≤ 4,≥ 16
-Netilmicin,≤ 8,≥ 32
-Imipenem,≤ 2,≥ 8
-Meropenem,≤ 2,≥ 8
-Doripenem,≤ 2,≥ 8
-Ciprofloxacin,≤ 1,≥ 4
-Levofloxacin,≤ 2,≥ 8
-Piperacillin/ tazobactam,≤ 16/4,≥ 128/4
-Ticarcillin/ clavulanic acid,≤ 16/2,≥ 128/2
-Cefotaxime,≤ 8,≥ 64
-Ceftriaxone,≤ 8,≥ 64
-Ceftazidime,≤ 8,≥ 32
-Cefepime,≤ 8,≥ 32
-Trimethoprim/ sulfamethoxazole,≤ 2/38,≥ 4/76
-Ampicillin/ sulbactam,≤ 8/4,≥ 32/16
-Colistin,≤ 2,≥ 4
-Polymyxin B,≤ 2,≥ 4
-Tetracycline,≤ 4,≥ 16
-Doxycycline,≤ 4,≥ 16
-Minocycline,≤ 4,≥ 16
\ No newline at end of file
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/clsi_profile.xml
--- a/dump/clsi_profile.xml Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-
- MIC profile using CLSI MIC breakpoints
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/clsi_profile_comb.csv
--- a/dump/clsi_profile_comb.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-Antibiotics,Susceptible,Resistant
-Amikacin,≤ 16,≥ 64
-Tobramycin,≤ 4,≥ 16
-Gentamicin,≤ 4,≥ 16
-Netilmicin,≤ 8,≥ 32
-Imipenem,≤ 2,≥ 8
-Meropenem,≤ 2,≥ 8
-Doripenem,≤ 2,≥ 8
-Ciprofloxacin,≤ 1,≥ 4
-Levofloxacin,≤ 2,≥ 8
-Piperacillin/ tazobactam,≤ 16/4,≥ 128/4
-Ticarcillin/ clavulanic acid,≤ 16/2,≥ 128/2
-Cefotaxime,≤ 8,≥ 64
-Ceftriaxone,≤ 8,≥ 64
-Ceftazidime,≤ 8,≥ 32
-Cefepime,≤ 8,≥ 32
-Trimethoprim/ sulfamethoxazole,≤ 2/38,≥ 4/76
-Ampicillin/ sulbactam,≤ 8/4,≥ 32/16
-Colistin,≤ 2,≥ 4
-Polymyxin B,≤ 2,≥ 4
-Tetracycline,≤ 4,≥ 16
-Doxycycline,≤ 4,≥ 16
-Minocycline,≤ 4,≥ 16
\ No newline at end of file
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/input.csv
--- a/dump/input.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-id,genome Ids,Strain name,Antibiotics,Resistance_profile,sign,MIC,unit
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,0.1,mg/L
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,1,mg/L
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,2,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin,resistant,>=,0,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin/sulbactam,susceptible,<=,mg/L,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,piperacillin/tazobactam,susceptible,<=,0,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefazolin,resistant,>=,64,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ceftriaxone,susceptible,==,16,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefepime,susceptible,==,8,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Meropenem,susceptible,<=,0.25,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Imipenem,susceptible,<=,1,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Tigecycline,susceptible,<=,0.5,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ceftazidime,Resistant,NA,>128,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Cefepime,Resistant,NA,>256,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ciprofloxacin,Resistant,NA,>32,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,colistin ,Susceptible,NA,,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,Ampicillin/sulbactam,Resistant,NA,>=0.3 mg/L,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,ticarcillin/clavulanic acid,Resistant,NA,>=128/2,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,piperacillin/tazobactam ,Resistant,NA,NA,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L
-470,CP015483.1,Acinetobacter baumannii ORAB01,piperacillin/tazobactam,Resistant,NA,>64/4,mg/L
-470,470.7601,Acinetobacter baumannii strain MRSN7100,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7651,Acinetobacter baumannii strain MRSN7168,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7764,Acinetobacter baumannii strain MRSN7336,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.8071,Acinetobacter baumannii strain MRSN7834,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7405,Acinetobacter baumannii strain FDA-CDC-AR_0305,polymyxin B,Susceptible,==,1,mg/L
-470,470.7406,Acinetobacter baumannii strain FDA-CDC-AR_0306,polymyxin B,Susceptible,==,1,mg/L
-470,470.7407,Acinetobacter baumannii strain FDA-CDC-AR_0307,polymyxin B,Resistant,==,8,mg/L
-470,470.7408,Acinetobacter baumannii strain FDA-CDC-AR_0308,polymyxin B,Resistant,==,4,mg/L
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/input_ast_comb2.csv
--- a/dump/input_ast_comb2.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-id,genome Ids,Strain name,Antibiotics,Resistance_profile,sign,MIC,unit
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,0.1,mg/L
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,1,mg/L
-470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,2,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin,resistant,>=,0,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin/sulbactam,susceptible,<=,mg/L,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,piperacillin/tazobactam,susceptible,<=,0,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefazolin,resistant,>=,64,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Ceftriaxone,susceptible,==,16,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefepime,susceptible,==,8,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Meropenem,susceptible,<=,0.25,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Imipenem,susceptible,<=,1,mg/L
-470,CP001172.2,Acinetobacter baumannii AB307-0294,Tigecycline,susceptible,<=,0.5,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ceftazidime,Resistant,NA,>128,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Cefepime,Resistant,NA,>256,mg/L
-470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ciprofloxacin,Resistant,NA,>32,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,colistin ,Susceptible,NA,,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,Ampicillin/sulbactam,Resistant,NA,>=0.3 mg/L,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,ticarcillin/clavulanic acid,Resistant,NA,>=128/2,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,piperacillin/tazobactam ,Resistant,NA,NA,mg/L
-470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L
-470,CP015483.1,Acinetobacter baumannii ORAB01,piperacillin/tazobactam,Resistant,NA,>64/4,mg/L
-470,470.7601,Acinetobacter baumannii strain MRSN7100,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7651,Acinetobacter baumannii strain MRSN7168,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7764,Acinetobacter baumannii strain MRSN7336,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.8071,Acinetobacter baumannii strain MRSN7834,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L
-470,470.7405,Acinetobacter baumannii strain FDA-CDC-AR_0305,polymyxin B,Susceptible,==,1,mg/L
-470,470.7406,Acinetobacter baumannii strain FDA-CDC-AR_0306,polymyxin B,Susceptible,==,1,mg/L
-470,470.7407,Acinetobacter baumannii strain FDA-CDC-AR_0307,polymyxin B,Resistant,==,8,mg/L
-470,470.7408,Acinetobacter baumannii strain FDA-CDC-AR_0308,polymyxin B,Resistant,==,4,mg/L
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/input_ast_comb2.csv_table.csv
--- a/dump/input_ast_comb2.csv_table.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-Strain name,Resistance_phenotype,Imipenem,Meropenem,Ciprofloxacin,Piperacillin/tazobactam,Ticarcillin/clavulanicacid,Ceftriaxone,Ceftazidime,Cefepime,Trimethoprim/sulfamethoxazole,Ampicillin/sulbactam,Colistin,Polymyxinb
-Acinetobacter baumannii A85,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible,NA
-Acinetobacter baumannii AB307-0294,,Susceptible,Susceptible,NA,Strain could not classified,NA,Intermediate,NA,Susceptible,NA,Strain could not classified,NA,NA
-Acinetobacter baumannii AB5075-UW,,NA,NA,Resistant,NA,NA,NA,Resistant,Resistant,NA,NA,NA,NA
-Acinetobacter baumannii DU202,,NA,NA,NA,Strain could not classified,Resistant,NA,NA,NA,Resistant,Strain could not classified,Strain could not classified,NA
-Acinetobacter baumannii ORAB01,,NA,NA,NA,Intermediate,NA,NA,NA,NA,NA,NA,NA,NA
-Acinetobacter baumannii strain FDA-CDC-AR_0305,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible
-Acinetobacter baumannii strain FDA-CDC-AR_0306,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible
-Acinetobacter baumannii strain FDA-CDC-AR_0307,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Resistant
-Acinetobacter baumannii strain FDA-CDC-AR_0308,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Resistant
diff -r 62226cd1acb5 -r c5ffaf5288fe dump/output.csv
--- a/dump/output.csv Fri Jun 11 12:36:25 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-Strain name,Resistance_phenotype,Imipenem,Meropenem,Ciprofloxacin,Piperacillin/tazobactam,Ticarcillin/clavulanicacid,Ceftriaxone,Ceftazidime,Cefepime,Trimethoprim/sulfamethoxazole,Ampicillin/sulbactam,Colistin,Polymyxinb
-Acinetobacter baumannii A85,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible,NA
-Acinetobacter baumannii AB307-0294,,Susceptible,Susceptible,NA,Strain could not classified,NA,Intermediate,NA,Susceptible,NA,Strain could not classified,NA,NA
-Acinetobacter baumannii AB5075-UW,,NA,NA,Resistant,NA,NA,NA,Resistant,Resistant,NA,NA,NA,NA
-Acinetobacter baumannii DU202,,NA,NA,NA,Strain could not classified,Resistant,NA,NA,NA,Resistant,Strain could not classified,Strain could not classified,NA
-Acinetobacter baumannii ORAB01,,NA,NA,NA,Intermediate,NA,NA,NA,NA,NA,NA,NA,NA
-Acinetobacter baumannii strain FDA-CDC-AR_0305,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible
-Acinetobacter baumannii strain FDA-CDC-AR_0306,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Susceptible
-Acinetobacter baumannii strain FDA-CDC-AR_0307,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Resistant
-Acinetobacter baumannii strain FDA-CDC-AR_0308,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Resistant