/usr/share/ray/scripts/NCBI-Taxonomy/Create-Taxon-Names.py is in ray-extra 2.3.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/env python
# encoding: UTF-8
# author: Sébastien Boisvert
# date: 2012-09-19
import sys
print("[Create-Taxon-Names.py]")
if len(sys.argv)!=4:
print("Error: invalid number of arguments.")
sys.exit(1)
# columns are separated with |
# column 1 is the identifier
# column 3 is the rank
nodeFile=sys.argv[1]
# columns are separated with |
# column 1 is the identifier
# column 2 is the name
# column 4 must contain 'scientific name'
nameFile=sys.argv[2]
outputFile=sys.argv[3]
outputStream=open(outputFile,"w")
storage={}
stream=open(nodeFile,"r")
print("Reading "+nodeFile)
for line in stream:
columns=line.split("|")
identifier=int(columns[1-1].strip())
taxonomicRank=columns[3-1].strip()
if identifier not in storage:
storage[identifier]=[]
storage[identifier].append(taxonomicRank)
print("Done.")
stream.close()
stream=open(nameFile,"r")
validName='scientific name'
print("Reading "+nameFile)
for line in stream:
columns=line.split("|")
identifier=int(columns[1-1].strip())
name=columns[2-1].strip()
entryType=columns[4-1].strip()
if entryType!=validName:
continue
if identifier not in storage:
print("Warning: "+name+" is in "+nameFile+" but not in "+nodeFile)
continue
if len(storage[identifier])==2:
print("Warning: "+name+" has many scientific names in "+nameFile)
continue
storage[identifier].append(name)
stream.close()
print("Done.")
identifiers=storage.keys()
identifiers.sort()
rankIndex=0
nameIndex=1
for identifier in identifiers:
name=storage[identifier][nameIndex]
taxonomicRank=storage[identifier][rankIndex]
outputStream.write(str(identifier)+" "+name+" "+taxonomicRank+"\n")
outputStream.close()
print("Created "+outputFile)
|