snp-search 2.10.0 → 2.10.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.10.0
1
+ 2.10.2
@@ -1,28 +1,26 @@
1
1
  require 'snp-search'
2
- require 'snp_db_connection.rb'
3
- require 'snp_db_models.rb'
4
- require 'snp_db_schema.rb'
5
- require 'output_information_methods.rb'
2
+ require 'snp_db_connection'
3
+ require 'snp_db_models'
4
+ require 'snp_db_schema'
5
+ require 'output_information_methods'
6
6
  require 'activerecord-import'
7
7
  require 'slop'
8
8
 
9
+ # README file: https://github.com/phe-bioinformatics/snp-search/blob/master/README.rdoc'
10
+
9
11
  opts = Slop.parse do
10
12
 
11
- banner "\nruby snp-search [-create] [-output] [-n <sqlite3>] [options]*"
13
+ banner "\nruby snp-search [-create] [-output] [-d <sqlite3>] [options]*"
12
14
 
13
15
  separator ''
14
16
 
15
17
  on :C, :create, 'Create database'
16
18
  on :O, :output, 'Output a process'
17
-
18
- # separator ''
19
- # # separator 'README file: https://github.com/hpa-bioinformatics/snp-search/blob/master/README.rdoc'
20
- # # separator 'The following command must be used when using -create, or -query or -out_file'
21
- # on :n, :name_of_database=, 'Name of database, Required'
22
-
19
+
23
20
  separator ''
24
21
 
25
- separator '-create -r reference_file.fasta -v vcf_file.vcf -d db.sqlite3'
22
+ separator '-create -r reference_file.gbk (or .embl) -v vcf_file.vcf -d db.sqlite3'
23
+ separator 'e.g. snp-search -C -r ecoli.gbk -v ecoli.vcf -d ecoli.sqlite3'
26
24
  on :r, :reference_file=, 'Reference genome file, in gbk or embl file format, Required', true
27
25
  on :v, :vcf_file=, 'variant call format (vcf) file, Required', true
28
26
  on :d, :name_of_database=, 'Name of database, Required'
@@ -30,8 +28,9 @@ opts = Slop.parse do
30
28
 
31
29
  separator ''
32
30
 
33
- separator '-output -all_or_filtered_snps -d db.sqlite3 [options]'
34
- on :f, :all_or_filtered_snps, 'SNPs from specified features in the database (if you do not want to ignore any SNPs, just use this option with -n -F/T -o)'
31
+ separator '-output -all_or_filtered_snps -d db.sqlite3 -T|-F [options]'
32
+ separator 'e.g. snp-search -O -f -F -d ecoli.sqlite3 -R -I phage,insertion,transposon -o ecoli_concatenated_snps_filtered.fasta'
33
+ on :f, :all_or_filtered_snps, 'ignore SNPs from specified features in the database (if you do not want to ignore any SNPs, just use this option with -F/T -o)'
35
34
  on :F, :fasta, 'output fasta file format (default)'
36
35
  on :T, :tabular, 'output tabular file format'
37
36
  on :c, :cuttoff_snp_qual=, 'SNP quality cutoff, (default = 90)', :as => :int, :default => 90
@@ -39,13 +38,14 @@ opts = Slop.parse do
39
38
  on :R, :remove_non_informative_snps, 'Only output informative SNPs.'
40
39
  on :e, :ignore_snps_in_range=, 'A list of position ranges to ignore e.g 10..500,2000..2500.'
41
40
  on :a, :ignore_strains=, 'A list of strains to ignore (seperate by comma e.g. S1,S4,S8 ).'
42
- on :I, :ignore_snps_on_annotation=, 'The name of the feature(s) to ignore. Features should be seperated by comma (e.g. phages,inserstion,transposons)'
41
+ on :I, :ignore_snps_on_annotation=, 'The name of the feature(s) to ignore. Features should be seperated by comma (e.g. phage,inserstion,transposon)'
43
42
  on :o, :out=, 'Name of output file, Required'
