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.

Revisions

  1. irwandwiyanto created this gist Aug 11, 2016.
    27 changes: 27 additions & 0 deletions dictionary_taxonomy.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/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")