genevalidator 1.6.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +147 -76
  3. data/Rakefile +1 -1
  4. data/aux/files/css/genevalidator.compiled.min.css +16 -0
  5. data/aux/files/css/{bootstrap.min.css → src/bootstrap.min.css} +0 -0
  6. data/aux/files/css/{font-awesome.min.css → src/font-awesome.min.css} +0 -0
  7. data/aux/files/css/{style.css → src/style.css} +0 -0
  8. data/aux/files/js/genevalidator.compiled.min.js +28 -0
  9. data/aux/files/js/{bootstrap.min.js → src/bootstrap.min.js} +0 -0
  10. data/aux/files/js/{d3.v3.min.js → src/d3.v3.min.js} +0 -0
  11. data/aux/files/js/{jquery-2.1.1.min.js → src/jquery-2.1.1.min.js} +0 -0
  12. data/aux/files/js/{jquery.tablesorter.min.js → src/jquery.tablesorter.min.js} +0 -0
  13. data/aux/files/js/src/plots.js +814 -0
  14. data/aux/files/js/src/script.js +43 -0
  15. data/aux/json_header.erb +6 -6
  16. data/aux/json_query.erb +2 -1
  17. data/aux/template_footer.erb +0 -11
  18. data/aux/template_header.erb +4 -4
  19. data/aux/template_query.erb +1 -1
  20. data/bin/genevalidator +8 -6
  21. data/genevalidator.gemspec +1 -1
  22. data/lib/genevalidator.rb +7 -5
  23. data/lib/genevalidator/arg_validation.rb +12 -9
  24. data/lib/genevalidator/blast.rb +18 -11
  25. data/lib/genevalidator/clusterization.rb +35 -31
  26. data/lib/genevalidator/exceptions.rb +0 -1
  27. data/lib/genevalidator/get_raw_sequences.rb +115 -69
  28. data/lib/genevalidator/hsp.rb +8 -8
  29. data/lib/genevalidator/json_to_gv_results.rb +4 -4
  30. data/lib/genevalidator/output.rb +40 -41
  31. data/lib/genevalidator/pool.rb +5 -4
  32. data/lib/genevalidator/query.rb +37 -0
  33. data/lib/genevalidator/tabular_parser.rb +3 -4
  34. data/lib/genevalidator/validation.rb +16 -11
  35. data/lib/genevalidator/validation_alignment.rb +17 -23
  36. data/lib/genevalidator/validation_blast_reading_frame.rb +3 -3
  37. data/lib/genevalidator/validation_duplication.rb +8 -18
  38. data/lib/genevalidator/validation_gene_merge.rb +11 -9
  39. data/lib/genevalidator/validation_length_cluster.rb +8 -11
  40. data/lib/genevalidator/validation_length_rank.rb +5 -4
  41. data/lib/genevalidator/validation_open_reading_frame.rb +5 -5
  42. data/lib/genevalidator/version.rb +1 -1
  43. data/test/test_all_validations.rb +2 -1
  44. data/test/test_blast.rb +4 -3
  45. data/test/test_extended_array_methods.rb +2 -1
  46. data/test/{test_sequences.rb → test_query.rb} +5 -23
  47. data/test/test_validation_open_reading_frame.rb +7 -7
  48. data/test/test_validations.rb +8 -6
  49. metadata +16 -16
  50. data/aux/app_template_footer.erb +0 -1
  51. data/aux/app_template_header.erb +0 -12
  52. data/aux/files/js/plots.js +0 -828
  53. data/aux/files/js/script.js +0 -71
  54. data/lib/genevalidator/sequences.rb +0 -101
