Skip to content

Instantly share code, notes, and snippets.

@irwandwiyanto
Created August 11, 2016 07:16
Show Gist options
  • Select an option

  • Save irwandwiyanto/bc958e11ea8940d96d1c9c9946045db4 to your computer and use it in GitHub Desktop.

Select an option

Save irwandwiyanto/bc958e11ea8940d96d1c9c9946045db4 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import simplejson as json
import optparse
import sys
input_file = str(sys.argv[1])
data = open(input_file, 'r')
location_database = open('/home/bioinformatics2/DW/taxo.json', 'r')
database = json.load(location_database)
for line in data:
for taxonomy in database:
if taxonomy["genus"] == line.replace('\n','') :
print "Kingdom: %s," % taxonomy['kingdom'],
print "phylum: %s," % taxonomy['phylum'],
print "class: %s," % taxonomy['class'],
print "order: %s," % taxonomy['order'],
print "family: %s," % taxonomy['family'],
print "genus: %s" % taxonomy['genus']
break
else:
print ("No found genus on taxanomy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment