-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatesInventory.py
More file actions
61 lines (44 loc) · 1.96 KB
/
platesInventory.py
File metadata and controls
61 lines (44 loc) · 1.96 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
CRYPTIC_PLATES = ['4Q249', '4Q250', '4Q298', '4Q317', '4Q324d-i', '4Q324d','4Q324', '4Q313', '11Q23']
BEST_COND = ['4Q298', '4Q317', '4Q249' ]
DATA_PATH ='data/Fragment on plate to DJD 27042017.xlsx'
def allPlates():
data = pd.read_excel(DATA_PATH, dtype={'Plate number- IAA inventory ':str})
crypticData = data[ data['Manuscript number '].isin(BEST_COND)]
#saveCryptic(crypticData)
_, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4))
sns.countplot(x='Manuscript number ', hue='Plate number- IAA inventory ', data=crypticData, ax=axes[1])
plt.show()
existing = getExistingAllPlates()
new_df = pd.merge(crypticData, existing, how='left',
left_on=['Plate number- IAA inventory ', 'Fragment number (on IAA plate)'],
right_on=['Plate number- IAA inventory ', 'Fragment number (on IAA plate)'])
new_df = new_df.fillna(False)
saveCryptic( new_df, 'crypticExist')
_, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4))
sns.countplot(x='Plate number- IAA inventory ', hue='exist', data=new_df, ax=axes[1])
#sns.countplot(x='Plate number- IAA inventory ', data=new_df, ax=axes[1])
plt.show()
print("")
def getExistingAllPlates():
import os
plates = []
fragments =[]
for f in os.listdir('data/adielNoBg'):
temp = f.split('-')
plate = temp[0]
plate = int(plate[1:])
fragment = temp[1]
fragment = int(fragment[2:])
plates.append(str(-plate))
fragments.append(fragment)
return pd.DataFrame( { 'Plate number- IAA inventory ': plates, 'Fragment number (on IAA plate)':fragments, 'exist': [ True]*len(fragments) } ).drop_duplicates()
def saveCryptic(crypticData, name):
writer = pd.ExcelWriter('data/{}.xlsx'.format(name))
crypticData.to_excel(writer, 'Sheet1')
writer.save()
print("")
if __name__ =='__main__':
allPlates()