44
43
  on :t, :tree, 'Generate SNP phylogeny (only used with -fasta option)'
45
44
  on :p, :fasttree_path=, 'Full path to the FastTree tool (e.g. /usr/local/bin/FastTree. only used with -tree option)'
46
45
  separator ''
47
46
 
48
- separator '-output -unique_snps -d db.sqlite3 [options]'
47
+ separator '-output -unique_snps -d db.sqlite3 -s strains.txt -o unique_snps.txt [options]'
48
+ separator 'e.g. snp-search -O -u -d ecoli.sqlite3 -s strains_list_for_unique_snps.txt -o ecoli_unique_snps_strains.txt'
49
49
  on :u, :unique_snps, 'Query for unique snps in the database'
50
50
  on :c, :cuttoff_snp_qual=, 'SNP quality cutoff, (default = 90)', :as => :int, :default => 90
51
51
  on :g, :cuttoff_genotype=, 'Genotype quality cutoff (default = 30)', :as => :int, :default => 30
@@ -54,7 +54,8 @@ opts = Slop.parse do
54
54
 
55
55
  separator ''
56
56
 
57
- separator '-output -info -d db.sqlite3 [options]'
57
+ separator '-output -info -d db.sqlite3 -o info.txt [options]'
58
+ separator ''
58
59
  on :i, :info, 'Output various information about SNPs'
59
60
  on :c, :cuttoff_snp_qual=, 'SNP quality cutoff, (default = 90)', :as => :int, :default => 90
60
61
  on :g, :cuttoff_genotype=, 'Genotype quality cutoff (default = 30)', :as => :int, :default => 30