@@ -1,71 +0,0 @@
1
- //sort table
2
- $(function(){
3
- 'use strict';
4
-
5
- // add custom parser to make the stars column to sort according to attr.
6
- $.tablesorter.addParser({
7
- id: 'star_scores', // called later when init the tablesorter
8
- is: function() {
9
- return false; // return false so this parser is not auto detected
10
- },
11
- format: function(s, table, cell, cellIndex) {
12
- var $cell = $(cell);
13
- if (cellIndex === 1) {
14
- return $cell.attr('data-score') || s;
15
- }
16
- return s;
17
- },
18
- parsed: false,
19
- type: 'numeric' // Setting type of data...
20
- });
21
-
22
- $('table').tablesorter({
23
- headers: {
24
- 1 : { sorter: 'star_scores' } // Telling it to use custom parser...
25
- },
26
- sortList: [[0,0]],
27
- });
28
- });
29
-
30
-
31
- //ToolTip
32
- $(function () {
33
- 'use strict';
34
- $("[data-toggle='tooltip']").tooltip();
35
- });
36
-
37
- //Hide empty columns
38
- $(document).ready(function() {
39
- 'use strict';
40
- if (window.chrome && (window.location.protocol === 'file:') ) {
41
- $('#browseralert').modal();
42
- }
43
-
44
-
45
- $('#sortable_table tr th').each(function(i) {
46
- //select all tds in this column
47
- var tds = $(this).parents('table')
48
- .find('tr td:nth-child(' + (i + 1) + ')');
49
- //check if all the cells in this column are empty
50
- //
51
- if ($(this).hasClass('chart-column')) {
52
- } else {
53
- if ($(this).text().trim() === '') {
54
- //hide header
55
- $(this).hide();
56
- //hide cells
57
- tds.hide();
58
- }
59
- }
60
- });
61
- });
62
-
63
- $( document ).on( "click", "td, .plot_btn", function( event ) {
64
- if ($(this).hasClass('success') || $(this).hasClass('danger')){
65
- var title = $(this).attr('title');
66
- var val = title.replace(/[ \/]/g, '');
67
- addData(this, val);
68
- } else if ($(this).hasClass('plot_btn')){
69
- addData(this, 'all');
70
- }
71
- });
@@ -1,101 +0,0 @@
1
- require 'net/http'
2
- require 'io/console'
3
- require 'yaml'
4
-
5
- module GeneValidator
6
- # This is a class for the storing data on each sequence
7
- class Sequence
8
- attr_accessor :type # protein | mRNA
9
- attr_accessor :definition
10
- attr_accessor :identifier
11
- attr_accessor :species
12
- attr_accessor :accession_no
13
- attr_accessor :length_protein
14
- attr_accessor :reading_frame
15
- attr_accessor :hsp_list # array of Hsp objects
16
-
17
- attr_accessor :raw_sequence
18
- attr_accessor :protein_translation # used only for nucleotides
19
- attr_accessor :nucleotide_rf # used only for nucleotides
20
-
21
- def initialize
22
- @hsp_list = []
23
- @raw_sequence = nil
24
- @protein_translation = nil
25
- @nucleotide_rf = nil
26
- end
27
-
28
- def protein_translation
29
- (@type == :protein) ? raw_sequence : @protein_translation
30
- end
31
-
32
- ##
33
- # Gets raw sequence by fasta identifier from a fasta index file
34
- # Params:
35
- # +raw_seq_file+: name of the fasta file with raw sequences
36
- # +index_file_name+: name of the fasta index file
37
- # +identifier+: String
38
- # +hash+: String - loaded content of the index file
39
- # Output:
40
- # String with the nucleotide sequence corresponding to the identifier
41
- def get_sequence_from_index_file(raw_seq_file, index_file_name, identifier,
42
- hash = nil)
43
- hash = YAML.load_file(index_file_name) if hash.nil?
44
- idx = hash[identifier]
45
- query = IO.binread(raw_seq_file, idx[1] - idx[0], idx[0])
46
- parse_query = query.scan(/>([^\n]*)\n([A-Za-z\n]*)/)[0]
47
- @raw_sequence = parse_query[1].gsub("\n", '')
48
- rescue Exception
49
- # $stderr.print "Unable to retrieve raw sequence for the following" \
50
- # "id: #{identifier}\n"
51
- end
52
-
53
- ##
54
- # Gets raw sequence by accession number from a givem database
55
- # Params:
56
- # +accno+: accession number as String
57
- # +db+: database as String
58
- # Output:
59
- # String with the nucleotide sequence corresponding to the accno
60
- def get_sequence_by_accession_no(accno, dbtype, db)
61
- if db !~ /remote/
62
- blast_cmd = "blastdbcmd -entry '#{accno}' -db '#{db}' -outfmt '%s'"
63
- seq = `#{blast_cmd} 2>&1`
64
- if /Error/ =~ seq
65
- fail IOError, 'GeneValidator was unable to obtain the raw sequences' \
66
- ' for the BLAST hits.'
67
- end
68
- @raw_sequence = seq
69
- else
70
- $stderr.puts "Getting sequence for '#{accno}' from NCBI - avoid this with '-r'."
71
- uri = 'http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?'\
72
- "db=#{dbtype}&retmax=1&usehistory=y&term=#{accno}/"
73
- result = Net::HTTP.get(URI.parse(uri))
74
-
75
- query = result.scan(%r{<\bQueryKey\b>([\w\W\d]+)</\bQueryKey\b>})[0][0]
76
- web_env = result.scan(%r{<\bWebEnv\b>([\w\W\d]+)</\bWebEnv\b>})[0][0]
77
-
78
- uri = 'http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?'\
79
- "rettype=fasta&retmode=text&retstart=0&retmax=1&db=#{dbtype}" \
80
- "&query_key=#{query}&WebEnv=#{web_env}"
81
- result = Net::HTTP.get(URI.parse(uri))
82
-
83
- # parse FASTA output
84
- nl = result.index("\n")
85
- seq = result[nl + 1..-1]
86
- @raw_sequence = seq.gsub!(/\n/, '')
87
- @raw_sequence = '' unless @raw_sequence.index(/ERROR/).nil?
88
- end
89
- @raw_sequence
90
- end
91
-
92
- ##
93
- # Initializes the corresponding attribute of the sequence
94
- # with respect to the column name of the tabular blast output
95
- def init_tabular_attribute(hash)
96
- @identifier = hash['sseqid'] if hash['sseqid']
97
- @accession_no = hash['sacc'] if hash['sacc']
98
- @length_protein = hash['slen'].to_i if hash['slen']
99
- end
100
- end
101
- end