-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.py
More file actions
executable file
·32 lines (27 loc) · 777 Bytes
/
Copy pathquery.py
File metadata and controls
executable file
·32 lines (27 loc) · 777 Bytes
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
import sys
import os
import csv
def parser():
clean_vars = []
with open('filtered_ids.csv', 'r') as csvfile:
reader = csv.reader(csvfile, delimiter='\n')
for row in reader:
clean_vars.append(row)
return clean_vars
def query(data):
count = 0
for isolate in data:
if(count%100==0):
print("Download " + str(count) + " Complete.")
url = "http://rest.pubmlst.org/db/pubmlst_spneumoniae_isolates/isolates/" + isolate[0] + "/contigs_fasta?header=original_designation"
filename = isolate[0] + '.fasta'
command = "curl -i " + url + " > " + filename
os.system(command)
count += 1
return
def main():
data = parser()
print("Parsed!")
query(data)
if __name__ == "__main__":
main()