-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCUrrito3.1_AccessionNumbers.py
52 lines (35 loc) · 1.36 KB
/
CUrrito3.1_AccessionNumbers.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
import sys, getopt
def main(argv):
InputFile_TargetID_AccessionNumber = ""
OutputFilePath = ""
AccessionNumber = ""
try:
opts, args = getopt.getopt(argv,"i:o:",["InputFile_TargetID_AccessionNumber=", "OutputFilePath="])
except getopt.GetoptError:
print ('AccessionNumbers.py -i <InputFile_TargetID_AccessionNumber> -o <OutputFilePath>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('AccessionNumbers.py -i <InputFile_TargetID_AccessionNumber> -o <OutputFilePath>')
sys.exit()
elif opt in ("-i", "--InputFile"):
InputFile_TargetID_AccessionNumber = arg
elif opt in ("-o", "--OutputFilePath"):
OutputFilePath = arg
inputFile = open(InputFile_TargetID_AccessionNumber)
tempstring = "temp"
while tempstring:
tempstring = inputFile.readline()
if tempstring == "":
break
templine = tempstring.splitlines()
x = templine[0]
rowlist = x.split('\n')
AccessionNumber = rowlist[0]
NameOfMyFile = OutputFilePath + AccessionNumber + ".txt"
outputFile = open(NameOfMyFile, 'w')
outputFile.write(AccessionNumber)
outputFile.close()
inputFile.close()
if __name__ == "__main__":
main(sys.argv[1:])