miga-base 0.2.6.4 → 0.2.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,58 +1,60 @@
1
1
  #!/bin/bash
2
- # Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES
2
+ # Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
3
3
  set -e
4
4
  SCRIPT="trimmed_reads"
5
5
  echo "MiGA: $MIGA"
6
6
  echo "Project: $PROJECT"
7
+ # shellcheck source=scripts/miga.bash
7
8
  source "$MIGA/scripts/miga.bash" || exit 1
8
9
  cd "$PROJECT/data/02.trimmed_reads"
9
10
 
10
11
  b=$DATASET
11
12
 
12
13
  # Initialize
13
- date "+%Y-%m-%d %H:%M:%S %z" > "$DATASET.start"
14
+ miga date > "$DATASET.start"
14
15
 
15
16
  # Unzip (if necessary)
16
- [[ -e ../01.raw_reads/$b.1.fastq.gz && ! -e ../01.raw_reads/$b.1.fastq ]] \
17
- && gunzip ../01.raw_reads/$b.1.fastq.gz
18
- [[ -e ../01.raw_reads/$b.2.fastq.gz && ! -e ../01.raw_reads/$b.2.fastq ]] \
19
- && gunzip ../01.raw_reads/$b.2.fastq.gz
17
+ [[ -e "../01.raw_reads/$b.1.fastq.gz" && ! -e "../01.raw_reads/$b.1.fastq" ]] \
18
+ && gunzip "../01.raw_reads/$b.1.fastq.gz"
19
+ [[ -e "../01.raw_reads/$b.2.fastq.gz" && ! -e "../01.raw_reads/$b.2.fastq" ]] \
20
+ && gunzip "../01.raw_reads/$b.2.fastq.gz"
20
21
 
21
22
  # Clean existing files
22
- exists $b.[12].* && rm $b.[12].*
23
+ exists "$b".[12].* && rm "$b".[12].*
23
24
 
24
25
  # Tag
25
- FastQ.tag.rb -i ../01.raw_reads/$b.1.fastq -p "$b-" -s "/1" -o $b.1.fastq
26
- [[ -e ../01.raw_reads/$b.2.fastq ]] \
27
- && FastQ.tag.rb -i ../01.raw_reads/$b.2.fastq -p "$b-" -s "/2" -o $b.2.fastq
26
+ FastQ.tag.rb -i "../01.raw_reads/$b.1.fastq" -p "$b-" -s "/1" -o "$b.1.fastq"
27
+ [[ -e "../01.raw_reads/$b.2.fastq" ]] \
28
+ && FastQ.tag.rb -i "../01.raw_reads/$b.2.fastq" -p "$b-" -s "/2" \
29
+ -o "$b.2.fastq"
28
30
 
29
31
  # Trim
30
- SolexaQA++ dynamictrim $b.[12].fastq -h 20 -d .
31
- SolexaQA++ lengthsort $b.[12].fastq.trimmed -l 50 -d .
32
+ SolexaQA++ dynamictrim "$b".[12].fastq -h 20 -d .
33
+ SolexaQA++ lengthsort "$b".[12].fastq.trimmed -l 50 -d .
32
34
 
33
35
  # Clean adapters
34
- if [[ -e $b.2.fastq.trimmed.paired ]] ; then
35
- scythe -a $MIGA/utils/adapters.fa $b.1.fastq.trimmed.paired \
36
- > $b.1.clipped.all.fastq
37
- scythe -a $MIGA/utils/adapters.fa $b.2.fastq.trimmed.paired \
38
- > $b.2.clipped.all.fastq
39
- SolexaQA++ lengthsort $b.[12].clipped.all.fastq -l 50 -d .
40
- rm $b.[12].clipped.all.fastq
41
- [[ -e $b.1.clipped.all.fastq.single ]] \
42
- && mv $b.1.clipped.all.fastq.single $b.1.clipped.single.fastq
43
- [[ -e $b.2.clipped.all.fastq.single ]] \
44
- && mv $b.2.clipped.all.fastq.single $b.2.clipped.single.fastq
45
- mv $b.1.clipped.all.fastq.paired $b.1.clipped.fastq
46
- mv $b.2.clipped.all.fastq.paired $b.2.clipped.fastq
47
- rm $b.1.clipped.all.fastq.summary.txt &>/dev/null
36
+ if [[ -e "$b.2.fastq.trimmed.paired" ]] ; then
37
+ scythe -a "$MIGA/utils/adapters.fa" "$b.1.fastq.trimmed.paired" \
38
+ > "$b.1.clipped.all.fastq"
39
+ scythe -a "$MIGA/utils/adapters.fa" "$b.2.fastq.trimmed.paired" \
40
+ > "$b.2.clipped.all.fastq"
41
+ SolexaQA++ lengthsort "$b".[12].clipped.all.fastq -l 50 -d .
42
+ rm "$b".[12].clipped.all.fastq
43
+ [[ -e "$b".1.clipped.all.fastq.single ]] \
44
+ && mv "$b.1.clipped.all.fastq.single" "$b.1.clipped.single.fastq"
45
+ [[ -e "$b".2.clipped.all.fastq.single ]] \
46
+ && mv "$b.2.clipped.all.fastq.single" "$b.2.clipped.single.fastq"
47
+ mv "$b.1.clipped.all.fastq.paired" "$b.1.clipped.fastq"
48
+ mv "$b.2.clipped.all.fastq.paired" "$b.2.clipped.fastq"
49
+ rm -f "$b.1.clipped.all.fastq.summary.txt"
48
50
  else
