viral_seq 1.0.7 → 1.0.12

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,5 +2,6 @@
2
2
  # version info and histroy
3
3
 
4
4
  module ViralSeq
5
- VERSION = "1.0.7"
5
+ VERSION = "1.0.12"
6
+ TCS_VERSION = "2.1.1"
6
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.7
4
+ version: 1.0.12
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-01-28 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
@@ -89,6 +89,7 @@ email:
89
89
  - clarkmu@gmail.com
90
90
  executables:
91
91
  - locator
92
+ - tcs
92
93
  extensions: []
93
94
  extra_rdoc_files: []
94
95
  files:
@@ -102,6 +103,7 @@ files:
102
103
  - README.md
103
104
  - Rakefile
104
105
  - bin/locator
106
+ - bin/tcs
105
107
  - lib/viral_seq.rb
106
108
  - lib/viral_seq/constant.rb
107
109
  - lib/viral_seq/enumerable.rb
@@ -112,10 +114,13 @@ files:
112
114
  - lib/viral_seq/pid.rb
113
115
  - lib/viral_seq/ref_seq.rb
114
116
  - lib/viral_seq/rubystats.rb
117
+ - lib/viral_seq/sdrm.rb
115
118
  - lib/viral_seq/seq_hash.rb
116
119
  - lib/viral_seq/seq_hash_pair.rb
117
120
  - lib/viral_seq/sequence.rb
118
121
  - lib/viral_seq/string.rb
122
+ - lib/viral_seq/tcs_core.rb
123
+ - lib/viral_seq/tcs_json.rb
119
124
  - lib/viral_seq/version.rb
120
125
  - viral_seq.gemspec
121
126
  homepage: https://github.com/ViralSeq/viral_seq
@@ -138,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
143
  version: '0'
139
144
  requirements:
140
145
  - R required for some functions
141
- rubygems_version: 3.1.2
146
+ rubygems_version: 3.2.2
142
147
  signing_key:
143
148
  specification_version: 4
144
149
  summary: A Ruby Gem containing bioinformatics tools for processing viral NGS data.