Rlegaspi Week 9
Contents
- 1 Exporting a Vibrio cholerae Gene Database
- 1.1 Export Information
- 1.2 TallyEngine
- 1.3 Using XMLPipeDB match to Validate the XML Results from the TallyEngine
- 1.4 Using SQL Queries to Validate the PostgreSQL Database Results from the TallyEngine
- 1.5 OriginalRowCounts Comparison
- 1.6 Visual Inspection
- 1.7 .gdb Use in GenMAPP
- 1.8 Compare Gene Database to Outside Resource
- 2 From How Do I Count Thee?
Exporting a Vibrio cholerae Gene Database
Export Information
Version of GenMAPP Builder: gmbuilder-3.0.0-build-5
Computer on which export was run: SEA 120
Postgres Database name: Vcholerea_20151027_gmb3build5
UniProt XML filename (give filename and upload and link to compressed file): uniprot-organism%3A243277.xml.gz
- UniProt XML version (The version information can be found at the UniProt News Page): 2015_10_14 (October 14, 2015)
- UniProt XML download link: http://www.uniprot.org/uniprot/?query=organism:243277
- Time taken to import: 2.99 minutes
- Note:
GO OBO-XML filename (give filename and upload and link to compressed file): go_daily-termdb.obo-xml.gz
- GO OBO-XML version (The version information can be found in the file properties after the file downloaded from the GO Download page has been unzipped): 2015_10_27
- GO OBO-XML download link: http://archive.geneontology.org/latest-termdb/go_daily-termdb.obo-xml.gz
- Time taken to import: 7.02 minutes
- Time taken to process: 4.36 minutes
- Note: .obo-xml file has taken longer to import; in addition, there was time to process.
GOA filename (give filename and upload and link to compressed file): 46.V_cholerae_ATCC_39315.goa
- GOA version (News on this page records past releases; current information can be found in the Last modified field on the FTP site): 13-Oct-2015 07:31
- GOA download link: http://ftp.ebi.ac.uk/pub/databases/GO/goa/proteomes/46.V_cholerae_ATCC_39315.goa
- Time taken to import: 0.06 minutes
- Note: This file took the least amount of time. Significantly less time.
Name of .gdb file (give filename and upload and link to compressed file): Vc-Std_20151027_RARL.gdb
- Time taken to export: 77 minutes (1 hour and 17 minutes)
- Start time: 3:53 PM
- End time: 5:10 PM
Note: The export time was over an hour long. The export process was completed during after-class hours.
TallyEngine
- Run the TallyEngine in GenMAPP Builder and record the number of records for UniProt and GO in the XML data and in the Postgres databases.
- Choose the menu item Tallies > Run XML and Database Tallies for UniProt and GO...
- Take a screenshot of the results. Upload the image to the wiki and display it on this page.
- For more information, see this page.
The first tool, called the Tally Engine, can be used for verifying that certain data from the XML file transferred consistently into the PostgreSQL database upon import. The Tally Engine can be found in GenMAPP Builder itself.
- Run PostgreSQL (via pgAdmin III on Windows) and make sure that your database is up and running.
- Run GenMAPP Builder and make sure that it is connected to the database (via Configure Database...).
- After performing an import, choose Run XML and Database Tallies for UniProt and GO....
- Choose the UniProt and GO files that you imported.
- You should see a table for selected data items, and how many of each were found.
Under the hood, the Tally Engine bases its XML counts on certain XML tags, and bases its database counts on SQL queries using count. This tool is thus primarily useful for making sure that the “raw” import worked without any errors or glitches.
Using XMLPipeDB match to Validate the XML Results from the TallyEngine
Follow the instructions found on this page to run XMLPipeDB match.
Are your results the same as you got for the TallyEngine? Why or why not?
Using SQL Queries to Validate the PostgreSQL Database Results from the TallyEngine
For more information, see this page.
You can also look for counts at the SQL level, using some variation of a select count(*) query. This requires some knowledge of which table received what data. Here’s an initial tip: the gene/name tags in the XML file land in the genenametype table. A query on this table counting values from this table that were marked as ordered locus in the XML file matching the pattern VC_[0-9][0-9][0-9][0-9] would look like this:
select count(*) from genenametype where type = 'ordered locus' and value ~ 'VC_[0-9][0-9][0-9][0-9]'; select count(*) from genenametype where type = 'ordered locus' and value ~ 'VC_A?[0-9][0-9][0-9][0-9]';
In pgAdmin III, you can issue these queries by clicking on the pencil/SQL icon in the toolbar, typing the query into the SQL Editor tab, then clicking on the green triangular Play button to run.
Are your results the same as reported by the TallyEngine? Why or why not?
OriginalRowCounts Comparison
Within the .gdb file, look at the OriginalRowCounts table to see if the database has the expected tables with the expected number of records. Compare the tables and records with a benchmark .gdb file.
Benchmark .gdb file:
Copy the OriginalRowCounts table from the benchmark and new gdb and paste them here:
Note:
Visual Inspection
Perform visual inspection of individual tables to see if there are any problems.
- Look at the Systems table. Is there a date in the Date field for all gene ID systems present in the database?
- Open the UniProt, RefSeq, and OrderedLocusNames tables. Scroll down through the table. Do all of the IDs look like they take the correct form for that type of ID?
Note:
.gdb Use in GenMAPP
Note:
Putting a gene on the MAPP using the GeneFinder window
- Try a sample ID from each of the gene ID systems. Open the Backpage and see if all of the cross-referenced IDs that are supposed to be there are there.
Note:
Creating an Expression Dataset in the Expression Dataset Manager
- How many of the IDs were imported out of the total IDs in the microarray dataset? How many exceptions were there? Look in the EX.txt file and look at the error codes for the records that were not imported into the Expression Dataset. Do these represent IDs that were present in the UniProt XML, but were somehow not imported? or were they not present in the UniProt XML?
Note:
Coloring a MAPP with expression data
Note:
Running MAPPFinder
Note:
Compare Gene Database to Outside Resource
The OrderedLocusNames IDs in the exported Gene Database are derived from the UniProt XML. It is a good idea to check your list of OrderedLocusNames IDs to see how complete it is using the original source of the data (the sequencing organization, the MOD, etc.) Because UniProt is a protein database, it does not reference any non-protein genome features such as genes that code for functional RNAs, centromeres, telomeres, etc.
Note:
From How Do I Count Thee?
The overall task of creating a GenMAPP Gene Database from XML sources is essentially a two-step data conversion operation. The first step converts the original XML data (UniProt, Gene Ontology) into relational database tables stored in PostgreSQL. The second step then extracts information from these relational tables, combines them with the Gene Ontology associations file (.goa) that links gene IDs to GO terms, and produces the GenMAPP Gene Database, which, as you have seen by now, is really a Microsoft Access database file.
Ideally, these steps take place with absolute fidelity, with everything transferring flawlessly, for every species that we try. Unfortunately, this is not always the case. In some situations, issues are actually unavoidable, as data that we expect in one place might actually reside in another, or the data items themselves are inconsistently entered (e.g., capitalization is different, underscores may be used instead of spaces, etc.).
It is thus important to have a certain tool set at our disposal for checking, in an automated fashion, how well our data have transferred from one source to another. That is the focus of this document.
Tally Engine
The first tool, called the Tally Engine, can be used for verifying that certain data from the XML file transferred consistently into the PostgreSQL database upon import. The Tally Engine can be found in GenMAPP Builder itself.
- Run PostgreSQL (via pgAdmin III on Windows) and make sure that your database is up and running.
- Run GenMAPP Builder and make sure that it is connected to the database (via Configure Database...).
- After performing an import, choose Run XML and Database Tallies for UniProt and GO....
- Choose the UniProt and GO files that you imported.
- You should see a table for selected data items, and how many of each were found.
Under the hood, the Tally Engine bases its XML counts on certain XML tags, and bases its database counts on SQL queries using count. This tool is thus primarily useful for making sure that the “raw” import worked without any errors or glitches.
XMLPipeDB Match
XMLPipeDB Match is useful for counting data in files. Thus, in our context, you would use XMLPipeDB Match to tally stuff in XML files, with greater flexibility than with Tally Engine.
You will have to use XMLPipeDB Match from the command line. In addition, you can use this in any platform (as you have seen). Download the application from the XMLPipeDB SourceForge site and take note of the location of the xmlpipedb-match-1.1.1.jar. Then, on the command line (Terminal for Linux and Mac OS X, cmd on Windows), cd to the folder containing the XML file that you would like to check. Use XMLPipeDB Match as follows, with the parts in parentheses varying depending on your specific setup, desired pattern, and file being scanned:
java -jar (location-of-jar) "(pattern)" < (XML file)
On a Windows machine, with XMLPipeDB Match and a Vibrio cholerae XML file located on the Desktop, scanning for IDs of the form VC_####, where # represents a digit from 0 to 9, one would type, after cd-ing to the Desktop:
java -jar xmlpipedb-match-1.1.1.jar "VC_[0-9][0-9][0-9][0-9]" < uniprot-taxonomy%3A243277.xml
As you have seen before, this will give you a list of unique matches, with a total number at the bottom.
The trick with XMLPipeDB Match is to use the patterns well: with the database project, you will mainly be matching IDs. A desired count is an XMLPipeDB Match result whose matched ID pattern corresponds to the number of IDs found by the Tally Engine.
SQL
You can also look for counts at the SQL level, using some variation of a select count(*) query. This requires some knowledge of which table received what data. Here’s an initial tip: the gene/name tags in the XML file land in the genenametype table. A query on this table counting values from this table that were marked as ordered locus in the XML file matching the pattern VC_[0-9][0-9][0-9][0-9] would look like this:
select count(*) from genenametype where type = 'ordered locus' and value ~ 'VC_[0-9][0-9][0-9][0-9]';
In pgAdmin III, you can issue these queries by clicking on the pencil/SQL icon in the toolbar, typing the query into the SQL Editor tab, then clicking on the green triangular Play button to run.
Microsoft Access
For the GenMAPP Gene Database, you can open the .gdb in Microsoft Access and navigate its tables to find counts for various IDs. Opening the table, noting its size, and doing some sorting may help. You can also look at the OriginalRowCounts table for a summary of totals.
Again, the ideal situation is a correspondence in these numbers with what you found in XML and the relational database.
Back to the Command Line
Amidst all this, you can still use grep and wc on the command line for some basic counting. Just remember that these tools work on a line-by-line basis; useful in some cases, but not useful in others.
You can use grep and wc with the various files on the my.cs.lmu.edu server by using the curl -O command shown in the Week 6 assignment. Upload your data files to the wiki, place media links to them on your wiki page, then mouse over those live links to capture their URL (like this—look at the source to see the wiki markup), then use curl -O (whatever-the-url-is) while ssh-ed to my.cs.lmu.edu to bring that file into the server.
- If the file is a .zip file, you can use unzip at the command line to unzip it.
- If the file is a .gz file, you can use gunzip at the command line to uncompress that one.