Mercurial > repos > rakesh4osdd > asist
annotate clsi_profile_type2.py @ 2:62afd73a0987 draft
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit 58779a9edf592cff8cc63877d29e83888e403748-dirty"
author | rakesh4osdd |
---|---|
date | Mon, 28 Jun 2021 15:05:17 +0000 |
parents | c1a77856070c |
children |
rev | line source |
---|---|
0
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
1 #!/usr/bin/env python |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
2 # coding: utf-8 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
3 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
4 # In[1245]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
5 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
6 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
7 # ASIST module2 | map AST result to the CLSI breakporints with combination antibiotics |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
8 # By rakesh4osdd@gmail.com, 06-Jun-2021 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
9 import pandas as pd |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
10 import re |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
11 import sys |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
12 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
13 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
14 # In[1246]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
15 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
16 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
17 # cross check MIC values |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
18 def sus_res(mic): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
19 #print(mic) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
20 #print ((mic,pd.isna(mic[1]),pd.isna(mic[0]),'\n') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
21 if not (pd.isna(mic[0]) or pd.isna(mic[1]) or pd.isna(mic[2])):#check for NaN value |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
22 #remove unwanted whitespace |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
23 o_mic = mic[0].replace(' ', '') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
24 s_mic = mic[1].replace(' ', '') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
25 r_mic = mic[2].replace(' ', '') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
26 #print (o_mic,s_mic,r_mic) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
27 #print (type(o_mic),type(s_mic),type(r_mic)) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
28 if '/' in s_mic: #check for combination antibiotics |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
29 #print ('combination antibiotics') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
30 try: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
31 if '/' in o_mic: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
32 #print ('input combination') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
33 if (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(o_mic.split('/')[1]) <= float(s_mic.split('/')[1])): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
34 strain_type='Susceptible' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
35 elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(o_mic.split('/')[1]) >= float(r_mic.split('/')[1])): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
36 strain_type='Resistant' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
37 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
38 strain_type='Intermediate' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
39 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
40 #print ('single') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
41 if float(o_mic)==0: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
42 strain_type='Strain could not classified' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
43 elif (float(o_mic.split('/')[0]) <= float(s_mic.split('/')[0]) and float(1) <= float(s_mic.split('/')[1])): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
44 strain_type='Susceptible' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
45 elif (float(o_mic.split('/')[0]) >= float(r_mic.split('/')[0]) and float(1) >= float(r_mic.split('/')[1])): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
46 strain_type='Resistant' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
47 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
48 strain_type='Intermediate' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
49 except ValueError: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
50 strain_type='Strain could not classified' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
51 else: #single antibiotics |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
52 #print('single antibiotics') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
53 if o_mic: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
54 if float(o_mic)==0: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
55 strain_type='Strain could not classified' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
56 elif (float(o_mic) <= float(s_mic)): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
57 strain_type='Susceptible' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
58 elif (float(o_mic) >= float(r_mic)): |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
59 strain_type='Resistant' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
60 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
61 strain_type='Intermediate' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
62 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
63 strain_type='Strain could not classified' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
64 else: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
65 strain_type='Strain could not classified' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
66 return(strain_type) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
67 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
68 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
69 # In[ ]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
70 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
71 # for input argument |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
72 input_user = sys.argv[1] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
73 input_clsi = sys.argv[2] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
74 output_table = sys.argv[3] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
75 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
76 # In[1247]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
77 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
78 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
79 """ |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
80 input_user='input_ast_comb2.csv' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
81 input_clsi='clsi_profile_comb.csv' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
82 output_profile=input_user+'_profile.csv' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
83 output_table=input_user+'_table.csv' |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
84 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
85 """ |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
86 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
87 # In[1248]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
88 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
89 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
90 # read user AST data with selected 3 columns |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
91 strain_mic=pd.read_csv(input_user, sep=',', usecols =['Strain name', 'Antibiotics', 'MIC'],na_filter=False) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
92 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
93 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
94 # In[1249]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
95 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
96 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
97 clsi_bp=pd.read_csv(input_clsi,sep=',') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
98 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
99 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
100 # In[1290]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
101 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
102 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
103 #clsi_bp.head(2) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
104 #strain_mic |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
105 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
106 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
107 # In[1251]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
108 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
109 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
110 # convert MIC to numbers sMIC, rMIC |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
111 clsi_bp['s_mic'] =clsi_bp[['Susceptible']].applymap(lambda x: (re.sub(r'[^0-9.\/]', '', x))) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
112 clsi_bp['r_mic'] =clsi_bp[['Resistant']].applymap(lambda x: (re.sub(r'[^0-9.\/]', '', x))) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
113 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
114 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
115 # In[1252]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
116 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
117 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
118 # Read only numbers in MIC values |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
119 #try: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
120 strain_mic['o_mic']=strain_mic[['MIC']].applymap(lambda x: (re.sub(r'[^0-9.\/]','', x))) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
121 #except TypeError: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
122 # print('Waring: Error in MIC value') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
123 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
124 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
125 # In[1289]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
126 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
127 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
128 #strain_mic.head() |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
129 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
130 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
131 # In[1254]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
132 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
133 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
134 # capitalize each Antibiotic Name for comparision with removing whitespace |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
135 strain_mic['Antibiotics']=strain_mic['Antibiotics'].str.capitalize().str.replace(" ","") |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
136 clsi_bp['Antibiotics']=clsi_bp['Antibiotics'].str.capitalize().str.replace(" ","") |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
137 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
138 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
139 # In[1255]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
140 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
141 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
142 #compare CLSI Antibiotics only |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
143 #result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner', indicator=True)[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic','_merge']] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
144 try: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
145 result=pd.merge(strain_mic, clsi_bp, on='Antibiotics',how='inner')[['Strain name','Antibiotics', 'MIC', 'o_mic', 's_mic', 'r_mic']] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
146 except KeyError: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
147 print('Waring: Error in input Values') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
148 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
149 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
150 # In[1256]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
151 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
152 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
153 #compare MIC values and assign Susceptible and Resistant to Strain |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
154 #try: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
155 result[['CLSI_profile']] = result[['o_mic','s_mic','r_mic']].apply(sus_res,axis = 1) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
156 #except ValueError: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
157 # print('Waring: Error in input MIC value') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
158 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
159 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
160 # In[1288]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
161 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
162 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
163 #result |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
164 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
165 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
166 # In[1258]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
167 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
168 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
169 #result[['Strain name', 'Antibiotics', 'MIC','s_mic','r_mic','CLSI_profile']].to_csv(output_profile,sep=',', index=False, encoding='utf-8-sig') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
170 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
171 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
172 # In[1259]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
173 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
174 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
175 #create a pivot table for ASIST |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
176 table=result[['Strain name', 'Antibiotics','CLSI_profile']].drop_duplicates() |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
177 result_table=pd.pivot_table(table, values ='CLSI_profile', index =['Strain name'],columns =['Antibiotics'], aggfunc = lambda x: ' '.join(x)) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
178 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
179 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
180 # In[1261]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
181 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
182 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
183 result_table |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
184 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
185 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
186 # In[1264]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
187 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
188 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
189 #result_table.to_csv(output_table,na_rep='NA') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
190 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
191 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
192 # In[1282]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
193 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
194 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
195 # reorder the Antibiotics for ASIST |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
196 clsi_ab=['Amikacin','Tobramycin','Gentamycin','Imipenem','Meropenem','Doripenem','Ciprofloxacin','Levofloxacin', |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
197 'Piperacillin/tazobactam','Ticarcillin/clavulanicacid','Cefotaxime','Ceftriaxone','Ceftazidime','Cefepime', |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
198 'Trimethoprim/sulfamethoxazole','Ampicillin/sulbactam','Colistin','Polymyxinb','Tetracycline','Doxicycline ', |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
199 'Minocycline'] |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
200 result_selected=result_table.filter(clsi_ab) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
201 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
202 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
203 # In[1283]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
204 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
205 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
206 result_selected.shape |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
207 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
208 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
209 # In[1284]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
210 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
211 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
212 result_table.shape |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
213 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
214 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
215 # In[1285]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
216 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
217 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
218 result_selected.insert(0,'Resistance_phenotype','') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
219 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
220 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
221 # In[1286]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
222 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
223 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
224 result_selected.to_csv(output_table,na_rep='NA') |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
225 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
226 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
227 # In[1287]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
228 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
229 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
230 #rename headers |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
231 result_selected.rename(columns = {'Ticarcillin/clavulanicacid':'Ticarcillin/clavulanic acid','Piperacillin/tazobactam':'Piperacillin/ tazobactam','Trimethoprim/sulfamethoxazole': 'Trimethoprim/ sulfamethoxazole','Ampicillin/sulbactam':'Ampicillin/ sulbactam', 'Polymyxinb': 'Polymyxin B'} ) |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
232 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
233 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
234 # In[ ]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
235 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
236 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
237 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
238 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
239 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
240 # In[ ]: |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
241 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
242 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
243 |
c1a77856070c
"planemo upload for repository https://github.com/rakesh4osdd/asist/tree/master commit f5b374bef15145c893ffdd3a7d2f2978d8052184-dirty"
rakesh4osdd
parents:
diff
changeset
|
244 |