viral_seq 1.7.1 → 1.8.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,86 +1,173 @@
1
1
  module ViralSeq
2
2
 
3
- class TcsDr
4
- PARAMS = {:platform_error_rate=>0.02,
5
- :primer_pairs=>
6
- [{:region=>"RT",
7
- :cdna=>
8
- "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCACTATAGGCTGTACTGTCCATTTATC",
9
- :forward=>
10
- "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGGCCATTGACAGAAGAAAAAATAAAAGC",
11
- :majority=>0,
12
- :end_join=>true,
13
- :end_join_option=>1,
14
- :overlap=>0,
15
- :TCS_QC=>true,
16
- :ref_genome=>"HXB2",
17
- :ref_start=>2648,
18
- :ref_end=>3257,
19
- :indel=>true,
20
- :trim=>false},
21
- {:region=>"PR",
22
- :cdna=>
23
- "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNCAGTTTAACTTTTGGGCCATCCATTCC",
24
- :forward=>
25
- "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTCAGAGCAGACCAGAGCCAACAGCCCCA",
26
- :majority=>0,
27
- :end_join=>true,
28
- :end_join_option=>3,
29
- :TCS_QC=>true,
30
- :ref_genome=>"HXB2",
31
- :ref_start=>0,
32
- :ref_end=>2591,
33
- :indel=>true,
34
- :trim=>true,
35
- :trim_ref=>"HXB2",
36
- :trim_ref_start=>2253,
37
- :trim_ref_end=>2549},
38
- {:region=>"IN",
39
- :cdna=>
40
- "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNATCGAATACTGCCATTTGTACTGC",
41
- :forward=>"GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNAAAAGGAGAAGCCATGCATG",
42
- :majority=>0,
43
- :end_join=>true,
44
- :end_join_option=>2,
45
- :overlap=>171,
46
- :TCS_QC=>true,
47
- :ref_genome=>"HXB2",
48
- :ref_start=>4384,
49
- :ref_end=>4751,
50
- :indel=>false,
51
- :trim=>false},
52
- {:region=>"V1V3",
53
- :cdna=>
54
- "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCCATTTTGCTYTAYTRABVTTACAATRTGC",
55
- :forward=>
56
- "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTTATGGGATCAAAGCCTAAAGCCATGTGTA",
57
- :majority=>0,
58
- :end_join=>true,
59
- :end_join_option=>1,
60
- :overlap=>0,
61
- :TCS_QC=>true,
62
- :ref_genome=>"HXB2",
63
- :ref_start=>6585,
64
- :ref_end=>7205..7210,
65
- :indel=>true,
66
- :trim=>false},
67
- {:region=>"P17",
68
- :cdna=>
69
- "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCAACAAGGTTTCTGTCATCCAATTTTTTAC",
70
- :forward=>
71
- "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGTCAGCCAAAATTACCCTATAGTGC",
72
- :majority=>0,
73
- :end_join=>true,
74
- :end_join_option=>1,
75
- :overlap=>0,
76
- :TCS_QC=>true,
77
- :ref_genome=>"HXB2",
78
- :ref_start=>1196,
79
- :ref_end=>1725,
80
- :indel=>true,
81
- :trim=>false}
82
- ]
83
- }
3
+ # store preset params for the DR pipeline.
4
+ # Used in the `tcs` command.
5
+ # run `tcs --dr_params [VERSION]` to pull the params json string for each version of DR.
6
+ module TcsDr
7
+ PARAMS = {
8
+ "v1" => {:platform_error_rate=>0.02,
9
+ :primer_pairs=>
10
+ [{:region=>"RT",
11
+ :cdna=>
12
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCACTATAGGCTGTACTGTCCATTTATC",
13
+ :forward=>
14
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGGCCATTGACAGAAGAAAAAATAAAAGC",
15
+ :majority=>0,
16
+ :end_join=>true,
17
+ :end_join_option=>1,
18
+ :overlap=>0,
19
+ :TCS_QC=>true,
20
+ :ref_genome=>"HXB2",
21
+ :ref_start=>2648,
22
+ :ref_end=>3257,
23
+ :indel=>true,
24
+ :trim=>false},
25
+ {:region=>"PR",
26
+ :cdna=>
27
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNCAGTTTAACTTTTGGGCCATCCATTCC",
28
+ :forward=>
29
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTCAGAGCAGACCAGAGCCAACAGCCCCA",
30
+ :majority=>0,
31
+ :end_join=>true,
32
+ :end_join_option=>3,
33
+ :TCS_QC=>true,
34
+ :ref_genome=>"HXB2",
35
+ :ref_start=>0,
36
+ :ref_end=>2591,
37
+ :indel=>true,
38
+ :trim=>true,
39
+ :trim_ref=>"HXB2",
40
+ :trim_ref_start=>2253,
41
+ :trim_ref_end=>2549},
42
+ {:region=>"IN",
43
+ :cdna=>
44
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNATCGAATACTGCCATTTGTACTGC",
45
+ :forward=>"GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNAAAAGGAGAAGCCATGCATG",
46
+ :majority=>0,
47
+ :end_join=>true,
48
+ :end_join_option=>2,
49
+ :overlap=>171,
50
+ :TCS_QC=>true,
51
+ :ref_genome=>"HXB2",
52
+ :ref_start=>4384,
53
+ :ref_end=>4751,
54
+ :indel=>false,
55
+ :trim=>false},
56
+ {:region=>"V1V3",
57
+ :cdna=>
58
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCCATTTTGCTYTAYTRABVTTACAATRTGC",
59
+ :forward=>
60
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTTATGGGATCAAAGCCTAAAGCCATGTGTA",
61
+ :majority=>0,
62
+ :end_join=>true,
63
+ :end_join_option=>1,
64
+ :overlap=>0,
65
+ :TCS_QC=>true,
66
+ :ref_genome=>"HXB2",
67
+ :ref_start=>6585,
68
+ :ref_end=>7205..7210,
69
+ :indel=>true,
70
+ :trim=>false},
71
+ {:region=>"P17",
72
+ :cdna=>
73
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCAACAAGGTTTCTGTCATCCAATTTTTTAC",
74
+ :forward=>
75
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGTCAGCCAAAATTACCCTATAGTGC",
76
+ :majority=>0,
77
+ :end_join=>true,
78
+ :end_join_option=>1,
79
+ :overlap=>0,
80
+ :TCS_QC=>true,
81
+ :ref_genome=>"HXB2",
82
+ :ref_start=>1196,
83
+ :ref_end=>1725,
84
+ :indel=>true,
85
+ :trim=>false}
86
+ ]
87
+ },
88
+
89
+ "v2" => {:platform_error_rate=>0.02,
90
+ :primer_pairs=>
91
+ [{:region=>"RT",
92
+ :cdna=>
93
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCACTATAGGCTGTACTGTCCATTTATC",
94
+ :forward=>
95
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGGCCATTGACAGAAGAAAAAATAAAAGC",
96
+ :majority=>0,
97
+ :end_join=>true,
98
+ :end_join_option=>1,
99
+ :overlap=>0,
100
+ :TCS_QC=>true,
101
+ :ref_genome=>"HXB2",
102
+ :ref_start=>2648,
103
+ :ref_end=>3257,
104
+ :indel=>true,
105
+ :trim=>false},
106
+ {:region=>"PR",
107
+ :cdna=>
108
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNTTAACCTTTGGGCCATCCATTCC",
109
+ :forward=>
110
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTCAGAGCAGACCAGAGCCAACAGCCCCA",
111
+ :majority=>0,
112
+ :end_join=>true,
113
+ :end_join_option=>3,
114
+ :TCS_QC=>true,
115
+ :ref_genome=>"HXB2",
116
+ :ref_start=>0,
117
+ :ref_end=>2591,
118
+ :indel=>true,
119
+ :trim=>true,
120
+ :trim_ref=>"HXB2",
121
+ :trim_ref_start=>2253,
122
+ :trim_ref_end=>2549},
123
+ {:region=>"IN",
124
+ :cdna=>
125
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNATCGAATACTGCCATTTGTACTGC",
126
+ :forward=>"GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNAAAAGGAGAAGCCATGCATG",
127
+ :majority=>0,
128
+ :end_join=>true,
129
+ :end_join_option=>2,
130
+ :overlap=>171,
131
+ :TCS_QC=>true,
132
+ :ref_genome=>"HXB2",
133
+ :ref_start=>4384,
134
+ :ref_end=>4751,
135
+ :indel=>false,
136
+ :trim=>false},
137
+ {:region=>"V1V3",
138
+ :cdna=>
139
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCCATTTTGCTYTAYTRABVTTACAATRTGC",
140
+ :forward=>
141
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNTTATGGGATCAAAGCCTAAAGCCATGTGTA",
142
+ :majority=>0,
143
+ :end_join=>true,
144
+ :end_join_option=>1,
145
+ :overlap=>0,
146
+ :TCS_QC=>true,
147
+ :ref_genome=>"HXB2",
148
+ :ref_start=>6585,
149
+ :ref_end=>7205..7210,
150
+ :indel=>true,
151
+ :trim=>false},
152
+ {:region=>"P17",
153
+ :cdna=>
154
+ "GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCTNNNNNNNNNNNCAGTCAACAAGGTTTCTGTCATCCAATTTTTTAC",
155
+ :forward=>
156
+ "GCCTCCCTCGCGCCATCAGAGATGTGTATAAGAGACAGNNNNGTCAGCCAAAATTACCCTATAGTGC",
157
+ :majority=>0,
158
+ :end_join=>true,
159
+ :end_join_option=>1,
160
+ :overlap=>0,
161
+ :TCS_QC=>true,
162
+ :ref_genome=>"HXB2",
163
+ :ref_start=>1196,
164
+ :ref_end=>1725,
165
+ :indel=>true,
166
+ :trim=>false}
167
+ ]
168
+ }
169
+ }
170
+
84
171
  end
