changeset 1:aee65d1b1840 draft

planemo upload commit b399babf7f0e3755704fb13dda1f5981495f6958
author mingchen0919
date Sun, 16 Sep 2018 17:39:54 -0400
parents e4299abb3568
children ae3909607532
files _site.yml command-line-arguments.csv index.Rmd rmarkdown_report.Rmd rmarkdown_report.sh rmarkdown_report.xml rmarkdown_report_render.R
diffstat 7 files changed, 75 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/_site.yml	Sun Sep 16 13:28:55 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-name: "Aurora Tool Website"
-output_dir: "."
-navbar:
-    title: "Aurora Tool"
-    type: inverse
-    left:
-        - text: "Job 1"
-          href: 01_rmarkdown.html
-        - text: "Job 2"
-          menu:
-            - text: "Sub-job 1"
-              href: 02_rmarkdown.html
-            - text: "Sub-job 2"
-              href: 03_rmarkdown.html
-
-output:
-  html_document:
-    theme: cosmo
-    highlight: textmate
\ No newline at end of file
--- a/command-line-arguments.csv	Sun Sep 16 13:28:55 2018 -0400
+++ b/command-line-arguments.csv	Sun Sep 16 17:39:54 2018 -0400
@@ -1,3 +1,4 @@
-short flag,argument mask,data type,variable name
-o,1,character,report
-d,1,character,report.files_path
\ No newline at end of file
+short flag,argument mask,data type,variable name
+o,1,character,report
+d,1,character,report.files_path
+p,1,character,hmmscan_pfam_tblouts
--- a/index.Rmd	Sun Sep 16 13:28:55 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-
-
-```{css echo=FALSE}
-# code chunks scrollable
-pre code, pre, code {
-  white-space: pre !important;
-  overflow-x: scroll !important;
-  word-break: keep-all !important;
-  word-wrap: initial !important;
-}
-```
-
-
-```{r, echo=FALSE}
-# to make the css theme to work, <link></link> tags cannot be added directly 
-# as <script></script> tags as below.
-# it has to be added using a code chunk with the htmltool functions!!!
-css_link = tags$link()
-css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css")
-css_link
-```
-
-```{r, eval=FALSE, echo=FALSE}
-# this code chunk is purely for adding comments
-# below is to add jQuery and jstree javascripts
-```
-<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
-<script src="vakata-jstree-3.3.5/dist/jstree.min.js"></script>
-
-```{r, eval=FALSE, echo=FALSE}
-# this code chunk is purely for adding comments
-# javascript code below is to build the file tree interface
-# see this for how to implement opening hyperlink: https://stackoverflow.com/questions/18611317/how-to-get-i-get-leaf-nodes-in-jstree-to-open-their-hyperlink-when-clicked-when
-```
-<script>
-  $(function () {
-    // create an instance when the DOM is ready
-    $('#jstree').jstree().bind("select_node.jstree", function (e, data) {
-     window.open( data.node.a_attr.href, data.node.a_attr.target )
-    });
-  });
-</script>
-
-## Outputs
-
-```{r, echo=FALSE}
-# create a div container to store the file tree interface
-library(htmltools)
-tags$div(
-  id="jstree",
-  file_tree(Sys.getenv('REPORT_FILES_PATH'))
-)
-```
--- a/rmarkdown_report.Rmd	Sun Sep 16 13:28:55 2018 -0400
+++ b/rmarkdown_report.Rmd	Sun Sep 16 17:39:54 2018 -0400
@@ -1,5 +1,5 @@
 ---
-title: 'Aurora Tool Report'
+title: ''
 output:
     html_document:
       highlight: pygments
@@ -53,5 +53,67 @@
 # ADD YOUR DATA ANALYSIS CODE AND MARKUP TEXT BELOW TO EXTEND THIS R MARKDOWN FILE
 ---
 
