|
0
|
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
|
|
1
|
18 cat <<EOF >${X_d}/job-script.sh
|
|
|
19 cd ${WORKING_DIR}/fasta_files && ${X_t}/split.pl \\
|
|
|
20 --input_file=${X_A} \\
|
|
|
21 --seqs_per_file=${X_B} \\ > ${X_d}/fasta_splitter-log.txt 2>&1
|
|
0
|
22 EOF
|
|
|
23 ```
|
|
|
24
|
|
|
25 ```{bash, 'run jobs', echo=FALSE}
|
|
|
26 # run job script, always use absolute path.
|
|
|
27 # we want to run all jobs within the working path.
|
|
1
|
28 sh ${X_d}/job-script.sh
|
|
0
|
29 ```
|
|
|
30
|
|
|
31 ```{r, 'display output directory contents', results='asis', echo=FALSE}
|
|
|
32 ## after the job is done, we list all files from the output directory.
|
|
|
33 ## full relative path to the output directory needs to be displayed.
|
|
|
34
|
|
|
35 cat('##All output files')
|
|
|
36 cat('\n\n')
|
|
1
|
37 all_files = list.files(path = opt$X_d,
|
|
0
|
38 full.names = TRUE,
|
|
|
39 recursive = TRUE)
|
|
|
40
|
|
1
|
41 for (f in sub(opt$X_d, '.', all_files) ) {
|
|
0
|
42 cat('* [', f, '](', f, ')\n')
|
|
|
43 }
|
|
|
44 cat('\n')
|
|
|
45 ```
|
|
|
46
|