Skip to content

Commit d18a2d3

Browse files
committed
update scripts
Changes to be committed: modified: lib/json2csv.py new file: lib/linage.py modified: lib/validate.py
1 parent 80efaf3 commit d18a2d3

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

lib/json2csv.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
14
import json, csv
25
import argparse
36
import jsonschema

lib/linage.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import csv
5+
from Bio import Entrez
6+
7+
bioproject = {}
8+
9+
with open('test.csv', 'r') as file:
10+
data = csv.reader(file)
11+
header = next(data)
12+
for row in data:
13+
bioproject[row[0]] = row[1:]
14+
print(bioproject)
15+
test_id = bioproject['GCA_013267415.1'][5]
16+
print(test_id)
17+
# print(",".join(assembly_ids))
18+
Entrez.email = "[email protected]"
19+
# print(Entrez.epost("assembly", id=",".join(assembly_ids)).read())
20+
handle = Entrez.esearch(db="taxonomy", term=test_id)
21+
record = Entrez.read(handle)
22+
handle.close()
23+
print(record['IdList'])
24+
handle2 = Entrez.efetch(db='taxonomy', id=record['IdList'][0])
25+
record2 = Entrez.read(handle2)
26+
print(record2[0]['Lineage'])

lib/validate.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
14
import json
25
import argparse
36
import jsonschema

0 commit comments

Comments
 (0)