Mercurial > repos > mingchen0919 > split_multifasta
diff split_fasta.Rmd @ 0:efd5c022b54d draft
planemo upload
| author | mingchen0919 |
|---|---|
| date | Mon, 09 Apr 2018 12:27:49 -0400 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/split_fasta.Rmd Mon Apr 09 12:27:49 2018 -0400 @@ -0,0 +1,47 @@ +--- +title: 'FASTA splitter' +output: + html_document: + highlight: pygments +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set(echo = TRUE, error = TRUE) +``` + + +```{bash} +# build job-script +mkdir -p ${WORKING_DIR}/fasta_files + +# single-end.sh +cat <<EOF >${X_d}/job-script.sh +${X_t}/split_multifasta.pl \\ + --input_file=${X_A} \\ + --seqs_per_file=${X_B} \\ + --output_dir=${WORKING_DIR}/fasta_files > ${X_d}/fasta_splitter-log.txt 2>&1 +EOF +``` + +```{bash, 'run jobs', echo=FALSE} +# run job script, always use absolute path. +# we want to run all jobs within the working path. +sh ${X_d}/job-script.sh +``` + +```{r, 'display output directory contents', results='asis', echo=FALSE} +## after the job is done, we list all files from the output directory. +## full relative path to the output directory needs to be displayed. + +cat('##All output files') +cat('\n\n') +all_files = list.files(path = opt$X_d, + full.names = TRUE, + recursive = TRUE) + +for (f in sub(opt$X_d, '.', all_files) ) { + cat('* [', f, '](', f, ')\n') +} +cat('\n') +``` +