+#### Significant genes grouped by pfam target name across multiple organisms
+
+---
+
+```{r message=FALSE}
+library(tidyverse)
+library(knitr)
+tblout_files = strsplit(opt$X_p, ',')[[1]]
+common_pfams = read.csv(tblout_files[1])[, 'target_name']
+for (f in tblout_files[-1]) {
+  common_pfams = intersect(common_pfams, read.csv(f)[, 'target_name'])
+}
+
+pfams_df = read.csv(tblout_files[1], stringsAsFactors = FALSE)
+pfams_df = pfams_df[pfams_df$target_name %in% common_pfams, c('target_name', 'accession', 'query_name')]
+pfams_df = pfams_df %>% group_by(target_name) %>%
+  mutate(query_name = paste0(unique(query_name), collapse = ',')) %>%
+  distinct() %>%
+  arrange(target_name)
+first_file_name = tail(strsplit(tblout_files[1], '/')[[1]], 1)
+colnames(pfams_df)[3] = first_file_name
 
 
+for (f in tblout_files[-1]) {
+  df = read.csv(f, stringsAsFactors = FALSE)
+  df = df[df$target_name %in% common_pfams, c('target_name', 'accession', 'query_name')]
+  df = df %>% group_by(target_name) %>%
+    mutate(query_name = paste0(unique(query_name), collapse = ',')) %>%
+    distinct() %>%
+    arrange(target_name)
+  df = df[, c("target_name", "query_name"), drop=FALSE]
+  header = c("target_name", tail(strsplit(f, '/')[[1]], 1))
+  colnames(df) = header
+  pfams_df = merge(pfams_df, df[, header], by = "target_name")
+}
+
+
+
+add_links = function(features) {
+  items = strsplit(features, ',')[[1]]
+  res = tags$ul(
+    lapply(strsplit(items, ','), function(item) {
+      item_adj = gsub('_', '', item)
+      a(paste0(item, ';'), href=paste0('https://www.hardwoodgenomics.org/feature/', item_adj))
+    })
+  )
+  list(res)
+}
+
+
+table_list = list()
+table_list[[1]] = tags$tr(lapply(colnames(pfams_df), tags$th))
+for (i in 1:nrow(pfams_df)) {
+  row = c(pfams_df[i, c('target_name', 'accession')], 
+          lapply(pfams_df[i, -c(1:2)], add_links))
+  table_list[[i+1]] = tags$tr(lapply(row, tags$td))
+}
+tags$table(table_list)
+```
+
+
+
+
+
--- a/rmarkdown_report.sh	Sun Sep 16 13:28:55 2018 -0400
+++ b/rmarkdown_report.sh	Sun Sep 16 17:39:54 2018 -0400
@@ -17,4 +17,6 @@
         
             -o $report
             -d $report.files_path
-            -p $hmmscan_pfam_tblouts
\ No newline at end of file
+            -p $hmmscan_pfam_tblouts
+            
+            
\ No newline at end of file
--- a/rmarkdown_report.xml	Sun Sep 16 13:28:55 2018 -0400
+++ b/rmarkdown_report.xml	Sun Sep 16 17:39:54 2018 -0400
@@ -1,4 +1,4 @@
-<tool name="aurora_tool" id="tool_1" version="1.0.0">
+<tool name="aurora_statonlab_hmmscan_merger" id="aurora_statonlab_hmmscan_merger" version="1.0.0">
   <description>Merge results from the aurora_statonlab_hmmscan tool and group differentially expressed genes across multiple organims by pfam</description>
   <requirements>
         <requirement type="package" version="1.15.0.6-0">pandoc</requirement><requirement type="package" version="1.20.0">r-getopt</requirement><requirement type="package" version="1.6">r-rmarkdown</requirement><requirement type="package" version="1.1.1">r-tidyverse</requirement></requirements>
@@ -21,9 +21,10 @@
         
             -o $report
             -d $report.files_path
-            -p $hmmscan_pfam_tblouts]]></command>
+            -p $hmmscan_pfam_tblouts
+    ]]></command>
   <inputs>
-    <param type="data" name="hmmscan_pfam_tblouts" label="Table outputs from hmmscan" help="Table outputs in CSV format from the &lt;code&gt;aurora_statonlab_hmmscan&lt;/code&gt; tool" optional="False" format="csv" multiple="True"/></inputs>
+    <param type="data" name="hmmscan_pfam_tblouts" label="Table outputs from aurora_statonlab_hmmscan" help="Table outputs in CSV format from the &lt;code&gt;aurora_statonlab_hmmscan&lt;/code&gt; tool" optional="False" format="csv" multiple="True"/></inputs>
   <outputs>
         <data format="html" name="report" label="${tool.name} report on ${on_string}"/></outputs>
   <citations>
--- a/rmarkdown_report_render.R	Sun Sep 16 13:28:55 2018 -0400
+++ b/rmarkdown_report_render.R	Sun Sep 16 17:39:54 2018 -0400
@@ -137,7 +137,7 @@
 ## Outputs
 
 ```{r, echo=FALSE}
-tags$div(id="jstree", file_tree(Sys.getenv(\'REPORT_FILES_PATH\')))
+# tags$div(id="jstree", file_tree(Sys.getenv(\'REPORT_FILES_PATH\')))
 ```'
   write(
     x = jstree_lines,