Path to Root
From NCBO Wiki
Introduction
This project is used for generating a text file or populating a database with the path to root and other information for concepts from ontologies in the bioportal. This uses the REST services developed by NCBO for acessing information extracted from ontologies. For more information on the REST services please visit please visit: http://obs.bioontology.org/obs/OBS_v1_rest.html
Setting up and running the code
Steps 1,2,3 and 4 should be only be performed if you want the output to be populated into a database. If you need the output *only* to a flat file with '|' as the delimter, proceed directly to step 5.
- Create a MySQL database:
- On the machine where the database needs to be hosted, create a new database with any name. Note the IP and name of the database. Make sure port 3306 is open(default port for MySQL).
- Create a table in the database
- In the database created, create a table 'umls'
- Create columns in the table
- Create the following columns in the table
Column Name Datatype NotNull Flags Default Value conceptid VARCHAR(10) true Binary Null conceptname TEXT Null ptrs TEXT true Null ptrsnames TEXT Null namespace VARCHAR(45) true Binary Null
The following SQL command can be used:
CREATE TABLE `temp`.`umls` (
`conceptid` VARCHAR(10) NOT NULL,
`conceptname` TEXT,
`ptrs` TEXT NOT NULL,
`ptrsnames` TEXT,
`namespace` VARCHAR(45) NOT NULL,
PRIMARY KEY (`conceptid`, `ptrs`(255), `namespace`)
)
ENGINE = MyISAM;
- Note the URL of the database, the name, user and password. For eg. If you created a database 'temp' on the localhost with the user 'root' and password 'nipunb'.
Your dbURL will be: jdbc:mysql://localhost:3306/temp Your dbUser will be: root Your dbPassword will be: nipunb
- Open a new command prompt.
- Change the directory to the folder in which downloaded/copied the code.
- run at the command line
javac -classpath C:\lib\commons-codec-1.3.jar; C:\lib\commons-httpclient-3.1.jar; C:\lib\commons-logging-1.1.1.jar; C:\lib \commons-logging-1.1.1-javadoc.jar; C:\lib\commons-logging-1.1.1-sources.jar; C:\lib\commons-logging-adapters-1.1.1.jar; C:\lib \commons-logging-api-1.1.1.jar; C:\lib\commons-logging-tests.jar; C:\lib\mysql-connector-java-5.0.7-bin.jar; C:\lib \OntologyAccess090108.jar ComputeHierarchies.java (make sure javac is in classpath or else use: C:\Program Files\Java\jdk1.6.02\bin\javac
- Followed by
java -classpath .;C:\lib\commons-codec-1.3.jar;C:\lib\commons-httpclient-3.1.jar;C:\lib\commons-logging-1.1.1.jar;C:\lib\commons- logging-1.1.1-javadoc.jar;C:\lib\commons-logging-1.1.1-sources.jar;C:\lib\commons-logging-adapters-1.1.1.jar;C:\lib\commons- logging-api-1.1.1.jar;C:\lib\commons-logging-tests.jar;C:\lib\mysql-connector-java-5.0.7-bin.jar;C:\lib\OntologyAccess090108.jar ComputeHierarchies -ontologies "C:\\Bioportal\\SAB\\SAbsTest.txt" -db "true" dbURL "jdbc:mysql://localhost:3306/temp" -dbUser "root" -dbPassword "nipunb"
- More about the arguments:
- Arguments are
- More about the arguments:
-ontologies : The complete path of the file containing the SABs of the ontologies to be used. The file should contain one SAB
on every line. Please see SABsTest.txt and SABsComplete for the correct format. The path should be of the type
C:\\Bioportal\\SAB\\SABsTest.txt
-db : Takes in true or false as string arguments. If you are setting -db to true
make sure that you have gone over steps 3 and 4. The default is set to false.
-dbURL : URL of the database to be populated. Make sure the database exists and has the correct column with the correct primary
key. Please see 4) for more details
-dbUser : Username for the database
-dbPassword : Password for the user to access the database. Leave blank if the user
has no password.
-outputFileName : Name of the file to which the path to root information is going to be written out to. If this file already,
content is appended. The format of the file is: ConceptID |Concept Name|Path to Root|Path To Root(names)|SAB
If the option is not specified, the information is not written to a file.
Sample arguments that can be used:
i) Output only to a file:
-ontologies "C:\\PathToRoot\\ptrs\\SABsTest.txt " -outputFileName "C:\\PathToRoot\\ptrs\\OutputTest.txt"
ii) Output only to a database:
-ontologies "C:\\Bioportal\\SAB\\SAbsTest.txt" -db "true" dbURL "jdbc:mysql://localhost:3306/temp" -dbUser "root"
-dbPassword "nipunb"
iii)Output to both file and DB:
-ontologies "C:\\PathToRoot\\ptrs\\SABsTest.txt " -db "true" dbURL "jdbc:mysql://localhost:3306/temp" -dbUser "root"
-dbPassword "nipunb" - outputFileName "C:\\PathToRoot\\ptrs\\OutputTest.txt"
