Mercurial > repos > mingchen0919 > rmarkdown_bdss_client
annotate bdss_client_sra.Rmd @ 0:512d008295db draft default tip
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
author | mingchen0919 |
---|---|
date | Tue, 17 Oct 2017 14:09:01 -0400 |
parents | |
children |
rev | line source |
---|---|
0
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
2 title: 'Download and extract single end fastq/fasta data with BDSS client from SRA accessions' |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
3 output: |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
4 html_document: |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
5 number_sections: true |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
6 toc: true |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
7 theme: cosmo |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
8 highlight: tango |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
10 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
12 knitr::opts_chunk$set( |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
13 echo = ECHO, |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
14 error=TRUE |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
15 ) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
16 ``` |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
17 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
18 # Command line arguments |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
19 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
20 ```{r 'command line arguments'} |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
21 str(opt) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
22 ``` |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
23 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
24 # BDSS configuration file |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
25 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
26 First, we create a bdss configuration file `bdss.cfg` in the current directory. |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
27 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
28 ```{r} |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
29 system('echo "[metadata_repository]" > bdss.cfg') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
30 system('echo url=http://bdss.bioinfo.wsu.edu/ >> bdss.cfg') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
31 ``` |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
32 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
33 # Download and extract reads |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
34 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
35 ```{r 'download and extract reads'} |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
36 # create two directories, one for single end and the other for paired end SRA reads. |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
37 dir.create('se_read_files_directory') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
38 dir.create('pe_read_files_directory') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
39 # download and extract reads (single end) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
40 sra_ids_se = strsplit(gsub(',', ' ', 'SRA_IDS_SE'), ' ')[[1]] |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
41 sra_ids_se = sra_ids_se[sra_ids_se != ''] |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
42 # loop through SRA accessions to download and extract reads. |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
43 for(id in sra_ids_se) { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
44 # build URL from SRA id |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
45 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/', |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
46 substr(id, 1, 3), '/', |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
47 substr(id, 1, 6), '/', id, '/', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
48 # download sra file with bdss |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
49 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
50 system(bdss_command, intern = TRUE) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
51 # convert .sra to .fastq/.fasta |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
52 if('FORMAT' == 'fasta') { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
53 command = paste0('fastq-dump --fasta -O se_read_files_directory ', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
54 } else { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
55 command = paste0('fastq-dump -O se_read_files_directory ', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
56 } |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
57 cat('----convert SRA to fastq/fasta------\n') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
58 print(system(command, intern = TRUE)) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
59 } |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
60 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
61 # download and extract reads (paired end) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
62 sra_ids_pe = strsplit(gsub(',', ' ', 'SRA_IDS_PE'), ' ')[[1]] |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
63 sra_ids_pe = sra_ids_pe[sra_ids_pe != ''] |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
64 # loop through SRA accessions to download and extract reads. |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
65 for(id in sra_ids_pe) { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
66 # build URL from SRA id |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
67 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/', |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
68 substr(id, 1, 3), '/', |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
69 substr(id, 1, 6), '/', id, '/', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
70 # download sra file with bdss |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
71 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
72 system(bdss_command, intern = TRUE) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
73 # convert .sra to .fastq/.fasta |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
74 if('FORMAT' == 'fasta') { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
75 command = paste0('fastq-dump --fasta --split-files -O pe_read_files_directory ', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
76 } else { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
77 command = paste0('fastq-dump --split-files -O pe_read_files_directory ', id, '.sra') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
78 } |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
79 cat('----convert SRA to fastq/fasta------\n') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
80 command_stdout = system(command, intern = TRUE) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
81 print(command_stdout) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
82 if(!(paste0(id, '_2.FORMAT') %in% list.files('pe_read_files_directory'))) { |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
83 # this is not a paired end SRA file. The corresponding file will be deleted. |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
84 cat(paste0(id, ' is not paired end SRA, the corresponding fastq/fasta file will deleted.')) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
85 system(paste0('rm pe_read_files_directory/', id, '_1.*'), intern = TRUE) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
86 } |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
87 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
88 } |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
89 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
90 cat('-----single end files----\n') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
91 list.files('./se_read_files_directory') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
92 cat('-----paired end files----\n') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
93 list.files('./pe_read_files_directory') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
94 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
95 cat('-----Renaming files------\n') |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
96 # rename files for paired end reads |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
97 old_files = paste0('./pe_read_files_directory/', list.files('./pe_read_files_directory')) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
98 print(old_files) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
99 new_files = gsub('_1', '_forward', old_files) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
100 new_files = gsub('_2', '_reverse', new_files) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
101 print(new_files) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
102 file.rename(old_files, new_files) |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
103 ``` |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
104 |
512d008295db
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
mingchen0919
parents:
diff
changeset
|
105 |