@@ -19,7 +19,7 @@ def output_information_methods(snps, outfile, cuttoff_genotype, cuttoff_snp, inf
19
19
  snp.alleles.each do |allele|
20
20
  next if snp.alleles.any?{|allele| allele.base.length > 1} # indel
21
21
  if allele.id != snp.reference_allele_id
22
-
22
+ snps_counter += 1
23
23
  # get annotation (if there is any) for each SNP
24
24
  features = Feature.joins(:snps).where("snps.id = ?", snp.id)
25
25
 
@@ -37,7 +37,7 @@ def output_information_methods(snps, outfile, cuttoff_genotype, cuttoff_snp, inf
37
37
  ref_base = Bio::Sequence.auto(Allele.find(snp.reference_allele_id).base)
38
38
  snp_base = Bio::Sequence.auto(allele.base)
39
39
  # count snps now: after you have selected the snps with gqs and snp_qual greater than the threshold.
40
- snps_counter += 1
40
+
41
41
  # If the feature is empty then just output basic information about the snp.
42
42
 
43
43
  if features.empty?
@@ -114,7 +114,7 @@ def output_information_methods(snps, outfile, cuttoff_genotype, cuttoff_snp, inf
114
114
  total_number_of_pseudo +=1
115
115
  outfile.puts "#{snp.ref_pos}\t#{features.map{|feature| feature.strand == 1} ? "#{ref_base.upcase}" : "#{ref_base.reverse_complement.upcase}"}\t#{features.map{|feature| feature.strand == 1} ? "#{snp_base.upcase}" : "#{snp_base.reverse_complement.upcase}"}\tnon-synonymous\t#{annotation.value}\tYes\t#{diffs[0][0].element}\t#{diffs[0][1].element}\t#{'Yes' if (hydrophobic.include? diffs[0][0].element) == (non_hydrophobic.include? diffs[0][1].element)}#{'No' if (hydrophobic.include? diffs[0][0].element) != (non_hydrophobic.include? diffs[0][1].element)}\t#{'Yes' if (polar.include? diffs[0][0].element) == (non_polar.include? diffs[0][1].element)}#{'No' if (polar.include? diffs[0][0].element) != (non_polar.include? diffs[0][1].element)}\t#{'Yes' if (small.include? diffs[0][0].element) == (non_small.include? diffs[0][1].element)}#{'No' if (small.include? diffs[0][0].element) != (non_small.include? diffs[0][1].element)}\t#{alleles_array.join("\t") if info}"
116
116
  else
117
- outfile.puts "#{snp.ref_pos}\t#{features.map{|feature| feature.strand == 1} ? "#{ref_base.upcase}" : "#{ref_base.reverse_complement.upcase}"}\t#{features.map{|feature| feature.strand == 1} ? "#{snp_base.upcase}" : "#{snp_base.reverse_complement.upcase}"}\tnon-synonymous\t#{annotation.value}\tNo\t#{diffs[0][0].element}\t#{diffs[0][1].element}\t#{'Yes' if (hydrophobic.include? diffs[0][0].element) == (non_hydrophobic.include? diffs[0][1].element)}#{'No' if (hydrophobic.include? diffs[0][0].element) != (non_hydrophobic.include? diffs[0][1].element)}\t#{'Yes' if (polar.include? diffs[0][0].element) == (non_polar.include? diffs[0][1].element)}#{'No' if (polar.include? diffs[0][0].element) != (non_polar.include? diffs[0][1].element)}\t#{'Yes' if (small.include? diffs[0][0].element) == (non_small.include? diffs[0][1].element)}#{'No' if (small.include? diffs[0][0].element) != (non_small.include? diffs[0][1].element)}\t#{alleles_array.join("\t") if info}"
117
+ outfile.puts "#{snp.ref_pos-1}\t#{features.map{|feature| feature.strand == 1} ? "#{ref_base.upcase}" : "#{ref_base.reverse_complement.upcase}"}\t#{features.map{|feature| feature.strand == 1} ? "#{snp_base.upcase}" : "#{snp_base.reverse_complement.upcase}"}\tnon-synonymous\t#{annotation.value}\tNo\t#{diffs[0][0].element}\t#{diffs[0][1].element}\t#{'Yes' if (hydrophobic.include? diffs[0][0].element) == (non_hydrophobic.include? diffs[0][1].element)}#{'No' if (hydrophobic.include? diffs[0][0].element) != (non_hydrophobic.include? diffs[0][1].element)}\t#{'Yes' if (polar.include? diffs[0][0].element) == (non_polar.include? diffs[0][1].element)}#{'No' if (polar.include? diffs[0][0].element) != (non_polar.include? diffs[0][1].element)}\t#{'Yes' if (small.include? diffs[0][0].element) == (non_small.include? diffs[0][1].element)}#{'No' if (small.include? diffs[0][0].element) != (non_small.include? diffs[0][1].element)}\t#{alleles_array.join("\t") if info}"
118
118
  end
119
119
  end
120
120
  end
Binary file
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "snp-search"
8
- s.version = "2.10.0"
8
+ s.version = "2.10.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ali Al-Shahib", "Anthony Underwood"]
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
37
37
  "lib/snp_db_schema.rb",
38
38
  "pkg/snp-search-1.1.0.gem",
39
39
  "pkg/snp-search-1.2.0.gem",
40
+ "pkg/snp-search-2.10.0.gem",
40
41
  "pkg/snp-search-2.3.0.gem",
41
42
  "pkg/snp-search-2.4.0.gem",
42
43
  "pkg/snp-search-2.5.0.gem",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snp-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -201,6 +201,7 @@ files:
201
201
  - lib/snp_db_schema.rb
202
202
  - pkg/snp-search-1.1.0.gem
203
203
  - pkg/snp-search-1.2.0.gem
204
+ - pkg/snp-search-2.10.0.gem
204
205
  - pkg/snp-search-2.3.0.gem
205
206
  - pkg/snp-search-2.4.0.gem
206
207
  - pkg/snp-search-2.5.0.gem
@@ -226,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
227
  version: '0'
227
228
  segments:
228
229
  - 0
229
- hash: -814863516568107020
230
+ hash: -4259340875047454544
230
231
  required_rubygems_version: !ruby/object:Gem::Requirement
231
232
  none: false
232
233
  requirements: