# HG changeset patch # User mingchen0919 # Date 1520430713 18000 # Node ID 9be3a8754fb3c62dfa84d733344d3531dee18a9f # Parent 0bfeaf18a871a21209b8ee096719b96d67051b39 initial diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count.Rmd --- a/htseq_count.Rmd Wed Mar 07 08:45:02 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ ---- -title: 'htseq-count analysis' -output: html_document ---- - -```{r setup, include=FALSE, warning=FALSE, message=FALSE} -knitr::opts_chunk$set( - echo = as.logical(opt$X_e), - error = TRUE -) -``` - - -## Run htseq-count - -```{bash} -cd ${X_d} - -cat >htseq-count.sh < counts.txt - - grep -v '__no_feature\|__ambiguous\|__too_low_aQual\|__not_aligned\|__alignment_not_unique' counts.txt > ${X_c} -EOF -``` - - -```{r} -# display htseq-count job script -htseq_count_sh = paste0(opt$X_d, '/htseq-count.sh') -tags$code(tags$pre(readChar(htseq_count_sh, file.info(htseq_count_sh)$size ))) -``` - -```{bash} -cd ${X_d} -sh htseq-count.sh -``` - -## Counts - -```{r} -count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1) -sample_names = trimws(strsplit(opt$X_B, ',')[[1]]) -colnames(count_data) = rep(sample_names, length = ncol(count_data)) -DT::datatable(count_data, caption = "htseq counts for each sample") -``` - -```{r} -# save count data as an R object -save(count_data, file = paste0(opt$X_d, '/counts.RData')) -``` - -```{bash} -cp ${X_d}/counts.RData ${X_O} -``` - - diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count.sh --- a/htseq_count.sh Wed Mar 07 08:45:02 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -Rscript '${__tool_directory__}/htseq_count_render.R' - - -e $echo - -o $report - -d $report.files_path - -s $sink_message - -t '${__tool_directory__}' - - -A '$alignment_files' - -B '$sample_names' - -G $gff - -f $format - -r $order - -S $stranded - -a $minaqual - -T $feature_type - -i $idattr - -m $mode - -c $count - -O $count_rdata \ No newline at end of file diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count.xml --- a/htseq_count.xml Wed Mar 07 08:45:02 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ - - Counting reads in features. - - pandoc - r-getopt - r-rmarkdown - htseq - r-dt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_index.Rmd --- a/htseq_count_index.Rmd Wed Mar 07 08:45:02 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ ---- -title: "htseq-count Report" -output: html_document ---- - -```{r setup, include=FALSE, warning=FALSE, message=FALSE} -knitr::opts_chunk$set(echo = TRUE, error = TRUE) -``` - -## References - -Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff and Wickham, Hadley and Atkins, Aron and Hyndman, Rob (2016). rmarkdown: Dynamic Documents for R, 2016. In R package version 0.9, 6. - -Xie, Yihui (2015). Dynamic Documents with R and knitr, CRC Press, Vol.29. - -Anders, Simon and Pyl, Paul Theodor and Huber, Wolfgang (2015). HTSeq—a Python framework to work with high-throughput sequencing data. In Bioinformatics, 31 (2), pp. 166--169. \ No newline at end of file diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_render.R --- a/htseq_count_render.R Wed Mar 07 08:45:02 2018 -0500 +++ b/htseq_count_render.R Wed Mar 07 08:51:53 2018 -0500 @@ -10,6 +10,7 @@ library(getopt) library(rmarkdown) +library(htmltools) #------------------------------------------------ @@ -58,9 +59,9 @@ #-----------------render site-------------- # copy site generating materials into OUTPUT_DIR dir.create(paste0(OUTPUT_DIR, '/site_generator'), recursive = TRUE) -system(paste0('cp -r ', TOOL_DIR, '/htseq_count.Rmd ', OUTPUT_DIR, '/site_generator/htseq_count.Rmdd')) +system(paste0('cp -r ', TOOL_DIR, '/htseq_count_site.Rmd ', OUTPUT_DIR, '/site_generator/htseq_count_site.Rmd')) system(paste0('cp -r ', TOOL_DIR, '/htseq_count_site.yml ', OUTPUT_DIR, '/site_generator/_site.yml')) -system(paste0('cp -r ', TOOL_DIR, '/htseq_count_index.Rmd ', OUTPUT_DIR, '/site_generator/index.Rmd')) +system(paste0('cp -r ', TOOL_DIR, '/htseq_count_site_index.Rmd ', OUTPUT_DIR, '/site_generator/index.Rmd')) # render site to OUTPUT_DIR/_site, this is configured in the "_site.yml" file render_site(input = paste0(OUTPUT_DIR, '/site_generator')) # remove site generating materials from output associated directory diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_site.Rmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htseq_count_site.Rmd Wed Mar 07 08:51:53 2018 -0500 @@ -0,0 +1,65 @@ +--- +title: 'htseq-count analysis' +output: html_document +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = as.logical(opt$X_e), + error = TRUE +) +``` + + +## Run htseq-count + +```{bash} +cd ${X_d} + +cat >htseq-count.sh < counts.txt + + grep -v '__no_feature\|__ambiguous\|__too_low_aQual\|__not_aligned\|__alignment_not_unique' counts.txt > ${X_c} +EOF +``` + + +```{r} +# display htseq-count job script +htseq_count_sh = paste0(opt$X_d, '/htseq-count.sh') +tags$code(tags$pre(readChar(htseq_count_sh, file.info(htseq_count_sh)$size ))) +``` + +```{bash} +cd ${X_d} +sh htseq-count.sh +``` + +## Counts + +```{r} +count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1) +sample_names = trimws(strsplit(opt$X_B, ',')[[1]]) +colnames(count_data) = rep(sample_names, length = ncol(count_data)) +DT::datatable(count_data, caption = "htseq counts for each sample") +``` + +```{r} +# save count data as an R object +save(count_data, file = paste0(opt$X_d, '/counts.RData')) +``` + +```{bash} +cp ${X_d}/counts.RData ${X_O} +``` + + diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_site.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htseq_count_site.sh Wed Mar 07 08:51:53 2018 -0500 @@ -0,0 +1,20 @@ +Rscript '${__tool_directory__}/htseq_count_render.R' + + -e $echo + -o $report + -d $report.files_path + -s $sink_message + -t '${__tool_directory__}' + + -A '$alignment_files' + -B '$sample_names' + -G $gff + -f $format + -r $order + -S $stranded + -a $minaqual + -T $feature_type + -i $idattr + -m $mode + -c $count + -O $count_rdata \ No newline at end of file diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_site.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htseq_count_site.xml Wed Mar 07 08:51:53 2018 -0500 @@ -0,0 +1,112 @@ + + Counting reads in features. + + pandoc + r-getopt + r-rmarkdown + htseq + r-dt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 0bfeaf18a871 -r 9be3a8754fb3 htseq_count_site_index.Rmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/htseq_count_site_index.Rmd Wed Mar 07 08:51:53 2018 -0500 @@ -0,0 +1,16 @@ +--- +title: "htseq-count Report" +output: html_document +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set(echo = TRUE, error = TRUE) +``` + +## References + +Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff and Wickham, Hadley and Atkins, Aron and Hyndman, Rob (2016). rmarkdown: Dynamic Documents for R, 2016. In R package version 0.9, 6. + +Xie, Yihui (2015). Dynamic Documents with R and knitr, CRC Press, Vol.29. + +Anders, Simon and Pyl, Paul Theodor and Huber, Wolfgang (2015). HTSeq—a Python framework to work with high-throughput sequencing data. In Bioinformatics, 31 (2), pp. 166--169. \ No newline at end of file