viral_seq 1.0.8 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,178 @@
1
+ module ViralSeq
2
+ class TcsJson
3
+ class << self
4
+
5
+ def generate
6
+ puts '-'*58
7
+ puts '| JSON Parameter Generator for ' + "TCS #{ViralSeq::TCS_VERSION}".red.bold + " by " + "Shuntai Zhou".blue.bold + ' |'
8
+ puts '-'*58 + "\n"
9
+
10
+ param = {}
11
+
12
+ puts 'Enter the path to the directory that contains the MiSeq pair-end R1 and R2 .fastq or .fastq.gz file'
13
+ print '> '
14
+ param[:raw_sequence_dir] = gets.chomp.rstrip
15
+
16
+ puts 'Enter the estimated platform error rate (for TCS cut-off calculation), default as ' + '0.02'.red.bold
17
+ print '> '
18
+ input_error = gets.chomp.rstrip.to_f
19
+ if input_error == 0.0
20
+ param[:platform_error_rate] = 0.02
21
+ else
22
+ param[:platform_error_rate] = input_error
23
+ end
24
+
25
+ param[:primer_pairs] = []
26
+
27
+ loop do
28
+ data = {}
29
+ puts "Enter the name for the sequenced region: "
30
+ print '> '
31
+ data[:region] = gets.chomp.rstrip
32
+
33
+ puts "Enter the #{"cDNA".red.bold} primer sequence: "
34
+ print '> '
35
+ data[:cdna] = gets.chomp.rstrip
36
+
37
+ puts "Enter the #{"forward".blue.bold} primer sequence: "
38
+ print '> '
39
+ data[:forward] = gets.chomp.rstrip
40
+
41
+ puts "Enter supermajority cut-off (0.5 - 1.0). Default Simple Majority"
42
+ print '> '
43
+ mj = gets.chomp.rstrip.to_f
44
+ if (0.5..1.0).include?(mj)
45
+ data[:majority] = mj
46
+ else
47
+ data[:majority] = 0
48
+ end
49
+
50
+ print "Need end-join? Y/N \n> "
51
+ ej = gets.chomp.rstrip
52
+ if ej =~ /y|yes/i
53
+ data[:end_join] = true
54
+
55
+ print "End-join option? Choose from (1-4):\n
56
+ 1: simple join, no overlap
57
+ 2: known overlap \n
58
+ 3: unknow overlap, use sample consensus to determine overlap, all sequence pairs have same overlap\n
59
+ 4: unknow overlap, determine overlap by individual sequence pairs, sequence pairs can have different overlap\n
60
+ > "
61
+ ej_option = gets.chomp.rstrip
62
+ while ![1,2,3,4].include?(ej_option.to_i)
63
+ puts "Entered end-join option #{ej_option.red.bold} not valid (choose 1-4), try again"
64
+ ej_option = gets.chomp.rstrip.to_i
65
+ end
66
+ case ej_option.to_i
67
+ when 1
68
+ data[:end_join_option] = 1
69
+ data[:overlap] = 0
70
+ when 2
71
+ data[:end_join_option] = 1
72
+ print "overlap bases: \n> "
73
+ ol = gets.chomp.rstrip.to_i
74
+ data[:overlap] = ol
75
+ when 3
76
+ data[:end_join_option] = 3
77
+ when 4
78
+ data[:end_join_option] = 4
79
+ end
80
+
81
+ print "Need QC for TCS? (support for HIV-1 and SIV)? Y/N \n> "
82
+ qc = gets.chomp.rstrip
83
+ if qc =~ /y|yes/i
84
+ data[:TCS_QC] = true
85
+
86
+ data[:ref_genome] = get_ref
87
+
88
+ print "reference 5'end ref position or posiiton range, 0 if no need to match this end \n> "
89
+ data[:ref_start] = gets.chomp.rstrip.to_i
90
+
91
+ print "reference 3'end ref position or posiiton range: 0 if no need to match this end \n> "
92
+ data[:ref_end] = gets.chomp.rstrip.to_i
93
+
94
+ print "allow indels? (default as yes) Y/N \n> "
95
+ indel = gets.chomp.rstrip
96
+ if indel =~ /n|no/i
97
+ data[:indel] = false
98
+ else
99
+ data[:indel] = true
100
+ end
101
+ else
102
+ data[:TCS_QC] = false
103
+ end
104
+
105
+ print "Need trimming to a reference genome? Y/N \n> "
106
+ trim_option = gets.chomp.rstrip
107
+ if trim_option =~ /y|yes/i
108
+ data[:trim] = true
109
+ data[:trim_ref] = get_ref
110
+
111
+ print "reference 5'end ref position \n> "
112
+ data[:trim_ref_start] = gets.chomp.rstrip.to_i
113
+
114
+ print "reference 3'end ref position \n> "
115
+ data[:trim_ref_end] = gets.chomp.rstrip.to_i
116
+
117
+ else
118
+ data[:trim] = false
119
+ end
120
+
121
+ else
122
+ data[:end_join] = false
123
+ end
124
+
125
+ param[:primer_pairs] << data
126
+ print "Do you wish to conintue? Y/N \n> "
127
+ continue_sig = gets.chomp.rstrip
128
+ break unless continue_sig =~ /y|yes/i
129
+
130
+ end
131
+
132
+ puts "\nYour JSON string is:"
133
+ puts JSON.pretty_generate(param)
134
+
135
+ print "\nDo you wish to save it as a file? Y/N \n> "
136
+ save_option = gets.chomp.rstrip
137
+
138
+ if save_option =~ /y|yes/i
139
+ print "Path to save JSON file:\n> "
140
+ path = gets.chomp.rstrip
141
+ File.open(path, 'w') {|f| f.puts JSON.pretty_generate(param)}
142
+ end
143
+
144
+ print "\nDo you wish to execute tcs pipeline with the input params now? Y/N \n> "
145
+
146
+ rsp = gets.chomp.rstrip
147
+ if rsp =~ /y/i
148
+ return param
149
+ else
150
+ abort "Params json file generated. You can execute tcs pipeline using `tcs -p [params.json]`"
151
+ end
152
+
153
+ end
154
+
155
+ private
156
+ def get_ref
157
+ puts "Choose reference genome (1-3):"
158
+ puts "1. HIV-1 HXB2".red.bold
159
+ puts "2. HIV-1 NL4-3".blue.bold
160
+ puts "3. SIV MAC239".magenta.bold
161
+ print "> "
162
+ ref_option = gets.chomp.rstrip
163
+ while ![1,2,3].include?(ref_option.to_i)
164
+ print "Entered end-join option #{ref_option.to_s.red.bold} not valid (choose 1-3), try again\n> "
165
+ ref_option = gets.chomp.rstrip.to_i
166
+ end
167
+ ref = case ref_option.to_i
168
+ when 1
169
+ :HXB2
170
+ when 2
171
+ :NL43
172
+ when 3
173
+ :MAC239
174
+ end
175
+ end
176
+ end
177
+ end # end TcsJson
178
+ end # end main module
@@ -2,6 +2,6 @@
2
2
  # version info and histroy
3
3
 
4
4
  module ViralSeq
5
- VERSION = "1.0.8"
6
- TCS_VERSION = "2.0.0"
5
+ VERSION = "1.0.13"
6
+ TCS_VERSION = "2.1.1"
7
7
  end
data/viral_seq.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.post_install_message = "Thanks for installing!"
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
 
32
32
  # muscle_bio gem required
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.0.8
4
+ version: 1.0.13
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: 2020-02-29 00:00:00.000000000 Z
12
+ date: 2021-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
34
+ version: '13.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '10.0'
41
+ version: '13.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +90,6 @@ email:
90
90
  executables:
91
91
  - locator
92
92
  - tcs
93
- - tcs_json_generator
94
93
  extensions: []
95
94
  extra_rdoc_files: []
96
95
  files:
@@ -105,7 +104,6 @@ files:
105
104
  - Rakefile
106
105
  - bin/locator
107
106
  - bin/tcs
108
- - bin/tcs_json_generator
109
107
  - lib/viral_seq.rb
110
108
  - lib/viral_seq/constant.rb
111
109
  - lib/viral_seq/enumerable.rb
@@ -116,10 +114,13 @@ files:
116
114
  - lib/viral_seq/pid.rb
117
115
  - lib/viral_seq/ref_seq.rb
