-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRaSP_postprocess
More file actions
executable file
·47 lines (35 loc) · 1.57 KB
/
RaSP_postprocess
File metadata and controls
executable file
·47 lines (35 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
#Rapid protein stability prediction, RaSP, Developed by Blaabjerg et al. 2022 doi: 10.1101/2022.07.14.500157
#Adapted and implemented in 2022, Kristine Degn
import argparse
import pandas as pd
parser = argparse.ArgumentParser(prog = "RaSP_postprocess",
usage = 'RaSP_postprocess [-h] help, [-i] input csv')
parser.add_argument("-i", '--input',
metavar = 'input csv',
type=str,
help='The name and path to of the output csv file, e.g. output/predictions/cavity_pred_P62942_A.csv')
args = parser.parse_args()
#importing file
file = args.input
#reading into dataframe and extracting relevant files.
df = pd.read_csv(file)
df = df[['variant', 'wt_AA', 'pos', 'mt_AA', 'chainid', 'score_ml']]
#assigning Mutatex and Rosetta mutant normenclature
mutatex_normenclature = []
for i,k in enumerate(df.variant):
mutatex_v = f"{k[0]}{df.chainid[i]}{k[1:-1]}{k[-1]}"
mutatex_normenclature.append(mutatex_v)
rosetta_normenclature = []
for i,k in enumerate(df.variant):
rosetta_v = f"{df.chainid[i]}.{k[0]}.{k[1:-1]}.{k[-1]}"
rosetta_normenclature.append(rosetta_v)
df['mutatex_name'] = mutatex_normenclature
df['rosetta_name'] = rosetta_normenclature
#renaming columns
df.rename({'score_ml': 'RaSP_ddG'}, axis=1, inplace=True)
df = df[['variant', 'RaSP_ddG', 'mutatex_name', 'rosetta_name', 'wt_AA', 'pos', 'mt_AA', 'chainid']]
#exporting file.
f = ("/").join(file.split("/")[:-1])
n = file.split("/")[-1].split("cavity_pred_")[-1]
df.to_csv(f"{f}/post_processed_{n}")