85
172
 
86
173
  end
@@ -0,0 +1,9 @@
1
+ dir.create(
2
+ path = Sys.getenv("R_LIBS_USER"),
3
+ showWarnings = FALSE,
4
+ recursive = TRUE
5
+ )
6
+
7
+ packages <- c("ggplot2", "phangorn", "ape", "scales", "ggforce", "cowplot", "magrittr", "gridExtra")
8
+
9
+ install.packages(setdiff(packages, rownames(installed.packages())), lib = Sys.getenv("R_LIBS_USER"), repos = "https://cran.rstudio.com/")
@@ -0,0 +1,34 @@
1
+ setwd("PATH_TO_FASTA")
2
+ library(phangorn)
3
+ library(ape)
4
+ library(ggplot2)
5
+ library(scales)
6
+ library(ggforce)
7
+ library(cowplot)
8
+ library(magrittr)
9
+ library(gridExtra)
10
+
11
+
12
+ pdf("OUTPUT_PDF", onefile=T, width=11, height=8.5)
13
+ fileNames <- list.files()
14
+
15
+ for (fileName in fileNames) {
16
+ dna <- read.dna(fileName, format="fasta")
17
+ D<- dist.dna(dna, model="raw")
18
+ pi <- mean(D)
19
+ dist20 <- quantile(D, prob=c(0.20))
20
+ alldist <- data.frame(File=fileName, pi, dist20)
21
+ write.table(alldist,"OUTPUT_CSV",append=TRUE, sep = ",", row.names = FALSE, col.names=FALSE)
22
+
23
+ D2 <- dist.dna(dna, model="TN93")*100
24
+ def.par <- par(no.readonly = TRUE)
25
+ par(mfrow=c(1,2))
26
+ hist<-hist(D, main=fileName, xlab="% Pairwise Distance", ylab="Frequency", col="gray")
27
+ abline(v=dist20, col="royalblue",lwd=2)
28
+ abline(v=pi, col="red", lwd=2)
29
+ legend(x="topright", c("dist20", "pi"), col = c("royalblue", "red"), lwd = c(2,2), cex=0.5)
30
+ njtree<-NJ(D2)
31
+ njtreeplot <- plot(njtree, show.tip.label=F, "unrooted", main=fileName)
32
+ add.scale.bar(cex=0.7, font=2, col="red")
33
+ }
34
+ dev.off()
@@ -2,6 +2,6 @@
2
2
  # version info and histroy
