Mercurial > repos > rakesh4osdd > clsi_profile
changeset 3:683299422575 draft
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f085b88bf75f7b45ac3b0c4e1c39214c0ac0b67d"
author | rakesh4osdd |
---|---|
date | Tue, 29 Jun 2021 05:20:41 +0000 |
parents | 306236ec0511 |
children | 2a5861818faf |
files | README.md README.rst asist_dynamic.ipynb asist_dynamic.py clsi.csv clsi_profile.py clsi_profile.xml clsi_profile_type2.py clsi_profile_type2_linux-Copy1.ipynb clsi_profile_type2_linux.ipynb input.csv input.csv_table.csv suite_config.xml test-data/asist_input.csv test-data/asist_output.csv test-data/input.csv test-data/input2.csv tool_asist.sh tool_shed.sh |
diffstat | 19 files changed, 4409 insertions(+), 97 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Fri Jun 11 13:20:08 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# clsi_profile -CLSI profile for ASIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.rst Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,20 @@ +# clsi_profile + + CLSI profile for ASIST using the CLSI standards 2020 by AST profiling for bacteria. It help to generate the input file for ASIST program based on MIC values provided by CLSI based AST profiling. + +# ASIST: Antimicrobial Susceptibility standards** + + In the first column strain names will be mentioned, the second column will be left blank for getting resistance phenotype, starting two rows will comprise antibiotic names (first row) and antibiotic classes (second row). The data for the resistance profile will then start from the C3 column of an excel file which can be converted into a .csv file. Since B3 is left blank, after implementing the algorithm, column B3 will be filled with the resistance phenotype (susceptible, MDR, XDR, PDR). + +**Example Input CSV file:** + + Strain name,Resistance_phenotype,Antibiotic_A1,Antibiotic_A2,Antibiotic_A_N + Strain_1,Phenotype_1,Resistant,Resistant,Resistant + Strain_2,Phenotype_2,Resistant,Susceptible,Resistant + + Link to the code : https://github.com/rakesh4osdd/asist + + +# ASIST tool suite + + These tools can be install from Galaxy toolshed to a Galaxy installation https://galaxyproject.org/admin/get-galaxy/.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/asist_dynamic.ipynb Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,310 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1309, + "id": "27cfc66f", + "metadata": {}, + "outputs": [], + "source": [ + "#ASIST program for phenotype based on Antibiotics profile\n", + "# create a profile based on selected antibiotics only\n", + "# rakesh4osdd@gmail.com, 14-June-2021" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "75a352b7", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import sys\n", + "import os\n", + "from collections import Counter" + ] + }, + { + "cell_type": "code", + "execution_count": 176, + "id": "d66ec0d2", + "metadata": {}, + "outputs": [], + "source": [ + "input_file=sys.argv[1]\n", + "output_file=sys.argv[2]\n", + "#input_file='test-data/asist_input.csv'\n", + "#output_file='test-data/asist_output.csv'" + ] + }, + { + "cell_type": "code", + "execution_count": 177, + "id": "bf24c946", + "metadata": {}, + "outputs": [], + "source": [ + "# strain_profile to phenotype condition\n", + "def s_phen(sus,res,intm,na,pb_sus):\n", + " if (sus>0 and res==0 and na>=0):\n", + " #print('Possible Susceptible')\n", + " phen='Possible Susceptible'\n", + " elif (sus>=0 and 3<=res<7 and na>=0 and pb_sus==0):\n", + " #print('Possible MDR')\n", + " phen='Possible MDR'\n", + " elif (sus>=0 and 7<=res<9 and na>=0 and pb_sus==0):\n", + " #print('Possible XDR')\n", + " phen='Possible XDR'\n", + " #special cases\n", + " elif (sus>=1 and res>0 and na>=0 and pb_sus==1):\n", + " #print('Possible XDR')\n", + " phen='Possible XDR'\n", + " #special cases\n", + " elif (sus>0 and res==9 and na>=0):\n", + " #print('Possible XDR')\n", + " phen='Possible XDR'\n", + " elif (sus==0 and res==9 and na>=0):\n", + " #print('Possible TDR')\n", + " phen='Possible TDR'\n", + " else:\n", + " #print('Strain could not be classified')\n", + " phen='Strain could not be classified ('+ str(intm)+' | ' + str(na) +')'\n", + " return(phen)\n", + "\n", + "#print(s_phen(1,9,0,0))" + ] + }, + { + "cell_type": "code", + "execution_count": 178, + "id": "8bad7d9d", + "metadata": {}, + "outputs": [], + "source": [ + "# define Antibiotic groups as per antibiotic of CLSI breakpoints MIC\n", + "#Aminoglycoside\n", + "cat1=['Amikacin','Tobramycin','Gentamycin','Netilmicin']\n", + "#Beta-lactams- Carbapenems\n", + "cat2=['Imipenem','Meropenam','Doripenem']\n", + "#Fluoroquinolone\n", + "cat3=['Ciprofloxacin','Levofloxacin']\n", + "#Beta-lactam inhibitor\n", + "cat4=['Piperacillin/tazobactam','Ticarcillin/clavulanicacid']\n", + "#Cephalosporin\n", + "cat5=['Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime']\n", + "#Sulfonamides\n", + "cat6=['Trimethoprim/sulfamethoxazole']\n", + "#Penicillins/beta-lactamase\n", + "cat7=['Ampicillin/sulbactam']\n", + "#Polymyxins\n", + "cat8=['Colistin','Polymyxinb']\n", + "#Tetracycline\n", + "cat9=['Tetracycline','Doxicycline','Minocycline']\n", + "\n", + "def s_profiler(pd_series):\n", + " #print(type(pd_series),'\\n', pd_series)\n", + " #create a dictionary of dataframe series\n", + " cats={'s1':cat1,'s2':cat2,'s3':cat3,'s4':cat4,'s5':cat5,'s6':cat6,'s7':cat7,'s8':cat8,'s9':cat9}\n", + " # find the antibiotics name in input series\n", + " for cat in cats:\n", + " #print(cats[cat])\n", + " cats[cat]=pd_series.filter(cats[cat])\n", + " #print(cats[cat])\n", + " #define res,sus,intm,na,pb_sus\n", + " res=0\n", + " sus=0\n", + " intm=0\n", + " na=0\n", + " pb_sus=0\n", + " # special case of 'Polymyxin b' for its value\n", + " if 'Polymyxinb' in pd_series:\n", + " ctp=cats['s8']['Polymyxinb'].strip().lower()\n", + " if ctp == 'susceptible':\n", + " pb_sus=1\n", + " #print((ctp,p_sus))\n", + " # check all categories\n", + " for cat in cats:\n", + " #ctp=cats['s8'].iloc[i:i+1].stack().value_counts().to_dict()\n", + " #print(ctp)\n", + " # Pandas series\n", + " ct=cats[cat].value_counts().to_dict()\n", + " #print(ct)\n", + " # remove whitespace and convert to lowercase words\n", + " ct = {k.strip().lower(): v for k, v in ct.items()}\n", + " #print(ct)\n", + " k=Counter(ct)\n", + " #j=Counter(ct)+Counter(j)\n", + " #print(j)\n", + " # category wise marking\n", + " if k['resistant']>=1:\n", + " res=res+1\n", + " if k['susceptible']>=1:\n", + " sus=sus+1\n", + " if k['intermediate']>=1:\n", + " intm=intm+1\n", + " if k['na']>=1:\n", + " na=na+1\n", + " #print(sus,res,intm,na,pb_sus)\n", + " #print(s_phen(sus,res,intm,na,pb_sus))\n", + " return(s_phen(sus,res,intm,na,pb_sus))" + ] + }, + { + "cell_type": "code", + "execution_count": 179, + "id": "7629fc10", + "metadata": {}, + "outputs": [], + "source": [ + "#input_file='input2.csv_table.csv'\n", + "#output_file=input_file+'_output.txt'\n", + "strain_profile=pd.read_csv(input_file, sep=',',na_filter=False,skipinitialspace = True)" + ] + }, + { + "cell_type": "code", + "execution_count": 180, + "id": "bed1abba", + "metadata": {}, + "outputs": [], + "source": [ + "old_strain_name=strain_profile.columns[0]\n", + "new_strain_name=old_strain_name.capitalize().strip().replace(' ', '')" + ] + }, + { + "cell_type": "code", + "execution_count": 181, + "id": "a64b5022", + "metadata": {}, + "outputs": [], + "source": [ + "# make header capitalization, remove leading,lagging, and multiple whitespace for comparision\n", + "strain_profile.columns=strain_profile.columns.str.capitalize().str.strip().str.replace('\\s+', '', regex=True)\n", + "#print(strain_profile.columns)\n", + "#strain_profile.head()\n", + "#strain_profile.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 182, + "id": "caac57d7", + "metadata": {}, + "outputs": [], + "source": [ + "# add new column in dataframe on second position\n", + "strain_profile.insert(1, 'Strain phenotype','')\n", + "#strain_profile.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 183, + "id": "eb4b0c4d", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "strain_profile['Strain phenotype'] = strain_profile.apply(lambda x: (s_profiler(x)), axis=1)" + ] + }, + { + "cell_type": "code", + "execution_count": 184, + "id": "86441c0f", + "metadata": {}, + "outputs": [], + "source": [ + "#strain_profile.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 185, + "id": "75698be5", + "metadata": {}, + "outputs": [], + "source": [ + "#rename headers for old name\n", + "strain_profile=strain_profile.rename(columns = {new_strain_name:old_strain_name, '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": 186, + "id": "c14a13eb", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "#strain_profile.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 187, + "id": "ff484767", + "metadata": {}, + "outputs": [], + "source": [ + "#strain_profile" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "5ab72211", + "metadata": {}, + "outputs": [], + "source": [ + "strain_profile.to_csv(output_file,na_rep='NA',index=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 189, + "id": "020dbe85", + "metadata": {}, + "outputs": [], + "source": [ + "# Open a file with access mode 'a'\n", + "with open(output_file, \"a\") as file_object:\n", + " # Append 'hello' at the end of file\n", + " file_object.write(\"Note: \\n1. 'MDR': Multidrug-resistant, 'XDR': Extensively drug-resistant, 'TDR':totally drug resistant, NA': Data Not Available.\\n2. 'Strain could not be classified' numbers follow the format as ('Number of antibiotics categories count as Intermediate' | 'Number of antibiotics categories count as NA')\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9c17e66a", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/asist_dynamic.py Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,190 @@ +#!/usr/bin/env python +# coding: utf-8 + +# In[1309]: + + +#ASIST program for phenotype based on Antibiotics profile +# create a profile based on selected antibiotics only +# rakesh4osdd@gmail.com, 14-June-2021 + + +# In[1403]: + + +import pandas as pd +import sys +import os +from collections import Counter + + +# In[ ]: + + +input_file=sys.argv[1] +output_file=sys.argv[2] + + +# In[1362]: + + +# strain_profile to phenotype condition +def s_phen(sus,res,na,pb_sus): + if (sus>0 and res==0 and na>=0): + #print('Possible Susceptible') + phen='Possible Susceptible' + elif (sus>=0 and 3<=res<7 and na>=0 and pb_sus==0): + #print('Possible MDR') + phen='Possible MDR' + elif (sus>=0 and 7<=res<9 and na>=0 and pb_sus==0): + #print('Possible XDR') + phen='Possible XDR' + #special cases + elif (sus>=1 and res>0 and na>=0 and pb_sus==1): + #print('Possible XDR') + phen='Possible XDR' + #special cases + elif (sus>0 and res==9 and na>=0): + #print('Possible XDR') + phen='Possible XDR' + elif (sus==0 and res==9 and na>=0): + #print('Possible TDR') + phen='Possible TDR' + else: + #print('Strain could not be classified') + phen='Strain could not be classified' + return(phen) + +#print(s_phen(1,9,0,0)) + + +# In[1363]: + + +# define Antibiotic groups as per antibiotic of CLSI breakpoints MIC +#Aminoglycoside +cat1=['Amikacin','Tobramycin','Gentamycin','Netilmicin'] +#Beta-lactams- Carbapenems +cat2=['Imipenem','Meropenam','Doripenem'] +#Fluoroquinolone +cat3=['Ciprofloxacin','Levofloxacin'] +#Beta-lactam inhibitor +cat4=['Piperacillin/tazobactam','Ticarcillin/clavulanicacid'] +#Cephalosporin +cat5=['Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime'] +#Sulfonamides +cat6=['Trimethoprim/sulfamethoxazole'] +#Penicillins/beta-lactamase +cat7=['Ampicillin/sulbactam'] +#Polymyxins +cat8=['Colistin','Polymyxinb'] +#Tetracycline +cat9=['Tetracycline','Doxicycline','Minocycline'] + +def s_profiler(pd_series): + #print(type(pd_series),'\n', pd_series) + #create a dictionary of dataframe series + cats={'s1':cat1,'s2':cat2,'s3':cat3,'s4':cat4,'s5':cat5,'s6':cat6,'s7':cat7,'s8':cat8,'s9':cat9} + # find the antibiotics name in input series + for cat in cats: + #print(cats[cat]) + cats[cat]=pd_series.filter(cats[cat]) + #print(cats[cat]) + #define res,sus,na,pb_sus + res=0 + sus=0 + na=0 + pb_sus=0 + # special case of 'Polymyxin b' for its value + if 'Polymyxinb' in pd_series: + ctp=cats['s8']['Polymyxinb'].strip().lower() + if ctp == 'susceptible': + pb_sus=1 + #print((ctp,p_sus)) + # check all categories + for cat in cats: + #ctp=cats['s8'].iloc[i:i+1].stack().value_counts().to_dict() + #print(ctp) + # Pandas series + ct=cats[cat].value_counts().to_dict() + #print(ct) + # remove whitespace and convert to lowercase words + ct = {k.strip().lower(): v for k, v in ct.items()} + #print(ct) + k=Counter(ct) + #j=Counter(ct)+Counter(j) + #print(j) + # category wise marking + if k['resistant']>=1: + res=res+1 + if k['susceptible']>=1: + sus=sus+1 + if k['na']>=1: + na=na+1 + #print(s_phen(sus,res,na,pb_sus)) + return(s_phen(sus,res,na,pb_sus)) + + +# In[1397]: + + +#input_file='input2.csv_table.csv' +#output_file=input_file+'_output.txt' +strain_profile=pd.read_csv(input_file, sep=',',na_filter=False,skipinitialspace = True) + + +# In[1387]: + + +old_strain_name=strain_profile.columns[0] +new_strain_name=old_strain_name.capitalize().strip().replace(' ', '') + + +# In[1388]: + + +# make header capitalization, remove leading,lagging, and multiple whitespace for comparision +strain_profile.columns=strain_profile.columns.str.capitalize().str.strip().str.replace('\s+', '', regex=True) +#print(strain_profile.columns) +#strain_profile.head() +#strain_profile.columns + + +# In[1389]: + + +# add new column in dataframe on second position +strain_profile.insert(1, 'Strain phenotype','') +#strain_profile.head() + + +# In[1390]: + + +strain_profile['Strain phenotype'] = strain_profile.apply(lambda x: (s_profiler(x)), axis=1) + + +# In[1391]: + + +#strain_profile.head() + + +# In[1392]: + + +#rename headers for old name +strain_profile=strain_profile.rename(columns = {new_strain_name:old_strain_name, 'Ticarcillin/clavulanicacid':'Ticarcillin/ clavulanic acid','Piperacillin/tazobactam':'Piperacillin/ tazobactam','Trimethoprim/sulfamethoxazole': 'Trimethoprim/ sulfamethoxazole','Ampicillin/sulbactam':'Ampicillin/ sulbactam', 'Polymyxinb': 'Polymyxin B'} ) + + +# In[1404]: + + +#strain_profile + + +# In[1394]: + + +strain_profile.to_csv(output_file,na_rep='NA',index=False) +
--- a/clsi.csv Fri Jun 11 13:20:08 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -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
--- a/clsi_profile.py Fri Jun 11 13:20:08 2021 +0000 +++ b/clsi_profile.py Tue Jun 29 05:20:41 2021 +0000 @@ -282,7 +282,7 @@ # In[229]: -result_selected.insert(0,'Resistance_phenotype','') +#result_selected.insert(0,'Resistance_phenotype','') # In[230]:
--- a/clsi_profile.xml Fri Jun 11 13:20:08 2021 +0000 +++ b/clsi_profile.xml Tue Jun 29 05:20:41 2021 +0000 @@ -21,7 +21,7 @@ </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> + <option value="test-data/clsi.csv" selected="true">CLSI MIC breakpoints for Bacteria (2020)</option> </param> </when> <when value="user_file"> @@ -45,6 +45,40 @@ </test> </tests> <help><![CDATA[ - TODO: Fill in help. + Input CSV file example: + Strain name,Antibiotics,MIC,unit + + Acinetobacter baumannii A85,Colistin,0.1,mg/L + + Acinetobacter baumannii strain FDA-CDC-AR_0306,polymyxin B,1,mg/L + + Acinetobacter baumannii strain FDA-CDC-AR_0307,polymyxin B,8,mg/L + + Acinetobacter baumannii strain FDA-CDC-AR_0308,polymyxin B,4,mg/L + + Acinetobacter baumannii strain MRSN7834,amoxicillin/clavulanic acid, 16/8,mg/L + + Output CSV file example: + Strain name,Colistin,Polymyxin B + + Acinetobacter baumannii A85,Strain could not be classified,NA + + Acinetobacter baumannii strain FDA-CDC-AR_0306,NA,Strain could not be classified + + Acinetobacter baumannii strain FDA-CDC-AR_0307,NA,Resistant + + Acinetobacter baumannii strain FDA-CDC-AR_0308,NA,Resistant ]]></help> + <citations> + <citation type="bibtex">@ARTICLE{Sharma_2021, + author = {Tina Sharma and Rakesh Kumar and Anshu Bhardwaj}, + title = {ASIST: Antimicrobial Susceptibility standards based phenotypes}, + journal = {}, + year = {2021}, + volume = {}, + pages = {}, + url = {https://ab-openlab.csir.res.in/asist} + } + </citation> + </citations> </tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clsi_profile_type2.py Tue Jun 29 05:20:41 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 Tue Jun 29 05:20:41 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 Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,1040 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 37, + "id": "9aa0a6f7", + "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": 38, + "id": "9af8387e", + "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": 39, + "id": "73d0783c", + "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": 40, + "id": "4d2ab1b1", + "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": 41, + "id": "0e22ef0d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'# for input argument\\ninput_user = sys.argv[1]\\ninput_clsi = sys.argv[2]\\noutput_table = sys.argv[3]'" + ] + }, + "execution_count": 41, + "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": 42, + "id": "21d5fe63", + "metadata": {}, + "outputs": [], + "source": [ + "'''input_user='input2.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": 43, + "id": "1e64b025", + "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", + " </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", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Acinetobacter baumannii A85</td>\n", + " <td>Netilmicin</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin</td>\n", + " <td>0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>mg/L</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>piperacillin/tazobactam</td>\n", + " <td>0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>5</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefazolin</td>\n", + " <td>64</td>\n", + " </tr>\n", + " <tr>\n", + " <th>6</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Ceftriaxone</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>7</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Cefepime</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>8</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Meropenem</td>\n", + " <td>0.25</td>\n", + " </tr>\n", + " <tr>\n", + " <th>9</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Imipenem</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>10</th>\n", + " <td>Acinetobacter baumannii AB307-0294</td>\n", + " <td>Tigecycline</td>\n", + " <td>0.5</td>\n", + " </tr>\n", + " <tr>\n", + " <th>11</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ceftazidime</td>\n", + " <td>>128</td>\n", + " </tr>\n", + " <tr>\n", + " <th>12</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Cefepime</td>\n", + " <td>>256</td>\n", + " </tr>\n", + " <tr>\n", + " <th>13</th>\n", + " <td>Acinetobacter baumannii AB5075-UW</td>\n", + " <td>Ciprofloxacin</td>\n", + " <td>>32</td>\n", + " </tr>\n", + " <tr>\n", + " <th>14</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>colistin</td>\n", + " <td></td>\n", + " </tr>\n", + " <tr>\n", + " <th>15</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>Ampicillin/sulbactam</td>\n", + " <td>>=0.3 mg/L</td>\n", + " </tr>\n", + " <tr>\n", + " <th>16</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>ticarcillin/clavulanic acid</td>\n", + " <td>>=128/2</td>\n", + " </tr>\n", + " <tr>\n", + " <th>17</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>piperacillin/tazobactam</td>\n", + " <td>NA</td>\n", + " </tr>\n", + " <tr>\n", + " <th>18</th>\n", + " <td>Acinetobacter baumannii DU202</td>\n", + " <td>trimethoprim/sulfamethoxazole</td>\n", + " <td>8/152</td>\n", + " </tr>\n", + " <tr>\n", + " <th>19</th>\n", + " <td>Acinetobacter baumannii ORAB01</td>\n", + " <td>piperacillin/tazobactam</td>\n", + " <td>>64/4</td>\n", + " </tr>\n", + " <tr>\n", + " <th>20</th>\n", + " <td>Acinetobacter baumannii strain MRSN7100</td>\n", + " <td>amoxicillin/clavulanic acid</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>21</th>\n", + " <td>Acinetobacter baumannii strain MRSN7168</td>\n", + " <td>amoxicillin/clavulanic acid</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>22</th>\n", + " <td>Acinetobacter baumannii strain MRSN7336</td>\n", + " <td>amoxicillin/clavulanic acid</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>23</th>\n", + " <td>Acinetobacter baumannii strain MRSN7834</td>\n", + " <td>amoxicillin/clavulanic acid</td>\n", + " <td>16/8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>24</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0305</td>\n", + " <td>polymyxin B</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>25</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0306</td>\n", + " <td>polymyxin B</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>26</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0307</td>\n", + " <td>polymyxin B</td>\n", + " <td>8</td>\n", + " </tr>\n", + " <tr>\n", + " <th>27</th>\n", + " <td>Acinetobacter baumannii strain FDA-CDC-AR_0308</td>\n", + " <td>polymyxin B</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 AB307-0294 \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 AB5075-UW \n", + "12 Acinetobacter baumannii AB5075-UW \n", + "13 Acinetobacter baumannii AB5075-UW \n", + "14 Acinetobacter baumannii DU202 \n", + "15 Acinetobacter baumannii DU202 \n", + "16 Acinetobacter baumannii DU202 \n", + "17 Acinetobacter baumannii DU202 \n", + "18 Acinetobacter baumannii DU202 \n", + "19 Acinetobacter baumannii ORAB01 \n", + "20 Acinetobacter baumannii strain MRSN7100 \n", + "21 Acinetobacter baumannii strain MRSN7168 \n", + "22 Acinetobacter baumannii strain MRSN7336 \n", + "23 Acinetobacter baumannii strain MRSN7834 \n", + "24 Acinetobacter baumannii strain FDA-CDC-AR_0305 \n", + "25 Acinetobacter baumannii strain FDA-CDC-AR_0306 \n", + "26 Acinetobacter baumannii strain FDA-CDC-AR_0307 \n", + "27 Acinetobacter baumannii strain FDA-CDC-AR_0308 \n", + "\n", + " Antibiotics MIC \n", + "0 Colistin 0.1 \n", + "1 Netilmicin 1 \n", + "2 Ampicillin 0 \n", + "3 Ampicillin/sulbactam mg/L \n", + "4 piperacillin/tazobactam 0 \n", + "5 Cefazolin 64 \n", + "6 Ceftriaxone 16 \n", + "7 Cefepime 8 \n", + "8 Meropenem 0.25 \n", + "9 Imipenem 1 \n", + "10 Tigecycline 0.5 \n", + "11 Ceftazidime >128 \n", + "12 Cefepime >256 \n", + "13 Ciprofloxacin >32 \n", + "14 colistin \n", + "15 Ampicillin/sulbactam >=0.3 mg/L \n", + "16 ticarcillin/clavulanic acid >=128/2 \n", + "17 piperacillin/tazobactam NA \n", + "18 trimethoprim/sulfamethoxazole 8/152 \n", + "19 piperacillin/tazobactam >64/4 \n", + "20 amoxicillin/clavulanic acid 16/8 \n", + "21 amoxicillin/clavulanic acid 16/8 \n", + "22 amoxicillin/clavulanic acid 16/8 \n", + "23 amoxicillin/clavulanic acid 16/8 \n", + "24 polymyxin B 1 \n", + "25 polymyxin B 1 \n", + "26 polymyxin B 8 \n", + "27 polymyxin B 4 " + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "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)\n", + "#strain_mic" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "0d30ddc3", + "metadata": {}, + "outputs": [], + "source": [ + "clsi_bp=pd.read_csv(input_clsi,sep=',')\n", + "\n", + "#clsi_bp[clsi_bp[['Antibiotics', 'Susceptible']].duplicated()].shape" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "a818676d", + "metadata": {}, + "outputs": [], + "source": [ + "#clsi_bp\n", + "#strain_mic" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "c6b4c59b", + "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": 47, + "id": "d0171f94", + "metadata": {}, + "outputs": [], + "source": [ + "#clsi_bp['i_mic'] = clsi_bp[['Intermediate']].applymap(lambda x: (re.sub(r'[^0-9.\\/-]', '', x)))" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "fe45b2dd", + "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": 49, + "id": "ddbbe4d9", + "metadata": {}, + "outputs": [], + "source": [ + "#strain_mic" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "id": "640508f1", + "metadata": {}, + "outputs": [], + "source": [ + "# capitalize each Antibiotic Name for comparision with removing whitespace\n", + "strain_mic['Strain name']=strain_mic['Strain name'].str.capitalize().str.replace(\" \",\"\")\n", + "strain_mic['Antibiotics']=strain_mic['Antibiotics'].str.capitalize().str.replace(\" \",\"\")\n", + "\n", + "clsi_bp['Antibiotics']=clsi_bp['Antibiotics'].str.capitalize().str.replace(\" \",\"\")" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "b87426f4", + "metadata": {}, + "outputs": [], + "source": [ + "#find duplicate values in input files\n", + "dups=strain_mic[strain_mic[['Strain name', 'Antibiotics']].duplicated(keep=False)]\n", + "if dups.shape[0] != 0:\n", + " print ('Please provide a single MIC value in input file for given duplicates combination of \\'Strain name and Antibiotics\\' to use the tool:-\\n',dups)\n", + " #exit()\n", + "else:\n", + " #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": 52, + "id": "91bfc94d", + "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>Acinetobacterbaumanniia85</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>Acinetobacterbaumanniidu202</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>2</th>\n", + " <td>Acinetobacterbaumanniia85</td>\n", + " <td>Netilmicin</td>\n", + " <td>1</td>\n", + " <td>1</td>\n", + " <td>8</td>\n", + " <td>32</td>\n", + " <td>16</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Acinetobacterbaumanniiab307-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>4</th>\n", + " <td>Acinetobacterbaumanniidu202</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>5</th>\n", + " <td>Acinetobacterbaumanniiab307-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>6</th>\n", + " <td>Acinetobacterbaumanniidu202</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>7</th>\n", + " <td>Acinetobacterbaumanniiorab01</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>8</th>\n", + " <td>Acinetobacterbaumanniiab307-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>9</th>\n", + " <td>Acinetobacterbaumanniiab307-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>10</th>\n", + " <td>Acinetobacterbaumanniiab5075-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>11</th>\n", + " <td>Acinetobacterbaumanniiab307-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>12</th>\n", + " <td>Acinetobacterbaumanniiab307-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>13</th>\n", + " <td>Acinetobacterbaumanniiab5075-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>14</th>\n", + " <td>Acinetobacterbaumanniiab5075-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>15</th>\n", + " <td>Acinetobacterbaumanniidu202</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>16</th>\n", + " <td>Acinetobacterbaumanniidu202</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>Acinetobacterbaumanniistrainfda-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>18</th>\n", + " <td>Acinetobacterbaumanniistrainfda-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>19</th>\n", + " <td>Acinetobacterbaumanniistrainfda-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>20</th>\n", + " <td>Acinetobacterbaumanniistrainfda-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 Acinetobacterbaumanniia85 \n", + "1 Acinetobacterbaumanniidu202 \n", + "2 Acinetobacterbaumanniia85 \n", + "3 Acinetobacterbaumanniiab307-0294 \n", + "4 Acinetobacterbaumanniidu202 \n", + "5 Acinetobacterbaumanniiab307-0294 \n", + "6 Acinetobacterbaumanniidu202 \n", + "7 Acinetobacterbaumanniiorab01 \n", + "8 Acinetobacterbaumanniiab307-0294 \n", + "9 Acinetobacterbaumanniiab307-0294 \n", + "10 Acinetobacterbaumanniiab5075-uw \n", + "11 Acinetobacterbaumanniiab307-0294 \n", + "12 Acinetobacterbaumanniiab307-0294 \n", + "13 Acinetobacterbaumanniiab5075-uw \n", + "14 Acinetobacterbaumanniiab5075-uw \n", + "15 Acinetobacterbaumanniidu202 \n", + "16 Acinetobacterbaumanniidu202 \n", + "17 Acinetobacterbaumanniistrainfda-cdc-ar_0305 \n", + "18 Acinetobacterbaumanniistrainfda-cdc-ar_0306 \n", + "19 Acinetobacterbaumanniistrainfda-cdc-ar_0307 \n", + "20 Acinetobacterbaumanniistrainfda-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 - 4 2 \n", + "2 Netilmicin 1 1 8 32 16 \n", + "3 Ampicillin/sulbactam mg/L / 8/4 32/16 16/8 \n", + "4 Ampicillin/sulbactam >=0.3 mg/L 0.3/ 8/4 32/16 16/8 \n", + "5 Piperacillin/tazobactam 0 0 16/4 128/4 32/4-64/4 \n", + "6 Piperacillin/tazobactam NA 16/4 128/4 32/4-64/4 \n", + "7 Piperacillin/tazobactam >64/4 64/4 16/4 128/4 32/4-64/4 \n", + "8 Ceftriaxone 16 16 8 64 16-32 \n", + "9 Cefepime 8 8 8 32 16 \n", + "10 Cefepime >256 256 8 32 16 \n", + "11 Meropenem 0.25 0.25 2 8 4 \n", + "12 Imipenem 1 1 2 8 4 \n", + "13 Ceftazidime >128 128 8 32 16 \n", + "14 Ciprofloxacin >32 32 1 4 2 \n", + "15 Ticarcillin/clavulanicacid >=128/2 128/2 16/2 128/2 32/2-64/2 \n", + "16 Trimethoprim/sulfamethoxazole 8/152 8/152 2/38 4/76 - \n", + "17 Polymyxinb 1 1 - 4 2 \n", + "18 Polymyxinb 1 1 - 4 2 \n", + "19 Polymyxinb 8 8 - 4 2 \n", + "20 Polymyxinb 4 4 - 4 2 " + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#result" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "id": "b171f205", + "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": 54, + "id": "3336fd92", + "metadata": {}, + "outputs": [], + "source": [ + "#result" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "f0dacfd1", + "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": 56, + "id": "3d8d03f7", + "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": 57, + "id": "7d7223a3", + "metadata": {}, + "outputs": [], + "source": [ + "#result_table" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "8a41b2ef", + "metadata": {}, + "outputs": [], + "source": [ + "#result_table.to_csv(output_table,na_rep='NA')" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "8c9e5f87", + "metadata": {}, + "outputs": [], + "source": [ + "# reorder the Antibiotics for ASIST\n", + "clsi_ab=['Amikacin','Tobramycin','Gentamycin','Netilmicin','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": 60, + "id": "cdf43afb", + "metadata": {}, + "outputs": [], + "source": [ + "#print(result_selected.shape, result_table.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "id": "c4c4df30", + "metadata": {}, + "outputs": [], + "source": [ + "#result_selected.insert(0,'Resistance_phenotype','')" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "9adb2703", + "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": 63, + "id": "50e6cf5f", + "metadata": {}, + "outputs": [], + "source": [ + "#result_selected" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "2833671c", + "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.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}
--- a/input.csv Fri Jun 11 13:20:08 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -id,genome Ids,Strain name,Antibiotics,Resistance_profile,sign,MIC,unit -470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,0.1,mg/L -470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,1,mg/L -470,CP021782.1,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,2,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin,resistant,>=,0,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Ampicillin/sulbactam,susceptible,<=,mg/L,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,piperacillin/tazobactam,susceptible,<=,0,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefazolin,resistant,>=,64,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Ceftriaxone,susceptible,==,16,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Cefepime,susceptible,==,8,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Meropenem,susceptible,<=,0.25,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Imipenem,susceptible,<=,1,mg/L -470,CP001172.2,Acinetobacter baumannii AB307-0294,Tigecycline,susceptible,<=,0.5,mg/L -470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ceftazidime,Resistant,NA,>128,mg/L -470,CP008706.1,Acinetobacter baumannii AB5075-UW,Cefepime,Resistant,NA,>256,mg/L -470,CP008706.1,Acinetobacter baumannii AB5075-UW,Ciprofloxacin,Resistant,NA,>32,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,colistin ,Susceptible,NA,,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,Ampicillin/sulbactam,Resistant,NA,>=0.3 mg/L,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,ticarcillin/clavulanic acid,Resistant,NA,>=128/2,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,piperacillin/tazobactam ,Resistant,NA,NA,mg/L -470,CP017152.1,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L -470,CP015483.1,Acinetobacter baumannii ORAB01,piperacillin/tazobactam,Resistant,NA,>64/4,mg/L -470,470.7601,Acinetobacter baumannii strain MRSN7100,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L -470,470.7651,Acinetobacter baumannii strain MRSN7168,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L -470,470.7764,Acinetobacter baumannii strain MRSN7336,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L -470,470.8071,Acinetobacter baumannii strain MRSN7834,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L -470,470.7405,Acinetobacter baumannii strain FDA-CDC-AR_0305,polymyxin B,Susceptible,==,1,mg/L -470,470.7406,Acinetobacter baumannii strain FDA-CDC-AR_0306,polymyxin B,Susceptible,==,1,mg/L -470,470.7407,Acinetobacter baumannii strain FDA-CDC-AR_0307,polymyxin B,Resistant,==,8,mg/L -470,470.7408,Acinetobacter baumannii strain FDA-CDC-AR_0308,polymyxin B,Resistant,==,4,mg/L
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/input.csv_table.csv Tue Jun 29 05:20:41 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/suite_config.xml Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,9 @@ +<suite id='suite_asist_tools' name='Suite of ASIST tools' version="1.0.0"> + <description>This suite contains clsi_profile and asist files and wrappers for Galaxy</description> + <tool id="clsi_profile" name="CLSI Profile" version="0.1.6" python_template_version="3.5"> + <description>MIC profile using CLSI MIC breakpoints</description> + </tool> + <tool id="asist" name="ASIST" version="1.0.1" python_template_version="3.5"> + <description>Antimicrobial Susceptibility standards based phenotypes</description> + </tool> +</suite>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/asist_input.csv Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,5 @@ +Strain name,Resistance_phenotype,Amikacin,Tobramycin,Gentamycin,Imipenem,Meropenam,Doripenem,Ciprofloxacin,Levofloxacin,Piperacillin/tazobactam,Ticarcillin/clavulanic acid,Cefotaxime,Ceftriaxone,Ceftazidime,Cefepime,Trimethoprim/sulfamethoxazole,Ampicillin/sulbactam,Colistin,polymyxin B,Tetracycline,Doxicycline ,Minocycline +Strain name,Resistance_phenotype,Aminoglycoside,Aminoglycoside,Aminoglycoside,Beta-lactams-Carbapenems,Beta-lactams-Carbapenems,Carbapenem ,Fluoroquinolone,Fluoroquinolone,Beta-lactam inhibitor,Beta-lactam inhibitor,Cephalosporin,Cephalosporin,Cephalosporin,Cephalosporin,Sulfonamides,Penicillins/beta-lactamase,Polymyxins,Polymyxins,Tetracycline,Tetracycline,Tetracycline +Acinetobacter baumannii strain FDA-CDC-AR_0288,,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant +Acinetobacter baumannii strain FDA-CDC-AR_0303,,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,NA +Acinetobacter baumannii strain FDA-CDC-AR_0304,,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/asist_output.csv Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,5 @@ +Strain name,Strain phenotype,Resistance_phenotype,Amikacin,Tobramycin,Gentamycin,Imipenem,Meropenam,Doripenem,Ciprofloxacin,Levofloxacin,Piperacillin/ tazobactam,Ticarcillin/ clavulanic acid,Cefotaxime,Ceftriaxone,Ceftazidime,Cefepime,Trimethoprim/ sulfamethoxazole,Ampicillin/ sulbactam,Colistin,Polymyxin B,Tetracycline,Doxicycline,Minocycline +Strain name,Strain could not be classified,Resistance_phenotype,Aminoglycoside,Aminoglycoside,Aminoglycoside,Beta-lactams-Carbapenems,Beta-lactams-Carbapenems,Carbapenem ,Fluoroquinolone,Fluoroquinolone,Beta-lactam inhibitor,Beta-lactam inhibitor,Cephalosporin,Cephalosporin,Cephalosporin,Cephalosporin,Sulfonamides,Penicillins/beta-lactamase,Polymyxins,Polymyxins,Tetracycline,Tetracycline,Tetracycline +Acinetobacter baumannii strain FDA-CDC-AR_0288,Possible TDR,,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant +Acinetobacter baumannii strain FDA-CDC-AR_0303,Possible TDR,,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,NA +Acinetobacter baumannii strain FDA-CDC-AR_0304,Possible TDR,,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,Resistant,NA,Resistant
--- a/test-data/input.csv Fri Jun 11 13:20:08 2021 +0000 +++ b/test-data/input.csv Tue Jun 29 05:20:41 2021 +0000 @@ -1,31 +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 +id,Strain name,Antibiotics,Resistance_profile,sign,MIC,unit +470,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,0.1,mg/L +470,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,1,mg/L +470,Acinetobacter baumannii A85,Colistin,Susceptible ,NA,2,mg/L +470,Acinetobacter baumannii AB307-0294,Ampicillin,resistant,>=,0,mg/L +470,Acinetobacter baumannii AB307-0294,Ampicillin/sulbactam,susceptible,<=,mg/L,mg/L +470,Acinetobacter baumannii AB307-0294,piperacillin/tazobactam,susceptible,<=,0,mg/L +470,Acinetobacter baumannii AB307-0294,Cefazolin,resistant,>=,64,mg/L +470,Acinetobacter baumannii AB307-0294,Ceftriaxone,susceptible,==,16,mg/L +470,Acinetobacter baumannii AB307-0294,Cefepime,susceptible,==,8,mg/L +470,Acinetobacter baumannii AB307-0294,Meropenem,susceptible,<=,0.25,mg/L +470,Acinetobacter baumannii AB307-0294,Imipenem,susceptible,<=,1,mg/L +470,Acinetobacter baumannii AB307-0294,Tigecycline,susceptible,<=,0.5,mg/L +470,Acinetobacter baumannii AB5075-UW,Ceftazidime,Resistant,NA,>128,mg/L +470,Acinetobacter baumannii AB5075-UW,Cefepime,Resistant,NA,>256,mg/L +470,Acinetobacter baumannii AB5075-UW,Ciprofloxacin,Resistant,NA,>32,mg/L +470,Acinetobacter baumannii DU202,colistin ,Susceptible,NA,,mg/L +470,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L +470,Acinetobacter baumannii DU202,Ampicillin/sulbactam,Resistant,NA,>=0.3 mg/L,mg/L +470,Acinetobacter baumannii DU202,ticarcillin/clavulanic acid,Resistant,NA,>=128/2,mg/L +470,Acinetobacter baumannii DU202,piperacillin/tazobactam ,Resistant,NA,NA,mg/L +470,Acinetobacter baumannii DU202,trimethoprim/sulfamethoxazole,Resistant,NA,8/152,mg/L +470,Acinetobacter baumannii ORAB01,piperacillin/tazobactam,Resistant,NA,>64/4,mg/L +470,Acinetobacter baumannii strain MRSN7100,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L +470,Acinetobacter baumannii strain MRSN7168,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L +470,Acinetobacter baumannii strain MRSN7336,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L +470,Acinetobacter baumannii strain MRSN7834,amoxicillin/clavulanic acid,Resistant,>, 16/8,mg/L +470,Acinetobacter baumannii strain FDA-CDC-AR_0305,polymyxin B,Susceptible,==,1,mg/L +470,Acinetobacter baumannii strain FDA-CDC-AR_0306,polymyxin B,Susceptible,==,1,mg/L +470,Acinetobacter baumannii strain FDA-CDC-AR_0307,polymyxin B,Resistant,==,8,mg/L +470,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/input2.csv Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,29 @@ +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,Netilmicin,Susceptible ,NA,1,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,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/tool_asist.sh Tue Jun 29 05:20:41 2021 +0000 @@ -0,0 +1,13 @@ +#!/bin/bash + +planemo tool_init --id 'asist' --name 'ASIST' --version 1.0.1 \ + --description 'Antimicrobial Susceptibility standards based phenotypes' \ + --requirement 'pandas' \ + --example_command "\"${__tool_directory__}/asist_dynamic.py\" 'asist_input.csv' 'asist_output.csv'" \ + --example_input test-data/asist_input.csv \ + --example_output test-data/asist_output.csv \ + --test_case \ + --version_command 'python -c "import pandas; print(pandas.__version__)"' \ + --doi 'https://ab-openlab.csir.res.in/asist' + +planemo lint asist.xml
--- a/tool_shed.sh Fri Jun 11 13:20:08 2021 +0000 +++ b/tool_shed.sh Tue Jun 29 05:20:41 2021 +0000 @@ -1,7 +1,5 @@ -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='' +#!/bin/bash +# After reviewing .shed.yml, this configuration file and relevant shed artifacts can be quickly linted using the following command. +planemo shed_lint --tools +#planemo shed_create --shed_target toolshed +planemo shed_update --check_diff --shed_target toolshed