Difference between revisions of "Rlegaspi Week 9"

From LMU BioDB 2015
Jump to: navigation, search
(Copied and pasted assignment from Gene Database Testing Report Sample.)
 
(Inputted export time and notes about the .gdb file upload. And preparation of electronic lab notebook.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Exporting a ''Vibrio cholerae'' Gene Database =
 
= Exporting a ''Vibrio cholerae'' Gene Database =
==Export Information==
+
== Export Information ==
  
Version of GenMAPP Builder:
+
Version of GenMAPP Builder: gmbuilder-3.0.0-build-5
  
Computer on which export was run:  
+
Computer on which export was run: SEA 120
  
Postgres Database name:  
+
Postgres Database name: Vcholerea_20151027_gmb3build5
  
UniProt XML filename (give filename and upload and link to compressed file):
+
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 [http://uniprot.org/news the UniProt News Page]):  
+
* UniProt XML version (The version information can be found at [http://uniprot.org/news the UniProt News Page]): 2015_10_14 (October 14, 2015)
* UniProt XML download link:
+
* UniProt XML download link: http://www.uniprot.org/uniprot/?query=organism:243277
* Time taken to import:  
+
* Time taken to import: 2.99 minutes
 
** Note:  
 
** Note:  
  
GO OBO-XML filename (give filename and upload and link to compressed file):  
+
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 [http://beta.geneontology.org/page/download-ontology GO Download page] has been unzipped):  
+
* GO OBO-XML version (The version information can be found in the file properties after the file downloaded from the [http://beta.geneontology.org/page/download-ontology GO Download page] has been unzipped): 2015_10_27
* GO OBO-XML download link:
+
* GO OBO-XML download link: http://archive.geneontology.org/latest-termdb/go_daily-termdb.obo-xml.gz
* Time taken to import:  
+
* Time taken to import: 7.02 minutes
* Time taken to process:  
+
* Time taken to process: 4.36 minutes
** Note:
+
** 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):  
+
GOA filename (give filename and upload and link to compressed file): 46.V_cholerae_ATCC_39315.goa
* GOA version (News on [http://www.ebi.ac.uk/GOA/ this page] records past releases; current information can be found in the Last modified field on the [ftp://ftp.ebi.ac.uk/pub/databases/GO/goa/proteomes/ FTP site]):  
+
* GOA version (News on [http://www.ebi.ac.uk/GOA/ this page] records past releases; current information can be found in the Last modified field on the [ftp://ftp.ebi.ac.uk/pub/databases/GO/goa/proteomes/ FTP site]): 13-Oct-2015 07:31
* GOA download link:
+
* GOA download link: http://ftp.ebi.ac.uk/pub/databases/GO/goa/proteomes/46.V_cholerae_ATCC_39315.goa
* Time taken to import:  
+
* Time taken to import: 0.06 minutes
** Note:
+
** 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):  
+
Name of .gdb file (give filename and upload and link to compressed file): Vc-Std_20151027_RARL.gdb
* Time taken to export:  
+
* Time taken to export: 77 minutes (1 hour and 17 minutes)
** Start time:  
+
** Start time: 3:53 PM
** End time:
+
** End time: 5:10 PM
 +
Note: The export time was over an hour long. The export process was completed during after-class hours.
  
Note:
+
== TallyEngine ==
 
+
==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.
 
* 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.
Line 41: Line 40:
 
** For more information, [[How_Do_I_Count_Thee%3F_Let_Me_Count_The_Ways | see this page.]]
 
** For more information, [[How_Do_I_Count_Thee%3F_Let_Me_Count_The_Ways | 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.
 +
 +
[[Image:Tally-results.png]]
 +
 +
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==
 
== Using XMLPipeDB match to Validate the XML Results from the TallyEngine==
  
Line 54: Line 64:
  
 
  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_[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.
 
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.
  
Line 61: Line 71:
 
Are your results the same as reported by the TallyEngine?  Why or why not?
 
Are your results the same as reported by the TallyEngine?  Why or why not?
  
==OriginalRowCounts Comparison==
+
== 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.
 
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.
Line 80: Line 90:
 
Note:
 
Note:
  
==.gdb Use in GenMAPP==
+
== .gdb Use in GenMAPP ==
  
 
Note:
 
Note:
Line 90: Line 100:
 
Note:
 
Note:
  
===Creating an Expression Dataset in the Expression Dataset Manager===
+
=== 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?
 
* 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?
Line 96: Line 106:
 
Note:
 
Note:
  
===Coloring a MAPP with expression data===
+
=== Coloring a MAPP with expression data===
  
 
Note:
 
Note:
  
===Running MAPPFinder===
+
=== Running MAPPFinder ===
  
 
Note:
 
Note:
  
  
== Compare Gene Database to Outside Resource==
+
== 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.
 
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:
 
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.
 +
 +
[[Image:Tally-results.png]]
 +
 +
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 [http://sourceforge.net/projects/xmlpipedb 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&rsquo;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.
 +
 +
[[Image:pgadminiii-query.png]]
 +
 +
== 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 ([[Media:Movie.sql.txt|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.
 +
 +
<!-- Future content: advanced techniques for diff'ing grep/match results against psql results, duly processed by sed. -->

Latest revision as of 22:41, 29 October 2015

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

GO OBO-XML filename (give filename and upload and link to compressed file): go_daily-termdb.obo-xml.gz

GOA filename (give filename and upload and link to compressed file): 46.V_cholerae_ATCC_39315.goa

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.

  1. Run PostgreSQL (via pgAdmin III on Windows) and make sure that your database is up and running.
  2. Run GenMAPP Builder and make sure that it is connected to the database (via Configure Database...).
  3. After performing an import, choose Run XML and Database Tallies for UniProt and GO....
  4. Choose the UniProt and GO files that you imported.
  5. You should see a table for selected data items, and how many of each were found.

Tally-results.png

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.

Pgadminiii-query.png

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.

  1. Run PostgreSQL (via pgAdmin III on Windows) and make sure that your database is up and running.
  2. Run GenMAPP Builder and make sure that it is connected to the database (via Configure Database...).
  3. After performing an import, choose Run XML and Database Tallies for UniProt and GO....
  4. Choose the UniProt and GO files that you imported.
  5. You should see a table for selected data items, and how many of each were found.

Tally-results.png

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.

Pgadminiii-query.png

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.