comparison bdss_client_sra_se.Rmd @ 15:fe5f30584308 draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
author mingchen0919
date Wed, 11 Oct 2017 14:50:19 -0400
parents efb1938c3020
children c2150a0f9c7c
comparison
equal deleted inserted replaced
14:c0b8476fbc85 15:fe5f30584308
44 # build URL from SRA accession 44 # build URL from SRA accession
45 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/', 45 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/',
46 substr(id, 1, 3), '/', 46 substr(id, 1, 3), '/',
47 substr(id, 1, 6), '/', id, '/', id, '.sra') 47 substr(id, 1, 6), '/', id, '/', id, '.sra')
48 # download sra file with bdss 48 # download sra file with bdss
49 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) 49 bdss_command = paste0(' /main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
50 system(bdss_command, intern = TRUE) 50 system(bdss_command, intern = TRUE)
51 # convert .sra to .fastq/.fasta 51 # convert .sra to .fastq/.fasta
52 if('FORMAT' == 'fasta') { 52 if('FORMAT' == 'fasta') {
53 command = paste0('fastq-dump --fasta ', '-O read_files_directory ', id) 53 command = paste0('fastq-dump --fasta ', '-O read_files_directory ', id)
54 } else { 54 } else {
62 # list all fastq files 62 # list all fastq files
63 all_fastq_files = strsplit(getURL(url_base, dirlistonly = TRUE), split = '\n')[[1]] 63 all_fastq_files = strsplit(getURL(url_base, dirlistonly = TRUE), split = '\n')[[1]]
64 if (length(all_fastq_files) == 1) { 64 if (length(all_fastq_files) == 1) {
65 # this is a single end SRA file. build url to download fastq 65 # this is a single end SRA file. build url to download fastq
66 url = paste0(url_base, '/', all_fastq_files) 66 url = paste0(url_base, '/', all_fastq_files)
67 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) 67 bdss_command = paste0(' /main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
68 run_bdss = system(bdss_command, intern = TRUE) 68 run_bdss = system(bdss_command, intern = TRUE)
69 print(run_bdss) 69 print(run_bdss)
70 } else { 70 } else {
71 print(paste0('Two fastq files found for this SRA accession: ', id)) 71 print(paste0('Two fastq files found for this SRA accession: ', id))
72 print('Downloading skipped for ', id) 72 print('Downloading skipped for ', id)
73 # url_1 = paste0(url_base, '/', all_fastq_files[1]) 73 # url_1 = paste0(url_base, '/', all_fastq_files[1])
74 # bdss_command_1 = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url_1) 74 # bdss_command_1 = paste0(' /main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url_1)
75 # run_bdss_1 = system(bdss_command, intern = TRUE) 75 # run_bdss_1 = system(bdss_command, intern = TRUE)
76 # url_2 = paste0(url_base, '/', all_fastq_files[1]) 76 # url_2 = paste0(url_base, '/', all_fastq_files[1])
77 # bdss_command_2 = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url_2) 77 # bdss_command_2 = paste0(' /main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url_2)
78 # run_bdss_2 = system(bdss_command, intern = TRUE) 78 # run_bdss_2 = system(bdss_command, intern = TRUE)
79 } 79 }
80 } 80 }
81 81
82 } 82 }