Spaces:
Sleeping
Sleeping
fatmacankara
commited on
Commit
•
f4cc265
1
Parent(s):
10bf2b1
Update code/process_input.py
Browse files- code/process_input.py +8 -2
code/process_input.py
CHANGED
@@ -6,15 +6,22 @@ def clean_data(input_set):
|
|
6 |
if ',' in input_set:
|
7 |
input_set = [i.strip() for i in input_set.split(',')]
|
8 |
initial_len = len(input_set)
|
|
|
9 |
for i in input_set:
|
10 |
data = data.append(pd.Series([j.strip() for j in i.split('-')]), ignore_index=True)
|
11 |
data.columns = ['uniprotID', 'wt', 'pos', 'mut']
|
|
|
|
|
12 |
elif '\t' in input_set:
|
13 |
input_set = [i.strip() for i in input_set.split('\t')]
|
14 |
initial_len = len(input_set)
|
|
|
15 |
for i in input_set:
|
16 |
data = data.append(pd.Series([j.strip() for j in i.split('-')]), ignore_index=True)
|
17 |
data.columns = ['uniprotID', 'wt', 'pos', 'mut']
|
|
|
|
|
|
|
18 |
|
19 |
elif '-' in input_set:
|
20 |
data = data.append(pd.Series([j.strip() for j in input_set.split('-')]), ignore_index=True)
|
@@ -38,8 +45,7 @@ def clean_data(input_set):
|
|
38 |
data.at[i, 'datapoint'] = data.at[i, 'uniprotID'] + data.at[i, 'wt'] + str(data.at[i, 'pos']) + data.at[i, 'mut']
|
39 |
|
40 |
data = data.astype(str)
|
41 |
-
|
42 |
-
st.write(f'{initial_len- len(data)} of {initial_len} datapoints is omitted. Check your input.')
|
43 |
return data
|
44 |
except ValueError:
|
45 |
st.write('Your input is in the wrong format. Please see the example.')
|
|
|
6 |
if ',' in input_set:
|
7 |
input_set = [i.strip() for i in input_set.split(',')]
|
8 |
initial_len = len(input_set)
|
9 |
+
|
10 |
for i in input_set:
|
11 |
data = data.append(pd.Series([j.strip() for j in i.split('-')]), ignore_index=True)
|
12 |
data.columns = ['uniprotID', 'wt', 'pos', 'mut']
|
13 |
+
if initial_len != len(data):
|
14 |
+
st.write(f'{initial_len- len(data)} of {initial_len} datapoints is omitted. Check your input.')
|
15 |
elif '\t' in input_set:
|
16 |
input_set = [i.strip() for i in input_set.split('\t')]
|
17 |
initial_len = len(input_set)
|
18 |
+
|
19 |
for i in input_set:
|
20 |
data = data.append(pd.Series([j.strip() for j in i.split('-')]), ignore_index=True)
|
21 |
data.columns = ['uniprotID', 'wt', 'pos', 'mut']
|
22 |
+
if initial_len != len(data):
|
23 |
+
st.write(f'{initial_len- len(data)} of {initial_len} datapoints is omitted. Check your input.')
|
24 |
+
for i in input_set:
|
25 |
|
26 |
elif '-' in input_set:
|
27 |
data = data.append(pd.Series([j.strip() for j in input_set.split('-')]), ignore_index=True)
|
|
|
45 |
data.at[i, 'datapoint'] = data.at[i, 'uniprotID'] + data.at[i, 'wt'] + str(data.at[i, 'pos']) + data.at[i, 'mut']
|
46 |
|
47 |
data = data.astype(str)
|
48 |
+
|
|
|
49 |
return data
|
50 |
except ValueError:
|
51 |
st.write('Your input is in the wrong format. Please see the example.')
|