3
3
 
4
4
  module ViralSeq
5
- VERSION = "1.7.1"
6
- TCS_VERSION = "2.5.2"
5
+ VERSION = "1.8.1.1"
6
+ TCS_VERSION = "2.6.1"
7
7
  end
data/lib/viral_seq.rb CHANGED
@@ -21,6 +21,8 @@
21
21
  module ViralSeq; end
22
22
 
23
23
  # load all classes
24
+
25
+ require_relative "viral_seq/root"
24
26
  require_relative "viral_seq/constant"
25
27
  require_relative "viral_seq/enumerable"
26
28
  require_relative "viral_seq/hash"
@@ -40,7 +42,11 @@ require_relative "viral_seq/tcs_json"
40
42
  require_relative "viral_seq/tcs_dr"
41
43
  require_relative "viral_seq/sdrm"
42
44
  require_relative "viral_seq/recency"
45
+ require_relative "viral_seq/R"
46
+ require_relative "viral_seq/recency_report"
47
+
43
48
 
44
49
  require "muscle_bio"
45
50
  require "json"
46
51
  require "securerandom"
52
+ require "prawn"
data/viral_seq.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.post_install_message = "Thanks for installing!"
27
27
 
28
- spec.add_development_dependency "bundler", "~> 2.0"
28
+ spec.add_development_dependency "bundler", "~> 2.5"
29
29
  spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
 
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.required_rubygems_version = '>= 1.3.6'
36
36
 