49
- scythe -a $MIGA/utils/adapters.fa $b.1.fastq.trimmed.single \
50
- > $b.1.clipped.all.fastq
51
- SolexaQA++ lengthsort $b.1.clipped.all.fastq -l 50 -d .
52
- mv $b.1.clipped.all.fastq.single $b.1.clipped.fastq
51
+ scythe -a "$MIGA/utils/adapters.fa" "$b.1.fastq.trimmed.single" \
52
+ > "$b.1.clipped.all.fastq"
53
+ SolexaQA++ lengthsort "$b.1.clipped.all.fastq" -l 50 -d .
54
+ mv "$b.1.clipped.all.fastq.single" "$b.1.clipped.fastq"
53
55
  fi
54
- rm $b.[12].*.discard &>/dev/null
56
+ rm -f "$b".[12].*.discard
55
57
 
56
58
  # Finalize
57
- date "+%Y-%m-%d %H:%M:%S %z" > "$DATASET.done"
59
+ miga date > "$DATASET.done"
58
60
  miga add_result -P "$PROJECT" -D "$DATASET" -r "$SCRIPT"
@@ -11,18 +11,18 @@ db = SQLite3::Database.new(ARGV[1])
11
11
  db.execute "create table metadata(" +
12
12
  "`name` varchar(256), `field` varchar(256), `value` text)"
13
13
 
14
- def searchable(db, k, v)
14
+ def searchable(db, d, k, v)
15
15
  db.execute "insert into metadata values(?,?,?)",
16
- k.to_s, " #{v.to_s.downcase.gsub(/[^A-Za-z0-9\-]+/, " ")} "
16
+ d.name, k.to_s, " #{v.to_s.downcase.gsub(/[^A-Za-z0-9\-]+/, " ")} "
17
17
  end
18
18
 
19
19
  p.each_dataset do |name, d|
20
20
  next unless d.is_ref?
21
- searchable(db, :name, d.name)
21
+ searchable(db, d, :name, d.name)
22
22
  d.metadata.each do |k, v|
23
23
  next if [:created, :updated].include? k
24
24
  v = v.sorted_ranks.map{ |r| r[1] }.join(" ") if k==:tax
25
- searchable(db, k, v)
25
+ searchable(db, d, k, v)
26
26
  end
27
27
  end
28
28
 
data/utils/ref-tree.R ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env Rscript
2
+ #
3
+ # @package MiGA
4
+ # @license Artistic-2.0
5
+ #
6
+
7
+ #= Load stuff
8
+ argv <- commandArgs(trailingOnly=T)
9
+ suppressPackageStartupMessages(library(ape))
10
+ suppressPackageStartupMessages(library(phytools))
11
+ suppressPackageStartupMessages(library(phangorn))
12
+ suppressPackageStartupMessages(library(enveomics.R))
13
+
14
+ #= Main function
15
+ ref_tree <- function(ani_file, out_base, q_dataset) {
16
+ a <- read.table(ani_file, sep="\t", header=TRUE, as.is=TRUE)
17
+ ani.d <- enve.df2dist(a[,1:3], default.d=0.9, max.sim=100)
18
+ ani.ph <- midpoint(bionj(ani.d))
19
+ write.tree(ani.ph, paste(out_base, ".nwk", sep=""))
20
+ pdf(paste(out_base, ".nwk.pdf", sep=""), 7, 7)
21
+ plot(ani.ph, cex=1/3, type='fan',
22
+ tip.color=c('red', 'black')[ifelse(ani.ph$tip.label==q_dataset, 1, 2)])
23
+ add.scale.bar()
24
+ dev.off()
25
+ }
26
+
27
+ # Ancilliary functions
28
+ midpoint <- function(tree){
29
+ dm = cophenetic(tree)
30
+ tree = unroot(tree)
31
+ rn = max(tree$edge)+1
32
+ maxdm = max(dm)
33
+ ind = which(dm==maxdm,arr=TRUE)[1,]
34
+ tmproot = Ancestors(tree, ind[1], "parent")
35
+ tree = phangorn:::reroot(tree, tmproot)
36
+ edge = tree$edge
37
+ el = tree$edge.length
38
+ children = tree$edge[,2]
39
+ left = match(ind[1], children)
40
+ tmp = Ancestors(tree, ind[2], "all")
41
+ tmp= c(ind[2], tmp[-length(tmp)])
42
+ right = match(tmp, children)
43
+ if(el[left]>= (maxdm/2)){
44
+ edge = rbind(edge, c(rn, ind[1]))
45
+ edge[left,2] = rn
46
+ el[left] = el[left] - (maxdm/2)
47
+ el = c(el, maxdm/2)
48
+ }else{
49
+ sel = cumsum(el[right])
50
+ i = which(sel>(maxdm/2))[1]
51
+ edge = rbind(edge, c(rn, tmp[i]))
52
+ edge[right[i],2] = rn
53
+ eltmp = sel[i] - (maxdm/2)
54
+ el = c(el, el[right[i]] - eltmp)
55
+ el[right[i]] = eltmp
56
+ }
57
+ tree$edge.length = el
58
+ tree$edge=edge
59
+ tree$Nnode = tree$Nnode+1
60
+ phangorn:::reorderPruning(phangorn:::reroot(tree, rn))
61
+ }
62
+
63
+ #= Main
64
+ ref_tree(ani_file=argv[1], out_base=argv[2], q_dataset=argv[3])
65
+
@@ -5,7 +5,7 @@ SolexaQA++ SolexaQA++ http://solexaqa.sourceforge.net Required version: v3
5
5
  Scythe scythe https://github.com/vsbuffalo/scythe Required version: 0.991+
6
6
  FastQC fastqc http://www.bioinformatics.babraham.ac.uk/projects/fastqc
7
7
  IDBA idba_ud http://i.cs.hku.hk/~alse/hkubrg/projects/idba
8
- MetaGeneMark gmhmmp http://exon.gatech.edu/genemark/license_download.cgi The folder must contain the key and the scripts
8
+ Prodigal prodigal http://prodigal.ornl.gov
9
9
  HMMer 3.0+ hmmsearch http://hmmer.janelia.org/software
10
10
  NCBI BLAST+ blastp ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST
11
11
  R R http://www.r-project.org/
metadata CHANGED
@@ -1,103 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.4
4
+ version: 0.2.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-15 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: daemons
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.2'
34
- - - '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.2.4
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ~>
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.2'
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.2.4
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: json
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ~>
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.8'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ~>
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.8'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: sqlite3
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.3'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.3'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '11'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ~>
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '11'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: test-unit
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ~>
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '3'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ~>
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '3'
103
103
  description: Microbial Genomes Atlas
@@ -108,6 +108,32 @@ extensions: []
108
108
  extra_rdoc_files:
109
109
  - README.md
110
110
  files:
111
+ - Gemfile
112
+ - LICENSE
113
+ - README.md
114
+ - Rakefile
115
+ - actions/add_result.rb
116
+ - actions/add_taxonomy.rb
117
+ - actions/create_dataset.rb
118
+ - actions/create_project.rb
119
+ - actions/daemon.rb
120
+ - actions/date.rb
121
+ - actions/download_dataset.rb
122
+ - actions/find_datasets.rb
123
+ - actions/import_datasets.rb
124
+ - actions/index_taxonomy.rb
125
+ - actions/list_datasets.rb
126
+ - actions/list_files.rb
127
+ - actions/plugins.rb
128
+ - actions/project_info.rb
129
+ - actions/result_stats.rb
130
+ - actions/run_local.rb
131
+ - actions/tax_distributions.rb
132
+ - actions/unlink_dataset.rb
133
+ - bin/miga
134
+ - lib/miga.rb
135
+ - lib/miga/_data/aai-intax.tsv.gz
136
+ - lib/miga/_data/aai-novel.tsv.gz
111
137
  - lib/miga/common.rb
