comparison split_fasta.Rmd @ 0:efd5c022b54d draft

planemo upload
author mingchen0919
date Mon, 09 Apr 2018 12:27:49 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:efd5c022b54d
1 ---
2 title: 'FASTA splitter'
3 output:
4 html_document:
5 highlight: pygments
6 ---
7
8 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
9 knitr::opts_chunk$set(echo = TRUE, error = TRUE)
10 ```
11
12
13 ```{bash}
14 # build job-script
15 mkdir -p ${WORKING_DIR}/fasta_files
16
17 # single-end.sh
18 cat <<EOF >${X_d}/job-script.sh
19 ${X_t}/split_multifasta.pl \\
20 --input_file=${X_A} \\
21 --seqs_per_file=${X_B} \\
22 --output_dir=${WORKING_DIR}/fasta_files > ${X_d}/fasta_splitter-log.txt 2>&1
23 EOF
24 ```
25
26 ```{bash, 'run jobs', echo=FALSE}
27 # run job script, always use absolute path.
28 # we want to run all jobs within the working path.
29 sh ${X_d}/job-script.sh
30 ```
31
32 ```{r, 'display output directory contents', results='asis', echo=FALSE}
33 ## after the job is done, we list all files from the output directory.
34 ## full relative path to the output directory needs to be displayed.
35
36 cat('##All output files')
37 cat('\n\n')
38 all_files = list.files(path = opt$X_d,
39 full.names = TRUE,
40 recursive = TRUE)
41
42 for (f in sub(opt$X_d, '.', all_files) ) {
43 cat('* [', f, '](', f, ')\n')
44 }
45 cat('\n')
46 ```
47