-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_and_rename_data.py
71 lines (65 loc) · 3.33 KB
/
copy_and_rename_data.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import pandas as pd
import streamlit as st
def copy_and_rename_data():
folderProject = "./Data/Antoine/ubiquitin"
folderCsvRawData = folderProject + "/" + "csv_raw_data"
folderWlcManualFit = folderProject + "/" + "wlc_manual_fit"
if not os.path.exists(folderCsvRawData):
os.mkdir(folderCsvRawData)
namesWlc = [name for name in os.listdir(folderWlcManualFit)]
for name in namesWlc:
data = pd.read_csv(folderWlcManualFit+"/"+name)
data.to_csv(folderCsvRawData+"/"+name)
folderProject = "./Data/Antoine/ubiquitin"
folderCsvRawData = folderProject + "/" + "csv_raw_data"
folderWlcManualFit = folderProject + "/" + "wlc_manual_fit"
for root, dirs, files in os.walk(folderProject):
for name in files:
if name!="wlc_manual_fit.csv":
nameMaker = name.split(" ")
if len(nameMaker)==3:
pathFixed = os.path.join(root, " ".join((nameMaker[0],"data",nameMaker[2])))
elif len(nameMaker)==4:
pathFixed = os.path.join(root, " ".join((nameMaker[0], "data", nameMaker[2])))
else:
st.text(nameMaker)
pathFixed = os.path.join(root, "test"+name[-5:])
os.rename(os.path.join(root,name), pathFixed)
folderProject = "./Data/Antoine/dmMBP"
folderCsvRawData = folderProject + "/" + "csv_raw_data"
folderWlcManualFit = folderProject + "/" + "wlc_manual_fit"
for root, dirs, files in os.walk(folderProject):
for name in files:
if name!="wlc_manual_fit.csv":
nameMaker = name.split(" ")
if len(nameMaker)==3:
pathFixed = os.path.join(root, " ".join((nameMaker[0],"data",nameMaker[2])))
elif len(nameMaker)==4:
pathFixed = os.path.join(root, " ".join((nameMaker[0], "data", nameMaker[2], nameMaker[3])))
elif len(nameMaker)==5:
pathFixed = os.path.join(root, " ".join((nameMaker[0], "data", nameMaker[2], nameMaker[3], nameMaker[4])))
else:
st.text(nameMaker)
pathFixed = os.path.join(root, "test"+name[-5:])
os.rename(os.path.join(root,name), pathFixed)
folderProject = "./Data/ubiquitin_20200717"
folderCsvRawData = folderProject + "/" + "csv_raw_data"
folderWlcManualFit = folderProject + "/" + "wlc_manual_fit"
for root, dirs, files in os.walk(folderProject):
for name in files:
if name != "wlc_manual_fit.csv":
nameMaker = name.split(" ")
if len(nameMaker) == 3:
pathFixed = os.path.join(root, " ".join((nameMaker[0], "data", nameMaker[2])))
elif len(nameMaker) == 4:
pathFixed = os.path.join(root, " ".join((nameMaker[0], "data", nameMaker[2], nameMaker[3])))
elif len(nameMaker) == 5:
pathFixed = os.path.join(root,
" ".join((nameMaker[0], "data", nameMaker[2], nameMaker[3], nameMaker[4])))
else:
st.text(nameMaker)
pathFixed = os.path.join(root, "test" + name[-5:])
os.rename(os.path.join(root, name), pathFixed)
if __name__ == '__main__':
copy_and_rename_data()