Mercurial > repos > rakesh4osdd > clsi_profile
changeset 0:62226cd1acb5 draft
"planemo upload for repository https://github.com/rakesh4osdd/clsi_profile/tree/master commit ae6f2bc197b28000c56f6368ad044b350bc34f6a"
author | rakesh4osdd |
---|---|
date | Fri, 11 Jun 2021 12:36:25 +0000 |
parents | |
children | c5ffaf5288fe |
files | LICENSE README.md clsi.csv clsi_profile.py clsi_profile.xml clsi_profile_type2.py clsi_profile_type2_linux-Copy1.ipynb clsi_profile_type2_linux.ipynb dump/clsi.csv dump/clsi_profile.xml dump/clsi_profile_comb.csv dump/input.csv dump/input_ast_comb2.csv dump/input_ast_comb2.csv_table.csv dump/output.csv input.csv input.csv_table.csv output.csv test-data/clsi.csv test-data/input.csv test-data/output.csv tool.sh tool_shed.sh |
diffstat | 23 files changed, 3854 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 RAKESH KUMAR + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,2 @@ +# clsi_profile +CLSI profile for ASIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,23 @@ +Antibiotics,Susceptible,Resistant,Intermediate +Amikacin,≤ 16,≥ 64,32 +Tobramycin,≤ 4,≥ 16,8 +Gentamicin,≤ 4,≥ 16,8 +Netilmicin,≤ 8,≥ 32,16 +Imipenem,≤ 2,≥ 8,4 +Meropenem,≤ 2,≥ 8,4 +Doripenem,≤ 2,≥ 8,4 +Ciprofloxacin,≤ 1,≥ 4,2 +Levofloxacin,≤ 2,≥ 8,4 +Piperacillin/ tazobactam,≤ 16/4,≥ 128/4,32/4-64/4 +Ticarcillin/ clavulanic acid,≤ 16/2,≥ 128/2,32/2-64/2 +Cefotaxime,≤ 8,≥ 64,16-32 +Ceftriaxone,≤ 8,≥ 64,16-32 +Ceftazidime,≤ 8,≥ 32,16 +Cefepime,≤ 8,≥ 32,16 +Trimethoprim/ sulfamethoxazole,≤ 2/38,≥ 4/76,- +Ampicillin/ sulbactam,≤ 8/4,≥ 32/16,16/8 +Colistin,-,≥ 4,≤ 2 +Polymyxin B,-,≥ 4,≤ 2 +Tetracycline,≤ 4,≥ 16,8 +Doxycycline,≤ 4,≥ 16,8 +Minocycline,≤ 4,≥ 16,8 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile.py Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,305 @@ +#!/usr/bin/env python +# coding: utf-8 + +# In[206]: + + +# 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[207]: + + +#print(pd.__version__, re.__version__) + + +# In[208]: + + +# compare two MIC value strings +def check_mic(mic1,mic2,mic_type): + #print(mic1,mic2,mic_type) + try: + if '/' in mic1: + m1a = mic1.split('/')[0] + m1b = mic1.split('/')[1] + if float(m1a)==0 or float(m1b)==0: + strain_type='Strain could not be classified' + return(strain_type) + elif '/' in mic2: + m1a = mic1 + if float(m1a)==0: + strain_type='Strain could not be classified' + return(strain_type) + m1b = '1' + elif float(mic1)==0: + strain_type='Strain could not be classified' + return(strain_type) + else: + m1a = mic1 + + if '-' in mic2: + m2a = mic2.split('-')[0] + m2b = mic2.split('-')[1] + + except ValueError: + strain_type='Strain could not be classified' + return(strain_type) + try: + if '-' in mic2 and mic_type == 'i': # for intermediate only + if '/' in mic2: + m2a = mic2.split('-')[0].split('/')[0] + m2b = mic2.split('-')[0].split('/')[1] + m2aa = mic2.split('-')[1].split('/')[0] + m2bb = mic2.split('-')[1].split('/')[1] + if (float(m2aa)>=float(m1a)>=float(m2a) and float(m2bb)>=float(m1b)>=float(m2b)): + #print('intermediate') + m_type='Intermediate' + else: + #print('not define') + m_type='Strain could not be classified' + else: + m2a = mic2.split('-')[0] + m2b = mic2.split('-')[1] + if (float(m2b)>=float(m1a)>=float(m2a)): + #print('intermediate') + m_type='Intermediate' + else: + #print('not define') + m_type='Strain could not be classified' + #print (m1a,m1b,m2a,m2b,m2aa,m2bb) + elif '/' in mic2: + m2a = mic2.split('/')[0] + m2b = mic2.split('/')[1] + #print(m1a,m1b,m2a,m2b,mic_type) + if (mic_type=='s' and (float(m1a)<=float(m2a) and float(m1b)<=float(m2b))): + m_type='Susceptible' + elif (mic_type=='r' and (float(m1a)>=float(m2a) and float(m1b)>=float(m2b))): + m_type='Resistant' + elif (mic_type=='i' and (float(m1a)==float(m2a) and float(m1b)==float(m2b))): + m_type='Intermediate' + else: + m_type='Strain could not be classified' + elif '-' in mic2: + m_type='Strain could not be classified' + else: + m2a=mic2 + if (mic_type=='s' and (float(m1a)<=float(m2a))): + m_type='Susceptible' + elif (mic_type=='r' and (float(m1a)>=float(m2a))): + m_type='Resistant' + elif (mic_type=='i' and (float(m1a)==float(m2a))): + m_type='Intermediate' + else: + m_type='Strain could not be classified-1' + except IndexError: + strain_type='Strain could not be classified-2' + return(strain_type) + + return(m_type) + +#check_mic('65','32-64','i') + + +# In[209]: + + +# compare MIC value in pandas list +def sus_res_int(mic): + #print(mic) + o_mic = mic[0].replace(' ', '') + s_mic = mic[1].replace(' ', '') + r_mic = mic[2].replace(' ', '') + i_mic = mic[3].replace(' ', '') + try: + if check_mic(o_mic,s_mic,'s')=='Susceptible': + strain_type='Susceptible' + elif check_mic(o_mic,r_mic,'r')=='Resistant': + strain_type='Resistant' + elif check_mic(o_mic,i_mic,'i')=='Intermediate': + strain_type='Intermediate' + else: + strain_type='Strain could not be classified' + except ValueError: + strain_type='Strain could not be classified' + return(strain_type) + +#mic=['128','16/4','128/4','32/4-64/4'] +#sus_res_int(mic) + + +# In[210]: + + +# for input argument +input_user = sys.argv[1] +input_clsi = sys.argv[2] +output_table = sys.argv[3] + + +# In[211]: + +""" +input_user='input.csv' +input_clsi='clsi.csv' +output_profile=input_user+'_profile.csv' +output_table=input_user+'_table.csv' +""" + +# In[212]: + + +# 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[213]: + + +clsi_bp=pd.read_csv(input_clsi,sep=',') + + +# In[214]: + + +#clsi_bp +#strain_mic + + +# In[215]: + + +# 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))) +clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\/-]', '', x))) + + +# In[216]: + + +#clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\/-]', '', x))) + + +# In[217]: + + +# 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[218]: + + +#strain_mic + + +# In[219]: + + +# 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[220]: + + +#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','i_mic']] +except KeyError: + print('Waring: Error in input Values') + + +# In[221]: + + +#compare MIC values and assign Susceptible and Resistant to Strain +#try: +result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic','i_mic']].apply(sus_res_int,axis = 1) +#except ValueError: +# print('Waring: Error in input MIC value') + + +# In[222]: + + +#result + + +# In[223]: + + +#result[['Strain name', 'Antibiotics', 'MIC','s_mic','r_mic','CLSI_profile']].to_csv(output_profile,sep=',', index=False, encoding='utf-8-sig') + + +# In[224]: + + +#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[225]: + + +#result_table + + +# In[226]: + + +#result_table.to_csv(output_table,na_rep='NA') + + +# In[227]: + + +# 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[228]: + + +#print(result_selected.shape, result_table.shape) + + +# In[229]: + + +result_selected.insert(0,'Resistance_phenotype','') + + +# In[230]: + + +#rename headers +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'} ) + + +# In[231]: + + +#result_selected + + +# In[232]: + + +result_selected.to_csv(output_table,na_rep='NA') +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile.xml Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,50 @@ +<tool id="clsi_profile" name="CLSI Profile" version="0.1.6" python_template_version="3.5"> + <description>MIC profile using CLSI MIC breakpoints</description> + <requirements> + <requirement type="package">pandas</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ + #if $input2.type_selector == "clsi_file" + python "${__tool_directory__}/clsi_profile.py" "$input1" "${__tool_directory__}/$input2.clsi1" "$output1" + #else + python "${__tool_directory__}/clsi_profile.py" "$input1" "$input2.clsi2" "$output1" + #end if + ]]></command> + <inputs> + + <param name="input1" type="data" format="csv" label="Input file of Antimicrobial Susceptibility Testing (AST) MIC values for strains" help="Input AST file in CSV format (Please see example given below)"></param> + + <conditional name="input2"> + <param name="type_selector" type="select" label="Choose MIC Breakpoints"> + <option value="clsi_file">CLSI MIC breakpoints</option> + <option value="user_file" >User define MIC breakpoints</option> + </param> + <when value="clsi_file"> + <param name="clsi1" type="select" format="csv" label="CSV File"> + <option value="clsi.csv" selected="true">CLSI MIC breakpoints for Bacteria (2020)</option> + </param> + </when> + <when value="user_file"> + <param name="clsi2" type="data" format="csv" label="CSV File"></param> + </when> + </conditional> + + </inputs> + <!--inputs> + <param type="data" name="input1" format="csv" /> + <param type="data" name="input2" format="csv" /> + </inputs--> + <outputs> + <data name="output1" format="csv" /> + </outputs> + <tests> + <test> + <param name="input1" value="input.csv"/> + <param name="input2" value="clsi.csv"/> + <output name="output1" file="output.csv"/> + </test> + </tests> + <help><![CDATA[ + TODO: Fill in help. + ]]></help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile_type2.py Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,244 @@ +#!/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[ ]: + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile_type2_linux-Copy1.ipynb Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,2461 @@ +{ + "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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>Antibiotics</th>\n", + " <th>Susceptible</th>\n", + " <th>Resistant</th>\n", + " <th>Intermediate</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Amikacin</td>\n", + " <td>≤ 16</td>\n", + " <td>≥ 64</td>\n", + " <td>32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Tobramycin</td>\n", + " <td>≤ 4</td>\n", + " <td>≥ 16</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Gentamicin</td>\n", + " <td>≤ 4</td>\n", + " <td>≥ 16</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Netilmicin</td>\n", + " <td>≤ 8</td>\n", + " <td>≥ 32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Imipenem</td>\n", + " <td>≤ 2</td>\n", + " <td>≥ 8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Meropenem</td>\n", + " <td>≤ 2</td>\n", + " <td>≥ 8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Doripenem</td>\n", + " <td>≤ 2</td>\n", + " <td>≥ 8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Ciprofloxacin</td>\n", + " <td>≤ 1</td>\n", + " <td>≥ 4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Levofloxacin</td>\n", + " <td>≤ 2</td>\n", + " <td>≥ 8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Piperacillin/ tazobactam</td>\n", + " <td>≤ 16/4</td>\n", + " <td>≥ 128/4</td>\n", + " <td>32/4-64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>10</th>\n", + " <td>Ticarcillin/ clavulanic acid</td>\n", + " <td>≤ 16/2</td>\n", + " <td>≥ 128/2</td>\n", + " <td>32/2-64/2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>11</th>\n", + " <td>Cefotaxime</td>\n", + " <td>≤ 8</td>\n", + " <td>≥ 64</td>\n", + " <td>16-32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>12</th>\n", + " <td>Ceftriaxone</td>\n", + " <td>≤ 8</td>\n", + " <td>≥ 64</td>\n", + " <td>16-32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>13</th>\n", + " <td>Ceftazidime</td>\n", + " <td>≤ 8</td>\n", + " <td>≥ 32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>14</th>\n", + " <td>Cefepime</td>\n", + " <td>≤ 8</td>\n", + " <td>≥ 32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>15</th>\n", + " <td>Trimethoprim/ sulfamethoxazole</td>\n", + " <td>≤ 2/38</td>\n", + " <td>≥ 4/76</td>\n", + " <td>-</td>\n", + " </tr>\n", + " <tr>\n", + " <th>16</th>\n", + " <td>Ampicillin/ sulbactam</td>\n", + " <td>≤ 8/4</td>\n", + " <td>≥ 32/16</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>17</th>\n", + " <td>Colistin</td>\n", + " <td>-</td>\n", + " <td>≥ 4</td>\n", + " <td>≤ 2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>18</th>\n", + " <td>Polymyxin B</td>\n", + " <td>-</td>\n", + " <td>≥ 4</td>\n", + " <td>≤ 2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>19</th>\n", + " <td>Tetracycline</td>\n", + " <td>≤ 4</td>\n", + " <td>≥ 16</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>20</th>\n", + " <td>Doxycycline</td>\n", + " <td>≤ 4</td>\n", + " <td>≥ 16</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>21</th>\n", + " <td>Minocycline</td>\n", + " <td>≤ 4</td>\n", + " <td>≥ 16</td>\n", + " <td>8</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>Strain name</th>\n", + " <th>Antibiotics</th>\n", + " <th>MIC</th>\n", + " <th>o_mic</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>0.1</td>\n", + " <td>0.1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>2</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>mg/L</td>\n", + " <td>/</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefazolin</td>\n", + " <td>64</td>\n", + " <td>64</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ceftriaxone</td>\n", + " <td>16</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefepime</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Meropenem</td>\n", + " <td>0.25</td>\n", + " <td>0.25</td>\n", + " </tr>\n", + " <tr>\n", + " <th>10</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Imipenem</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>11</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Tigecycline</td>\n", + " <td>0.5</td>\n", + " <td>0.5</td>\n", + " </tr>\n", + " <tr>\n", + " <th>12</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ceftazidime</td>\n", + " <td>>128</td>\n", + " <td>128</td>\n", + " </tr>\n", + " <tr>\n", + " <th>13</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Cefepime</td>\n", + " <td>>256</td>\n", + " <td>256</td>\n", + " </tr>\n", + " <tr>\n", + " <th>14</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ciprofloxacin</td>\n", + " <td>>32</td>\n", + " <td>32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>15</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Colistin</td>\n", + " <td></td>\n", + " <td></td>\n", + " </tr>\n", + " <tr>\n", + " <th>16</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " </tr>\n", + " <tr>\n", + " <th>17</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>>=0.3 mg/L</td>\n", + " <td>0.3/</td>\n", + " </tr>\n", + " <tr>\n", + " <th>18</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ticarcillin/clavulanicacid</td>\n", + " <td>>=128/2</td>\n", + " <td>128/2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>19</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>NA</td>\n", + " <td></td>\n", + " </tr>\n", + " <tr>\n", + " <th>20</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " </tr>\n", + " <tr>\n", + " <th>21</th>\n", + " <td>Acinetobacter baumannii ORAB01</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>>64/4</td>\n", + " <td>64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>22</th>\n", + " <td>Acinetobacter baumannii strain MRSN7100</td>\n", + " <td>Amoxicillin/clavulanicacid</td>\n", + " <td>16/8</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>23</th>\n", + " <td>Acinetobacter baumannii strain MRSN7168</td>\n", + " <td>Amoxicillin/clavulanicacid</td>\n", + " <td>16/8</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>24</th>\n", + " <td>Acinetobacter baumannii strain MRSN7336</td>\n", + " <td>Amoxicillin/clavulanicacid</td>\n", + " <td>16/8</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>25</th>\n", + " <td>Acinetobacter baumannii strain MRSN7834</td>\n", + " <td>Amoxicillin/clavulanicacid</td>\n", + " <td>16/8</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>26</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0305</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>27</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0306</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>28</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0307</td>\n", + " <td>Polymyxinb</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>29</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0308</td>\n", + " <td>Polymyxinb</td>\n", + " <td>4</td>\n", + " <td>4</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>Strain name</th>\n", + " <th>Antibiotics</th>\n", + " <th>MIC</th>\n", + " <th>o_mic</th>\n", + " <th>s_mic</th>\n", + " <th>r_mic</th>\n", + " <th>i_mic</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>0.1</td>\n", + " <td>0.1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>2</td>\n", + " <td>2</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Colistin</td>\n", + " <td></td>\n", + " <td></td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>mg/L</td>\n", + " <td>/</td>\n", + " <td>8/4</td>\n", + " <td>32/16</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>>=0.3 mg/L</td>\n", + " <td>0.3/</td>\n", + " <td>8/4</td>\n", + " <td>32/16</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>NA</td>\n", + " <td></td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Acinetobacter baumannii ORAB01</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>>64/4</td>\n", + " <td>64/4</td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ceftriaxone</td>\n", + " <td>16</td>\n", + " <td>16</td>\n", + " <td>8</td>\n", + " <td>64</td>\n", + " <td>16-32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>10</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefepime</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>11</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Cefepime</td>\n", + " <td>>256</td>\n", + " <td>256</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>12</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Meropenem</td>\n", + " <td>0.25</td>\n", + " <td>0.25</td>\n", + " <td>2</td>\n", + " <td>8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>13</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Imipenem</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>2</td>\n", + " <td>8</td>\n", + " <td>4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>14</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ceftazidime</td>\n", + " <td>>128</td>\n", + " <td>128</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>15</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ciprofloxacin</td>\n", + " <td>>32</td>\n", + " <td>32</td>\n", + " <td>1</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>16</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " <td>2/38</td>\n", + " <td>4/76</td>\n", + " <td>-</td>\n", + " </tr>\n", + " <tr>\n", + " <th>17</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " <td>2/38</td>\n", + " <td>4/76</td>\n", + " <td>-</td>\n", + " </tr>\n", + " <tr>\n", + " <th>18</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ticarcillin/clavulanicacid</td>\n", + " <td>>=128/2</td>\n", + " <td>128/2</td>\n", + " <td>16/2</td>\n", + " <td>128/2</td>\n", + " <td>32/2-64/2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>19</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0305</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>20</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0306</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>21</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0307</td>\n", + " <td>Polymyxinb</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>22</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0308</td>\n", + " <td>Polymyxinb</td>\n", + " <td>4</td>\n", + " <td>4</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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<ipython-input-44-76a7d8475ba3>\u001b[0m in \u001b[0;36m<module>\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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>Strain name</th>\n", + " <th>Antibiotics</th>\n", + " <th>MIC</th>\n", + " <th>o_mic</th>\n", + " <th>s_mic</th>\n", + " <th>r_mic</th>\n", + " <th>i_mic</th>\n", + " <th>CLSI_profile</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>0.1</td>\n", + " <td>0.1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Colistin</td>\n", + " <td>2</td>\n", + " <td>2</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>IntermediatE</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Colistin</td>\n", + " <td></td>\n", + " <td></td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Strain could not classified</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>mg/L</td>\n", + " <td>/</td>\n", + " <td>8/4</td>\n", + " <td>32/16</td>\n", + " <td>16/8</td>\n", + " <td>Strain could not classified</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>>=0.3 mg/L</td>\n", + " <td>0.3/</td>\n", + " <td>8/4</td>\n", + " <td>32/16</td>\n", + " <td>16/8</td>\n", + " <td>Strain could not classified</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " <td>Strain could not classified</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>NA</td>\n", + " <td></td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " <td>Strain could not classified</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Acinetobacter baumannii ORAB01</td>\n", + " <td>Piperacillin/tazobactam</td>\n", + " <td>>64/4</td>\n", + " <td>64/4</td>\n", + " <td>16/4</td>\n", + " <td>128/4</td>\n", + " <td>32/4-64/4</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ceftriaxone</td>\n", + " <td>16</td>\n", + " <td>16</td>\n", + " <td>8</td>\n", + " <td>64</td>\n", + " <td>16-32</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>10</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefepime</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " <td>Susceptible</td>\n", + " </tr>\n", + " <tr>\n", + " <th>11</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Cefepime</td>\n", + " <td>>256</td>\n", + " <td>256</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>12</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Meropenem</td>\n", + " <td>0.25</td>\n", + " <td>0.25</td>\n", + " <td>2</td>\n", + " <td>8</td>\n", + " <td>4</td>\n", + " <td>Susceptible</td>\n", + " </tr>\n", + " <tr>\n", + " <th>13</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Imipenem</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>2</td>\n", + " <td>8</td>\n", + " <td>4</td>\n", + " <td>Susceptible</td>\n", + " </tr>\n", + " <tr>\n", + " <th>14</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ceftazidime</td>\n", + " <td>>128</td>\n", + " <td>128</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>15</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ciprofloxacin</td>\n", + " <td>>32</td>\n", + " <td>32</td>\n", + " <td>1</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>16</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " <td>2/38</td>\n", + " <td>4/76</td>\n", + " <td>-</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>17</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " <td>8/152</td>\n", + " <td>2/38</td>\n", + " <td>4/76</td>\n", + " <td>-</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>18</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ticarcillin/clavulanicacid</td>\n", + " <td>>=128/2</td>\n", + " <td>128/2</td>\n", + " <td>16/2</td>\n", + " <td>128/2</td>\n", + " <td>32/2-64/2</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>19</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0305</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>20</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0306</td>\n", + " <td>Polymyxinb</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Intermediate</td>\n", + " </tr>\n", + " <tr>\n", + " <th>21</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0307</td>\n", + " <td>Polymyxinb</td>\n", + " <td>8</td>\n", + " <td>8</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>22</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0308</td>\n", + " <td>Polymyxinb</td>\n", + " <td>4</td>\n", + " <td>4</td>\n", + " <td>-</td>\n", + " <td>4</td>\n", + " <td>2</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th>Antibiotics</th>\n", + " <th>Ampicillin/sulbactam</th>\n", + " <th>Cefepime</th>\n", + " <th>Ceftazidime</th>\n", + " <th>Ceftriaxone</th>\n", + " <th>Ciprofloxacin</th>\n", + " <th>Colistin</th>\n", + " <th>Imipenem</th>\n", + " <th>Meropenem</th>\n", + " <th>Piperacillin/tazobactam</th>\n", + " <th>Polymyxinb</th>\n", + " <th>Ticarcillin/clavulanicacid</th>\n", + " <th>Trimethoprim/sulfamethoxazole</th>\n", + " </tr>\n", + " <tr>\n", + " <th>Strain name</th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>Acinetobacter baumannii A85</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii AB307-0294</th>\n", + " <td>Strain could not classified</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>Intermediate</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>Susceptible</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii AB5075-UW</th>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii DU202</th>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii ORAB01</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Intermediate</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0305</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0306</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0307</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0308</th>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th>Antibiotics</th>\n", + " <th>Resistance_phenotype</th>\n", + " <th>Imipenem</th>\n", + " <th>Meropenem</th>\n", + " <th>Ciprofloxacin</th>\n", + " <th>Piperacillin/ tazobactam</th>\n", + " <th>Ticarcillin/clavulanic acid</th>\n", + " <th>Ceftriaxone</th>\n", + " <th>Ceftazidime</th>\n", + " <th>Cefepime</th>\n", + " <th>Trimethoprim/ sulfamethoxazole</th>\n", + " <th>Ampicillin/ sulbactam</th>\n", + " <th>Colistin</th>\n", + " <th>Polymyxin B</th>\n", + " </tr>\n", + " <tr>\n", + " <th>Strain name</th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>Acinetobacter baumannii A85</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii AB307-0294</th>\n", + " <td></td>\n", + " <td>Susceptible</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>Intermediate</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " <td>NaN</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii AB5075-UW</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii DU202</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Strain could not classified</td>\n", + " <td>Resistant</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " <td>Strain could not classified</td>\n", + " <td>Strain could not classified</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii ORAB01</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Intermediate</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0305</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0306</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Susceptible</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0307</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " <tr>\n", + " <th>Acinetobacter baumannii strain FDA-CDC-AR_0308</th>\n", + " <td></td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>NaN</td>\n", + " <td>Resistant</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "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 +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile_type2_linux.ipynb Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,447 @@ +{ + "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 +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/clsi.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,23 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/clsi_profile.xml Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,36 @@ +<tool id="clsi_profile" name="CLSI Profile" version="0.1.0" python_template_version="3.5"> + <description>MIC profile using CLSI MIC breakpoints</description> + + <command detect_errors="exit_code"><![CDATA[ + python '$__tool_directory__/clsi_profile.py' '$input1' '$input2' '$output1' + ]]></command> + <inputs> + <param type="data" name="input1" format="csv" /> + <param type="data" name="input2" format="csv" /> + </inputs> + <outputs> + <data name="output1" format="csv" /> + </outputs> + <tests> + <test> + <param name="input1" value="input.csv"/> + <param name="input2" value="clsi.csv"/> + <output name="output1" file="output.csv"/> + </test> + </tests> + <help><![CDATA[ + Examples Files: + **CLSI MIC breakpoint file example:** :: + + Antibiotics,Susceptible,Resistant,Intermediate + Amikacin,≤ 16,≥ 64,32 + Tobramycin,≤ 4,≥ 16,8 + Gentamicin,≤ 4,≥ 16,8 + + **AST MIC value file example:** :: + Strain name,Antibiotics,MIC + Strain1,Amikacin,≤ 16 + Strain2,Tobramycin,≤ 4 + Strain3,Gentamicin,≤ 4 + ]]></help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/clsi_profile_comb.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,23 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/input.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,31 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/input_ast_comb2.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,31 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/input_ast_comb2.csv_table.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,10 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump/output.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,10 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/input.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,31 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/input.csv_table.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,10 @@ +Strain name,Resistance_phenotype,Imipenem,Meropenem,Ciprofloxacin,Piperacillin/ tazobactam,Ticarcillin/clavulanic acid,Ceftriaxone,Ceftazidime,Cefepime,Trimethoprim/ sulfamethoxazole,Ampicillin/ sulbactam,Colistin,Polymyxin B +Acinetobacter baumannii A85,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Strain could not be classified Intermediate,NA +Acinetobacter baumannii AB307-0294,,Susceptible,Susceptible,NA,Strain could not be classified,NA,Intermediate,NA,Susceptible,NA,Strain could not be 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 be classified,Resistant,NA,NA,NA,Resistant,Strain could not be classified,Strain could not be 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,Strain could not be classified +Acinetobacter baumannii strain FDA-CDC-AR_0306,,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,Strain could not be classified +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/output.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,10 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/clsi.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,23 @@ +Antibiotics,Susceptible,Resistant,Intermediate +Amikacin,≤ 16,≥ 64,32 +Tobramycin,≤ 4,≥ 16,8 +Gentamicin,≤ 4,≥ 16,8 +Netilmicin,≤ 8,≥ 32,16 +Imipenem,≤ 2,≥ 8,4 +Meropenem,≤ 2,≥ 8,4 +Doripenem,≤ 2,≥ 8,4 +Ciprofloxacin,≤ 1,≥ 4,2 +Levofloxacin,≤ 2,≥ 8,4 +Piperacillin/ tazobactam,≤ 16/4,≥ 128/4,32/4-64/4 +Ticarcillin/ clavulanic acid,≤ 16/2,≥ 128/2,32/2-64/2 +Cefotaxime,≤ 8,≥ 64,16-32 +Ceftriaxone,≤ 8,≥ 64,16-32 +Ceftazidime,≤ 8,≥ 32,16 +Cefepime,≤ 8,≥ 32,16 +Trimethoprim/ sulfamethoxazole,≤ 2/38,≥ 4/76,- +Ampicillin/ sulbactam,≤ 8/4,≥ 32/16,16/8 +Colistin,-,≥ 4,≤ 2 +Polymyxin B,-,≥ 4,≤ 2 +Tetracycline,≤ 4,≥ 16,8 +Doxycycline,≤ 4,≥ 16,8 +Minocycline,≤ 4,≥ 16,8 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,31 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/output.csv Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,10 @@ +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool.sh Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,15 @@ +#!/bin/bash + +planemo tool_init --id 'clsi_profile' --name 'CLSI Profile' \ + --description 'MIC profile using CLSI MIC breakpoints' \ + --requirement 'python' \ + --example_command "clsi_profile_type2.py 'input.csv' 'clsi.csv' 'output.csv'" \ + --example_input input.csv \ + --example_input clsi.csv \ + --example_output output.csv \ + --test_case \ +# --version_command 'python3 -V' \ +# --help_from_command '' \ +# --doi '' + +planemo lint
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_shed.sh Fri Jun 11 12:36:25 2021 +0000 @@ -0,0 +1,7 @@ +planemo shed_init --name="clsi_profile" \ + --owner="rakesh4osdd" \ + --description="CLSI profile using MIC breakpoints" \ + --remote_repository_url="https://github.com/rakesh4osdd/clsi_profile/tree/master" \ + --homepage_url="https://github.com/rakesh4osdd/clsi_profile/tree/master" \ + --long_description="CLSI profile using MIC breakpoints" \ + # --category=''