blast.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. Adding BLAST Results
  2. ====================
  3. .. note::
  4. Remember you must set the ``$DRUPAL_HOME`` environment variable if you want to cut-and-paste the commands below. See :doc:`../../install_tripal/drupal_home`
  5. Adding BLAST Databases
  6. ----------------------
  7. Before we load our BLAST results we want to add some external databases. For this tutorial we have protein BLAST results against NCBI nr and ExPASy SwissProt. We would like the BLAST hits to be clickable such that they link back to their respective databases. To do this, we must add some additional databases. Navigate to **Tripal → Data Loaders → Chado Databases** and click the link titled **Add a Database**. The resulting page provides fields for adding a new database. Add two new databases, one for NCBI nr and the other for ExPASy SwissProt.
  8. Use these values for adding the NCBI nr database:
  9. .. csv-table::
  10. :header: "Field Name", "Value"
  11. "Name", "NCBI nr"
  12. "Description", "NCBI's non-redundant protein database"
  13. "URL", "http://www.ncbi.nlm.nih.gov/"
  14. "URL Prefix", "http://www.ncbi.nlm.nih.gov/protein/"
  15. Use these values for adding the SwssProt database:
  16. .. csv-table::
  17. :header: "Field Name", "Value"
  18. "Name", "ExPASy Swiss-Prot"
  19. "Description", "A curated protein sequence database which strives to provide a high level of annotation, a minimal level of redundancy and high level of integration with other databases"
  20. "URL", "http://expasy.org/sprot/"
  21. "URL prefix", "http://www.uniprot.org/uniprot/"
  22. Configure Parsing of BLAST Results
  23. ----------------------------------
  24. First, we need to ensure that the BLAST module can properly parse the BLAST hits. To do this, navigate to **Tripal → Extensions → Tripal Blast Analyses**. On this page are configuration settings for the Tripal BLAST Analysis extension module.
  25. Within the section titled BLAST Parsing, you can specify a different, more meaningful name for the sequence library file (a.k.a. database) used for BLASTing. This name will be displayed with BLAST results. You can also provide regular expressions for parsing BLAST hits. For example, the following is a line for a match from SwissProt:
  26. ::
  27. sp|P43288|KSG1_ARATH Shaggy-related protein kinase alpha OS=Arabidopsis thaliana GN=ASK1 PE=2 SV=3
  28. Here the hit name is ``KSG1_ARATH``, the accession is ``P43288``, the hit description is ``Shaggy-related protein kinase alpha OS=Arabidopsis thaliana`` and the organism is ``Arabidopsis thaliana``. We need regular expressions to tell Tripal how to extract these unique parts from the match text. Because Tripal is a PHP application, the syntax for regular expressions follows the PHP method. Documentation for regular expressions used in PHP can be found here. The following regular expressions can be used to extract the hit name, the accession, hit description and organism for the example SwissProt line above:
  29. .. csv-table::
  30. :header: "Element", "Regular Expression"
  31. "Hit Name", ``^sp\|.*?\|(.*?)\s.*?$``
  32. "Hit Description", ``^sp\|.*?\|.*?\s(.*)$``
  33. "Hit Accession", ``^sp\|(.*?)\|.*?\s.*?$``
  34. "Hit Organism", ``^.*?OS=(.*?)\s\w\w=.*$``
  35. In this tutorial, we will be adding BLAST results for the two databases we just created: ExPASy SwissProt and NCBI nr. First, select ExPASy SwissProt from the drop-down menu. A form will appear:
  36. .. image:: blast1.png
  37. In the form fields, add the following values:
  38. .. csv-table::
  39. :header: "Field", "Value"
  40. "Title for the BLAST analysis", "(leave blank)"
  41. "Regular expression for Hit Name", ``^sp\|.*?\|(.*?)\s.*?$``
  42. "Regular expression for Hit Description", ``^sp\|.*?\|.*?\s(.*)$``
  43. "Regular expression for Hit Accession:", ``^sp\|(.*?)\|.*?\s.*?$``
  44. "Regular expression for Organism", ``^.*?OS=(.*?)\s\w\w=.*$``
  45. "Organism Name", "(leave blank)"
  46. Click **Save Settings**.
  47. The match accession will be used for building web links to the external database. The accession will be appended to the URL Prefix set earlier when the database record was first created.
  48. Now select the **NCBI nr** database from the drop-down. NCBI databases use a format that is compatible with BLAST. Therefore, the hit name, accession and description are handled differently in the BLAST XML results. To correctly parse results from an NCBI database click the **Use Genbank style parser** checkbox. This should disable all other fields and is all we need for this database. Clikc the Save Settings button.
  49. Create the Analysis Page
  50. ------------------------
  51. .. note::
  52. It is always recommended to create an analysis page anytime you import data. The purpose of the analysis page is to describe how the data being added was derived or collected.
  53. Now we can create our analysis page. Navigate to **Content → Tripal Content** and click the **Add Tripal Content** link. This page contains a variety of content types that the site supports. Scroll to the **Other** section and find the content type named **Blast Results**:
  54. .. image:: blast2.png
  55. Here we can save details about the analysis used to create the BLAST results. Enter the following in the fields that appear on the page:
  56. .. csv-table::
  57. :header: "Field", "Value"
  58. "Name", "blastx Citrus sinensis v1.0 genes vs ExPASy SwissProt"
  59. "Description", "Citrus sinensis mRNA sequences were BLAST'ed against the ExPASy SwissProt protein database using a local installation of BLAST on in-house linux server. Expectation value was set at 1e-6"
  60. "BLAST Program", "blastx"
  61. "BLAST Version", "2.2.25"
  62. "Data Source Name ", "Citrus sinensis mRNA vs ExPASy SwissProt"
  63. "Date Performed", "(today's date)"
  64. Click the **Save** button. You can now see our new BLAST analysis page.
  65. .. image:: blast3.png
  66. Create a second Analysis page for the results of the NCBI nr BLAST analysis. Use the following values:
  67. .. csv-table::
  68. :header: "Field", "Value"
  69. "Name", "blastx Citrus sinensis v1.0 genes vs NCBI nr"
  70. "Description", "Citrus sinensis mRNA sequences were BLAST'ed against the NCBI non-redundant protein database using a local installation of BLAST on in-house linux server. Expectation value was set at 1e-6"
  71. "BLAST Program", "blastx"
  72. "BLAST Version", "2.2.25"
  73. "Data Source Name ", "Citrus sinensis mRNA vs NCBI nr"
  74. "Date Performed", "(today's date)"
  75. Import the BLAST XML results
  76. ----------------------------
  77. First, we will load BLAST results for our citrus gene vs ExPASy SwissProt. Now that we have our database records setup and configured and we have our analysis record created, we are ready to import the blast results. To do this, navigate to **Tripal > Data Loaders > Chado BLAST XML results loader**. The following page will be presented:
  78. .. image:: blast4.png
  79. The top section of this page provides multiple methods for providing results file: via an upload interface, specifying a remote URL or a file path that is local to the server. Most likely, you will always upload or provide a remote URL. However, we download the file earlier, and stored them here: ``$DRUPAL_HOME/sites/default/files``. So, in this case we can use the path on the local server. Provide the following value for this form:
  80. .. csv-table::
  81. :header: "Field", "Value"
  82. "Server path", "sites/default/files/Blastx_citrus_sinensis-orange1.1g015632m.g.fasta.0_vs_uniprot_sprot.fasta.out"
  83. "Analysis", "blastx Citrus sinensis v1.0 genes vs ExPASy SwissProt (blastall 2.2.25, Citrus sinensis mRNA vs ExPASy SwissProt)"
  84. "Database", "ExPASy SwissProt"
  85. "BLAST XML File Extension", "out"
  86. "Query Type", "mRNA"
  87. .. note::
  88. For the **Server path** we need not give the full path. Because we downloaded the files into the Drupal directory we can leave off any preceding path and Tripal will resolve the path. Otherwise we could provide the full path.
  89. .. note::
  90. Specifying **ExPASy SwissProt** as the database will allow the importer to use the database configuration settings we entered earlier.
  91. Clicking the **Import BLAST file** will add a job which we can manually execute with the following command:
  92. ::
  93. drush trp-run-jobs --username=administrator --root=$DRUPAL_HOME
  94. The results should now be loaded. Now we want to add the results for NCBI nr. Repeat the steps above to add a new analysis with the following details:
  95. .. csv-table::
  96. :header: "Field", "Value"
  97. "Server path", "sites/default/files/Blastx_citrus_sinensis-orange1.1g015632m.g.fasta.0_vs_nr.out"
  98. "Analysis", "blastx Citrus sinensis v1.0 genes vs ExPASy SwissProt (blastall 2.2.25, Citrus sinensis mRNA vs NCBI nr)"
  99. "Database", "ExPASy SwissProt"
  100. "BLAST XML File Extension", "out"
  101. "Query Type", "mRNA"
  102. Click the Save button and manually run the job:
  103. ::
  104. drush trp-run-jobs --username=administrator --root=$DRUPAL_HOME
  105. To view results we must find the mRNA that has BLAST hits. For this example, click on the **mRNA Search** link in the **Data Search** block. Search for the mRNA named `orange1.1g015615m`. Viewing the page, we should now see BLAST results by clicking the 'BLAST results' link in the left table of contents.
  106. .. image:: blast5.png
  107. Notice, that when viewing the results, the SwissProt matches are links. When clicked they redirect the user to the SwissProt website where users can find more information about that protein.
  108. .. image:: blast6.png
  109. .. note::
  110. The match links are able to link out to SwissProt and NCBI because of the initial setup where we added the database settings and we set regular expressions for parsing the match accessions.