-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathList_membership_check
92 lines (68 loc) · 2.04 KB
/
List_membership_check
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import sys
import xlrd
#if len(sys.argv) <5:
# print("Usage: python %s requires input excel workbooks, end cell #, and sheet name from data book" % (sys.argv[0]))
# sys.exit() #Prints reminder to user if parameters are missing
print(sys.argv[1]) #Data workbook
print(sys.argv[2]) #Sheet name with columns
def List_Puller(excel, sheet):
data_book=xlrd.open_workbook(excel)
Algynomics=[]
PainNetwork=[]
PainGeneDB=[]
HumanPainGeneDB=[]
All=[]
sheet1=data_book.sheet_by_name(sheet)
Algy=sheet1.col_values(1)
PainNB=sheet1.col_values(2)
PGDB=sheet1.col_values(3)
HPGDB=sheet1.col_values(4)
All_Genes=sheet1.col_values(5)
for value in Algy:
Algynomics.append(value)
del Algynomics[0]
for value in PainNB:
PainNetwork.append(value)
del PainNetwork[0]
for value in PGDB:
PainGeneDB.append(value)
del PainGeneDB[0]
for value in HPGDB:
HumanPainGeneDB.append(value)
del HumanPainGeneDB[0]
for value in All_Genes:
All.append(value)
del All[0]
return Algynomics, PainNetwork, PainGeneDB, HumanPainGeneDB, All
#print(Algynomics) #excel pull double check
#print(PainNetwork)
#print(PainGeneDB)
#print(HumanPainGeneDB)
def Proof(passed_tuple):
a,b,c,d,e=passed_tuple
all4=[]
atleasttwo=[]
for gene in e:
if gene in a and b and c and d:
gene_count=4
all4.append(gene)
if gene in a and gene in b :
atleasttwo.append(gene)
if gene in a and gene in c:
atleasttwo.append(gene)
if gene in a and gene in d:
atleasttwo.append(gene)
if gene in b and gene in c:
atleasttwo.append(gene)
if gene in b and gene in d:
atleasttwo.append(gene)
if gene in c and gene in d:
atleasttwo.append(gene)
print(set(atleasttwo))
#count_dict=dict(zip(gene,gene_count))
def main():
file=sys.argv[1]
sheet_name=sys.argv[2]
LP=List_Puller(file, sheet_name)
Proof(LP)
main()