37
37
  # muscle_bio gem required
38
- spec.add_runtime_dependency "muscle_bio", "~> 0.5"
38
+ spec.add_runtime_dependency "muscle_bio", "= 0.4"
39
39
 
40
40
  # colorize gem required
41
41
  spec.add_runtime_dependency "colorize", "~> 0.1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viral_seq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuntai Zhou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-12 00:00:00.000000000 Z
12
+ date: 2024-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.0'
20
+ version: '2.5'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '2.0'
27
+ version: '2.5'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -57,16 +57,16 @@ dependencies:
57
57
  name: muscle_bio
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: '0.5'
62
+ version: '0.4'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: '0.5'
69
+ version: '0.4'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: colorize
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -174,6 +174,7 @@ files:
174
174
  - docs/sample_miseq_data/hivdr_control/r2.fastq.gz
175
175
  - docs/variants_structure.pdf
176
176
  - lib/viral_seq.rb
177
+ - lib/viral_seq/R.rb
177
178
  - lib/viral_seq/constant.rb
178
179
  - lib/viral_seq/enumerable.rb
179
180
  - lib/viral_seq/hash.rb
@@ -182,7 +183,9 @@ files:
182
183
  - lib/viral_seq/muscle.rb
183
184
  - lib/viral_seq/pid.rb
184
185
  - lib/viral_seq/recency.rb
186
+ - lib/viral_seq/recency_report.rb
185
187
  - lib/viral_seq/ref_seq.rb
188
+ - lib/viral_seq/root.rb
186
189
  - lib/viral_seq/rubystats.rb
187
190
  - lib/viral_seq/sdrm.rb
188
191
  - lib/viral_seq/seq_hash.rb
@@ -192,6 +195,11 @@ files:
192
195
  - lib/viral_seq/tcs_core.rb
193
196
  - lib/viral_seq/tcs_dr.rb
194
197
  - lib/viral_seq/tcs_json.rb
198
+ - lib/viral_seq/util/check_env.r
199
+ - lib/viral_seq/util/recency_model/rt_only_fit.Rdata
200
+ - lib/viral_seq/util/recency_model/rt_v1v3_fit.Rdata
201
+ - lib/viral_seq/util/recency_model/v1v3_only_fit.Rdata
202
+ - lib/viral_seq/util/sdrm_r.r
195
203
  - lib/viral_seq/version.rb
196
204
  - viral_seq.gemspec
197
205
  homepage: https://github.com/ViralSeq/viral_seq
@@ -214,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
222
  version: 1.3.6
215
223
  requirements:
216
224
  - R required for some functions
217
- rubygems_version: 3.2.2
225
+ rubygems_version: 3.5.10
218
226
  signing_key:
219
227
  specification_version: 4
220
228
  summary: A Ruby Gem containing bioinformatics tools for processing viral NGS data.