viral_seq 1.7.1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +29 -24
- data/README.md +28 -18
- data/bin/tcs +39 -8
- data/bin/tcs_log +27 -16
- data/bin/tcs_sdrm +23 -14
- data/lib/viral_seq/R.rb +31 -0
- data/lib/viral_seq/constant.rb +0 -41
- data/lib/viral_seq/muscle.rb +1 -1
- data/lib/viral_seq/recency.rb +47 -1
- data/lib/viral_seq/recency_report.rb +193 -0
- data/lib/viral_seq/root.rb +7 -0
- data/lib/viral_seq/seq_hash.rb +4 -4
- data/lib/viral_seq/seq_hash_pair.rb +154 -27
- data/lib/viral_seq/tcs_dr.rb +168 -81
- data/lib/viral_seq/util/check_env.r +9 -0
- data/lib/viral_seq/util/recency_model/rt_only_fit.Rdata +0 -0
- data/lib/viral_seq/util/recency_model/rt_v1v3_fit.Rdata +0 -0
- data/lib/viral_seq/util/recency_model/v1v3_only_fit.Rdata +0 -0
- data/lib/viral_seq/util/sdrm_r.r +34 -0
- data/lib/viral_seq/version.rb +2 -2
- data/lib/viral_seq.rb +6 -0
- data/viral_seq.gemspec +2 -2
- metadata +17 -9
data/lib/viral_seq/tcs_dr.rb
CHANGED
@@ -1,86 +1,173 @@
|
|
1
1
|
module ViralSeq
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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/")
|
Binary file
|
Binary file
|
Binary file
|
@@ -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()
|
data/lib/viral_seq/version.rb
CHANGED
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.
|
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", "
|
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.
|
4
|
+
version: 1.8.0
|
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:
|
12
|
+
date: 2024-05-09 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.
|
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.
|
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.
|
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.
|
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.
|
225
|
+
rubygems_version: 3.5.9
|
218
226
|
signing_key:
|
219
227
|
specification_version: 4
|
220
228
|
summary: A Ruby Gem containing bioinformatics tools for processing viral NGS data.
|