diff bdss_client_sra.Rmd @ 23:fd15cf620d5d draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
author mingchen0919
date Sun, 15 Oct 2017 00:50:10 -0400
parents 89cc5b026494
children a1c0ebd05f2f
line wrap: on
line diff
--- a/bdss_client_sra.Rmd	Sat Oct 14 22:59:06 2017 -0400
+++ b/bdss_client_sra.Rmd	Sun Oct 15 00:50:10 2017 -0400
@@ -46,7 +46,7 @@
                  substr(id, 1, 3), '/',
                  substr(id, 1, 6), '/', id, '/', id, '.sra')
     # download sra file with bdss
-    bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url)
+    bdss_command = paste0('/main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
     system(bdss_command, intern = TRUE)
     # convert .sra to .fastq/.fasta
     if('FORMAT' == 'fasta') {
@@ -68,7 +68,7 @@
                  substr(id, 1, 3), '/',
                  substr(id, 1, 6), '/', id, '/', id, '.sra')
     # download sra file with bdss
-    bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url)
+    bdss_command = paste0('/main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
     system(bdss_command, intern = TRUE)
     # convert .sra to .fastq/.fasta
     if('FORMAT' == 'fasta') {
@@ -79,9 +79,9 @@
     cat('----convert SRA to fastq/fasta------\n')
     command_stdout = system(command, intern = TRUE)
     print(command_stdout)
-    if(length(command_stdout) < 3) {
+    if(!(paste0(id, '_2.FORMAT') %in% list.files('pe_read_files_directory'))) {
       # this is not a paired end SRA file. The corresponding file will be deleted.
-      cat(paste0(id, 'is not paired end SRA, the corresponding fastq/fasta file will deleted.'))
+      cat(paste0(id, ' is not paired end SRA, the corresponding fastq/fasta file will deleted.'))
       system(paste0('rm pe_read_files_directory/', id, '_1.*'), intern = TRUE)
     }
     
@@ -95,8 +95,10 @@
 cat('-----Renaming files------\n')
 # rename files for paired end reads
 old_files = paste0('./pe_read_files_directory/', list.files('./pe_read_files_directory'))
+print(old_files)
 new_files = gsub('_1', '_forward', old_files)
 new_files = gsub('_2', '_reverse', new_files)
+print(new_files)
 file.rename(old_files, new_files)
 ```