118
116
  - lib/viral_seq/rubystats.rb
117
+ - lib/viral_seq/sdrm.rb
119
118
  - lib/viral_seq/seq_hash.rb
120
119
  - lib/viral_seq/seq_hash_pair.rb
121
120
  - lib/viral_seq/sequence.rb
122
121
  - lib/viral_seq/string.rb
122
+ - lib/viral_seq/tcs_core.rb
123
+ - lib/viral_seq/tcs_json.rb
123
124
  - lib/viral_seq/version.rb
124
125
  - viral_seq.gemspec
125
126
  homepage: https://github.com/ViralSeq/viral_seq
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  version: '0'
143
144
  requirements:
144
145
  - R required for some functions
145
- rubygems_version: 3.1.2
146
+ rubygems_version: 3.2.2
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: A Ruby Gem containing bioinformatics tools for processing viral NGS data.
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # TCS pipeline JSON params generator.
4
-
5
- require 'colorize'
6
- require 'json'
7
-
8
- def get_ref
9
- puts "Choose reference genome (1-3):"
10
- puts "1. HIV-1 HXB2".red.bold
11
- puts "2. HIV-1 NL4-3".blue.bold
12
- puts "3. SIV MAC239".magenta.bold
13
- print "> "
14
- ref_option = gets.chomp.rstrip
15
- while ![1,2,3].include?(ref_option.to_i)
16
- print "Entered end-join option #{ref_option.to_s.red.bold} not valid (choose 1-3), try again\n> "
17
- ref_option = gets.chomp.rstrip.to_i
18
- end
19
- ref = case ref_option.to_i
20
- when 1
21
- :HXB2
22
- when 2
23
- :NL43
24
- when 3
25
- :MAC239
26
- end
27
- end
28
-
29
- TCS_VERSION = "2.0.0"
30
-
31
- puts "\n" + '-'*58
32
- puts '| JSON Parameter Generator for ' + "TCS #{TCS_VERSION}".red.bold + " by " + "Shuntai Zhou".blue.bold + ' |'
33
- puts '-'*58 + "\n"
34
-
35
- param = {}
36
-
37
- puts 'Enter the path to the directory that contains the MiSeq pair-end R1 and R2 .fastq or .fastq.gz file'
38
- print '> '
39
- param[:raw_sequence_dir] = gets.chomp.rstrip
40
-
41
- puts 'Enter the estimated platform error rate (for TCS cut-off calculation), default as ' + '0.02'.red.bold
42
- print '> '
43
- input_error = gets.chomp.rstrip.to_f
44
- if input_error == 0.0
45
- param[:platform_error_rate] = 0.02
46
- else
47
- param[:platform_error_rate] = input_error
48
- end
49
-
50
- param[:primer_pairs] = []
51
- continue = true
52
- while continue
53
- data = {}
54
- puts "Enter the name for the sequenced region: "
55
- print '> '
56
- data[:region] = gets.chomp.rstrip
57
-
58
- puts "Enter the #{"cDNA".red.bold} primer sequence: "
59
- print '> '
60
- data[:cdna] = gets.chomp.rstrip
61
-
62
- puts "Enter the #{"forward".blue.bold} primer sequence: "
63
- print '> '
64
- data[:forward] = gets.chomp.rstrip
65
-
66
- puts "Enter supermajority cut-off (0.5 - 0.9). Default: " + "0.5".blue.bold + " (simple majority)"
67
- print '> '
68
- mj = gets.chomp.rstrip.to_f
69
- if (0.5..0.9).include?(mj)
70
- data[:majority] = mj
71
- else
72
- data[:majority] = 0.5
73
- end
74
-
75
- print "Need end-join? Y/N \n> "
76
- ej = gets.chomp.rstrip
77
- if ej =~ /y|yes/i
78
- data[:end_join] = true
79
-
80
- print "End-join option? Choose from (1-4):\n
81
- 1: simple join, no overlap
82
- 2: known overlap \n
83
- 3: unknow overlap, use sample consensus to determine overlap, all sequence pairs have same overlap\n
84
- 4: unknow overlap, determine overlap by individual sequence pairs, sequence pairs can have different overlap\n
85
- > "
86
- ej_option = gets.chomp.rstrip
87
- while ![1,2,3,4].include?(ej_option.to_i)
88
- puts "Entered end-join option #{ej_option.red.bold} not valid (choose 1-4), try again"
89
- ej_option = gets.chomp.rstrip.to_i
90
- end
91
- case ej_option.to_i
92
- when 1
93
- data[:end_join_option] = 1
94
- data[:overlap] = 0
95
- when 2
96
- data[:end_join_option] = 1
97
- print "overlap bases: \n> "
98
- ol = gets.chomp.rstrip.to_i
99
- data[:overlap] = ol
100
- when 3
101
- data[:end_join_option] = 3
102
- when 4
103
- data[:end_join_option] = 4
104
- end
105
-
106
- print "Need QC for TCS? (support for HIV-1 and SIV)? Y/N \n> "
107
- qc = gets.chomp.rstrip
108
- if qc =~ /y|yes/i
109
- data[:TCS_QC] = true
110
-
111
- data[:ref_genome] = get_ref
112
-
113
- print "reference 5'end ref position or posiiton range, 0 if no need to match this end \n> "
114
- data[:ref_start] = gets.chomp.rstrip.to_i
115
-
116
- print "reference 3'end ref position or posiiton range: 0 if no need to match this end \n> "
117
- data[:ref_end] = gets.chomp.rstrip.to_i
118
-
119
- print "allow indels? (default as yes) Y/N \n> "
120
- indel = gets.chomp.rstrip
121
- if indel =~ /n|no/i
122
- data[:indel] = false
123
- else
124
- data[:indel] = true
125
- end
126
- else
127
- data[:TCS_QC] = false
128
- end
129
-
130
- print "Need trimming to a reference genome? Y/N \n> "
131
- trim_option = gets.chomp.rstrip
132
- if trim_option =~ /y|yes/i
133
- data[:trim] = true
134
- data[:trim_ref] = get_ref
135
-
136
- print "reference 5'end ref position \n> "
137
- data[:trim_ref_start] = gets.chomp.rstrip.to_i
138
-
139
- print "reference 3'end ref position \n> "
140
- data[:trim_ref_end] = gets.chomp.rstrip.to_i
141
-
142
- else
143
- data[:trim] = false
144
- end
145
-
146
- else
147
- data[:end_join] = false
148
- end
149
-
150
- print "Do you wish to conintue? Y/N \n> "
151
- continue_sig = gets.chomp.rstrip
152
- if continue_sig =~ /y|yes/i
153
- continue = true
154
- else
155
- continue = false
156
- end
157
- param[:primer_pairs] << data
158
- end
159
-
160
- puts "\nYour JSON string is:"
161
- puts JSON.pretty_generate(param)
162
-
163
- print "\nDo you wish to save it as a file? Y/N \n> "
164
- save_option = gets.chomp.rstrip
165
-
166
- if save_option =~ /y|yes/i
167
- print "Path to save JSON file:\n> "
168
- path = gets.chomp.rstrip
169
- File.open(path, 'w') {|f| f.puts JSON.pretty_generate(param)}
170
- end