112
138
  - lib/miga/daemon.rb
113
139
  - lib/miga/dataset.rb
@@ -121,18 +147,6 @@ files:
121
147
  - lib/miga/tax_index.rb
122
148
  - lib/miga/taxonomy.rb
123
149
  - lib/miga/version.rb
124
- - lib/miga.rb
125
- - test/common_test.rb
126
- - test/daemon_test.rb
127
- - test/dataset_test.rb
128
- - test/metadata_test.rb
129
- - test/project_test.rb
130
- - test/remote_dataset_test.rb
131
- - test/tax_index_test.rb
132
- - test/taxonomy_test.rb
133
- - test/test_helper.rb
134
- - lib/miga/_data/aai-intax.tsv.gz
135
- - lib/miga/_data/aai-novel.tsv.gz
136
150
  - scripts/_distances_functions.bash
137
151
  - scripts/_distances_noref_nomulti.bash
138
152
  - scripts/_distances_ref_nomulti.bash
@@ -156,38 +170,25 @@ files:
156
170
  - scripts/subclades.bash
157
171
  - scripts/trimmed_fasta.bash
158
172
  - scripts/trimmed_reads.bash
173
+ - test/common_test.rb
174
+ - test/daemon_test.rb
175
+ - test/dataset_test.rb
176
+ - test/metadata_test.rb
177
+ - test/project_test.rb
178
+ - test/remote_dataset_test.rb
179
+ - test/tax_index_test.rb
180
+ - test/taxonomy_test.rb
181
+ - test/test_helper.rb
159
182
  - utils/adapters.fa
160
183
  - utils/index_metadata.rb
161
184
  - utils/mytaxa_scan.R
162
185
  - utils/mytaxa_scan.rb
163
186
  - utils/plot-taxdist.R
187
+ - utils/ref-tree.R
164
188
  - utils/requirements.txt
165
189
  - utils/subclades-compile.rb
166
190
  - utils/subclades-nj.R
167
191
  - utils/subclades.R
168
- - bin/miga
169
- - actions/add_result.rb
170
- - actions/add_taxonomy.rb
171
- - actions/create_dataset.rb
172
- - actions/create_project.rb
173
- - actions/daemon.rb
174
- - actions/date.rb
175
- - actions/download_dataset.rb
176
- - actions/find_datasets.rb
177
- - actions/import_datasets.rb
178
- - actions/index_taxonomy.rb
179
- - actions/list_datasets.rb
180
- - actions/list_files.rb
181
- - actions/plugins.rb
182
- - actions/project_info.rb
183
- - actions/result_stats.rb
184
- - actions/run_local.rb
185
- - actions/tax_distributions.rb
186
- - actions/unlink_dataset.rb
187
- - Gemfile
188
- - Rakefile
189
- - README.md
190
- - LICENSE
191
192
  homepage: http://enve-omics.ce.gatech.edu/miga
192
193
  licenses:
193
194
  - Artistic-2.0
@@ -196,25 +197,25 @@ post_install_message:
196
197
  rdoc_options:
197
198
  - lib
198
199
  - README.md
199
- - --main
200
+ - "--main"
200
201
  - README.md
201
- - --title
202
+ - "--title"
202
203
  - MiGA
203
204
  require_paths:
204
205
  - lib
205
206
  required_ruby_version: !ruby/object:Gem::Requirement
206
207
  requirements:
207
- - - '>='
208
+ - - ">="
208
209
  - !ruby/object:Gem::Version
209
210
  version: '1.9'
210
211
  required_rubygems_version: !ruby/object:Gem::Requirement
211
212
  requirements:
212
- - - '>='
213
+ - - ">="
213
214
  - !ruby/object:Gem::Version
214
215
  version: '0'
215
216
  requirements: []
216
217
  rubyforge_project:
217
- rubygems_version: 2.0.14
218
+ rubygems_version: 2.6.8
218
219
  signing_key:
219
220
  specification_version: 4
220
221
  summary: MiGA