genfrag 0.0.0.2 → 0.0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +0 -9
- data/README.rdoc +6 -1
- data/Rakefile +3 -2
- data/lib/genfrag.rb +1 -1
- data/lib/genfrag/app.rb +3 -7
- data/lib/genfrag/app/command.rb +5 -5
- data/lib/genfrag/app/index_command.rb +1 -1
- data/lib/genfrag/app/index_command/db.rb +2 -2
- data/lib/genfrag/app/search_command.rb +5 -5
- data/lib/genfrag/app/search_command/process_file.rb +2 -2
- data/spec/data/index_command/out/a.fasta.db +0 -0
- data/spec/data/index_command/out/a.fasta.tdf +1 -1
- data/spec/genfrag/app/search_command/process_file_spec.rb +1 -1
- data/spec/genfrag_spec.rb +5 -1
- data/tasks/setup.rb +1 -1
- data/tasks/zentest.rake +36 -0
- metadata +7 -6
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -2,6 +2,7 @@ Genfrag version 0.0.0.2
|
|
2
2
|
by Pjotr Prins and Trevor Wennblom
|
3
3
|
http://genfrag.rubyforge.org
|
4
4
|
http://rubyforge.org/projects/genfrag/
|
5
|
+
http://github.com/trevor/genfrag/
|
5
6
|
|
6
7
|
|
7
8
|
== DESCRIPTION:
|
@@ -24,7 +25,11 @@ This works
|
|
24
25
|
|
25
26
|
== REQUIREMENTS:
|
26
27
|
|
27
|
-
*
|
28
|
+
* bio
|
29
|
+
|
30
|
+
|
31
|
+
=== Optional
|
32
|
+
|
28
33
|
* sqlite3-ruby
|
29
34
|
|
30
35
|
|
data/Rakefile
CHANGED
@@ -24,12 +24,13 @@ PROJ.authors = 'Pjotr Prins and Trevor Wennblom'
|
|
24
24
|
PROJ.email = 'trevor@corevx.com'
|
25
25
|
PROJ.url = 'http://genfrag.rubyforge.org'
|
26
26
|
PROJ.version = Genfrag::VERSION
|
27
|
-
PROJ.release_name = '
|
27
|
+
PROJ.release_name = ''
|
28
28
|
PROJ.ruby_opts = %w[-W0]
|
29
29
|
PROJ.readme_file = 'README.rdoc'
|
30
30
|
PROJ.ignore_file = '.gitignore'
|
31
31
|
PROJ.exclude << 'genfrag.gemspec'
|
32
32
|
PROJ.exclude << '.git'
|
33
|
+
PROJ.dependencies = ['bio']
|
33
34
|
|
34
35
|
PROJ.rubyforge.name = 'genfrag'
|
35
36
|
|
@@ -46,7 +47,7 @@ task 'ann:prereqs' do
|
|
46
47
|
PROJ.name = 'Genfrag'
|
47
48
|
end
|
48
49
|
|
49
|
-
depend_on '
|
50
|
+
depend_on 'bio'
|
50
51
|
depend_on 'rake'
|
51
52
|
|
52
53
|
|
data/lib/genfrag.rb
CHANGED
data/lib/genfrag/app.rb
CHANGED
@@ -4,18 +4,14 @@ else
|
|
4
4
|
require 'rubygems'
|
5
5
|
end
|
6
6
|
|
7
|
-
begin
|
8
|
-
require 'sqlite3'
|
9
|
-
rescue LoadError
|
10
|
-
$stderr.print "Warning: no sqlite installed"
|
11
|
-
end
|
12
|
-
|
13
7
|
require 'fileutils'
|
14
8
|
require 'optparse'
|
15
9
|
require 'ostruct'
|
16
|
-
require 'bio'
|
17
10
|
require 'csv'
|
18
11
|
|
12
|
+
require 'bio'
|
13
|
+
#autoload :SQLite3, 'sqlite3' # => no such file to load -- sqlite3 (LoadError)
|
14
|
+
require 'sqlite3'
|
19
15
|
|
20
16
|
module Genfrag
|
21
17
|
class App
|
data/lib/genfrag/app/command.rb
CHANGED
@@ -50,15 +50,15 @@ class Command
|
|
50
50
|
def standard_options
|
51
51
|
{
|
52
52
|
:verbose => ['-v', '--verbose', 'enable verbose output',
|
53
|
-
lambda {
|
53
|
+
lambda { |ruby19bug|
|
54
54
|
options[:verbose] = true
|
55
55
|
}],
|
56
56
|
:tracktime => ['-m', '--tracktime', 'track execution time',
|
57
|
-
lambda {
|
57
|
+
lambda { |ruby19bug|
|
58
58
|
options[:tracktime] = true
|
59
59
|
}],
|
60
60
|
:quiet => ['-q', '--quiet', 'silence output',
|
61
|
-
lambda {
|
61
|
+
lambda { |ruby19bug|
|
62
62
|
options[:quiet] = true
|
63
63
|
}],
|
64
64
|
:indir => ['-i', '--in DIR', String, 'input directory', "(default #{Dir.pwd})",
|
@@ -77,8 +77,8 @@ class Command
|
|
77
77
|
lambda { |value|
|
78
78
|
options[:re3] = value
|
79
79
|
}],
|
80
|
-
:sqlite => ['-t', '--sqlite', 'use sqlite', '(default is
|
81
|
-
lambda {
|
80
|
+
:sqlite => ['-t', '--sqlite', 'use sqlite', '(default is tab-delimited)',
|
81
|
+
lambda { |ruby19bug|
|
82
82
|
options[:sqlite] = true
|
83
83
|
}],
|
84
84
|
:filelookup => ['-l', '--lookup FILE', String, "name of the frequency lookup file generated by 'index'",
|
@@ -64,11 +64,11 @@ class IndexCommand < Command
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def write_entry_to_fasta_sqlite(normalized_fasta_id, seq, definitions)
|
67
|
-
@normalized_fasta.execute( "insert into db_normalized_fasta values ( ?, ?, ? )", normalized_fasta_id,
|
67
|
+
@normalized_fasta.execute( "insert into db_normalized_fasta values ( ?, ?, ? )", normalized_fasta_id, definitions.join('!!-genfrag-!!'), seq )
|
68
68
|
end
|
69
69
|
|
70
70
|
def write_entry_to_fasta_csv(normalized_fasta_id, seq, definitions)
|
71
|
-
@normalized_fasta.puts [normalized_fasta_id,
|
71
|
+
@normalized_fasta.puts [normalized_fasta_id,definitions.join('!!-genfrag-!!'),seq].join("\t")
|
72
72
|
end
|
73
73
|
|
74
74
|
|
@@ -3,7 +3,6 @@ module Genfrag
|
|
3
3
|
class App
|
4
4
|
|
5
5
|
class SearchCommand < Command
|
6
|
-
|
7
6
|
def cli_run( args )
|
8
7
|
parse args
|
9
8
|
|
@@ -23,8 +22,8 @@ class SearchCommand < Command
|
|
23
22
|
end
|
24
23
|
|
25
24
|
if options[:fileadapters]
|
26
|
-
|
27
|
-
|
25
|
+
processed_adapters = SearchCommand::ProcessFile.process_tdf_adapters( IO.readlines( Genfrag.name_adapters(options[:fileadapters]) + '.tdf' ), options[:named_adapter5], options[:named_adapter3] )
|
26
|
+
end
|
28
27
|
|
29
28
|
run(options, processed_fasta_file, processed_freq_lookup, processed_adapters, true)
|
30
29
|
end
|
@@ -252,7 +251,7 @@ END
|
|
252
251
|
next if !good
|
253
252
|
end
|
254
253
|
|
255
|
-
results << {:raw_frag => raw_frag, :primary_frag => primary_frag, :primary_frag_with_adapters => primary_frag_with_adapters, :complement_frag => complement_frag, :complement_frag_with_adapters => complement_frag_with_adapters, :entry => entry, :seq => seq}
|
254
|
+
results << {:raw_frag => raw_frag, :primary_frag => primary_frag, :primary_frag_with_adapters => primary_frag_with_adapters, :complement_frag => complement_frag, :complement_frag_with_adapters => complement_frag_with_adapters, :entry => entry, :seq => seq, :definitions => @sequences[entry[:fasta_id]][:definitions]}
|
256
255
|
end
|
257
256
|
end
|
258
257
|
|
@@ -265,6 +264,7 @@ END
|
|
265
264
|
raise "shouldn't happen" if sorted_results[r[:seq]] != nil
|
266
265
|
sorted_results[r[:seq]] = {}
|
267
266
|
x = sorted_results[r[:seq]]
|
267
|
+
x['fasta definition'] = r[:definitions]
|
268
268
|
x['sequence size'] = r[:seq].size
|
269
269
|
x['fragment - primary strand'] = r[:primary_frag]
|
270
270
|
x['fragment - complement strand'] = r[:complement_frag]
|
@@ -273,7 +273,7 @@ END
|
|
273
273
|
end
|
274
274
|
|
275
275
|
if @ops.verbose
|
276
|
-
ary = ['sequence size', 'fragment - primary strand', 'fragment - complement strand',
|
276
|
+
ary = ['fasta definition', 'sequence size', 'fragment - primary strand', 'fragment - complement strand',
|
277
277
|
'fragment with adapters - primary strand', 'fragment with adapters - complement strand']
|
278
278
|
else
|
279
279
|
ary = ['fragment with adapters - primary strand', 'fragment with adapters - complement strand']
|
@@ -13,7 +13,7 @@ class SearchCommand < Command
|
|
13
13
|
f_normalized_fasta[1..-1].each do |line|
|
14
14
|
line = line.chomp.split("\t")
|
15
15
|
id = line[0].to_i
|
16
|
-
sequences[id] = {:definitions =>
|
16
|
+
sequences[id] = {:definitions => line[1].split('!!-genfrag-!!'), :sequence => line[2]}
|
17
17
|
end
|
18
18
|
return sequences
|
19
19
|
end
|
@@ -23,7 +23,7 @@ class SearchCommand < Command
|
|
23
23
|
sequences = {}
|
24
24
|
db_normalized_fasta.execute( "select * from db_normalized_fasta" ) do |row|
|
25
25
|
id = row[0].to_i
|
26
|
-
sequences[id] = {:definitions =>
|
26
|
+
sequences[id] = {:definitions => row[1].split('!!-genfrag-!!'), :sequence => row[2]}
|
27
27
|
end
|
28
28
|
return sequences
|
29
29
|
end
|
Binary file
|
@@ -2,5 +2,5 @@ id Definitions Sequence
|
|
2
2
|
1 At1g65300: mRNA 837bp atgaagagaaagatgaagttatcgttaatagaaaacagtgtatcgaggaaaacaacattcaccaaaaggaagaaagggatgacgaagaaactaaccgagctagtcactctatgtggtgttgaagcatgtgcggtcgtctatagtccgttcaactcgatcccggaggcttggccgtcaagggaaggcgttgaagacgtggtgtcgaaatttatggagttgtcggtgttggaccggaccaagaagatggtggatcaagagacttttataagtcaaaggatcgccaaagaaaaagagcagctgcagaagctacgtgatgagaaccataattctcagattcgggagttaatgtttggttgtctcaaaggggagacgaatgtgtataatcttgatggaagggatcttcaagatttgagtttatatattgataagtatcttaatggtcttactcgcaggattgagatcctTAttgagaacggtgagtcttcttcatctttacctcttcctattgttgcgaatgcagctgcaccagtcggatttgatggtcctatgtttcaatatcataatcaaaatcagcaaaagccggttcaattccaatatcaggctctttatgatttttatgatcagattccaaagaaaattcatggttttaatatgaatatgaataaggattcgaatcaaagtatggttttggatttgaatcaaaatcttaatgatggagaggacgagggcattccttgcatggacaacaacaactaccaccccgaaatcgattgtctcgctaccgtcaccactgcccccactgatgtttgtgctcctaacatcaccaatgatctctag
|
3
3
|
2 At1g65300: mRNA 837bp (shortened at end) atgaagagaaagatgaagttatcgttaatagaaaacagtgtatcgaggaaaacaacattcaccaaaaggaagaaagggatgacgaagaaactaaccgagctagtcactctatgtggtgttgaagcatgtgcggtcgtctatagtccgttcaactcgatcccggaggcttggccgtcaagggaaggcgttgaagacgtggtgtcgaaatttatggagttgtcggtgttggaccggaccaagaagatggtggatcaagagacttttataagtcaaaggatcgccaaagaaaaagagcagctgcagaagctacgtgatgagaaccataattctcagattcgggagttaatgtttggttgtctcaaaggggagacgaatgtgtataatcttgatggaagggatcttcaagatttgagtttatatattgataagtatcttaatggtcttactcgcaggattgagatcctTAttgagaacggtgagtcttcttcatctttacctcttcctattgttgcgaatgcagctgcaccagtcggatttgatggtcctatgtttcaatatcataatcaaaatcagcaaaagccggttcaattccaatatcaggctctttatgatttttatgatcag
|
4
4
|
3 At1g65300: mRNA 837bp (shortened from start) ttcatctttacctcttcctattgttgcgaatgcagctgcaccagtcggatttgatggtcctatgtttcaatatcataatcaaaatcagcaaaagccggttcaattccaatatcaggctctttatgatttttatgatcagattccaaagaaaattcatggttttaatatgaatatgaataaggattcgaatcaaagtatggttttggatttgaatcaaaatcttaatgatggagaggacgagggcattccttgcatggacaacaacaactaccaccccgaaatcgattgtctcgctaccgtcaccactgcccccactgatgtttgtgctcctaacatcaccaatgatctctag
|
5
|
-
4 At1g02580 mRNA (2291 bp) UTR's and CDS
|
5
|
+
4 At1g02580 mRNA (2291 bp) UTR's and CDS!!-genfrag-!!At1g02580 mRNA (2291 bp) UTR's and CDS (duplicate) aggcgagtggttaatggagaaggaaaaccatgaggacgatggtgagggtttgccacccgaactaaatcagataaaagagcaaatcgaaaaggagagatttctgcatatcaagagaaaattcgagctgagatacattccaagtgtggctactcatgcttcacaccatcaatcgtttgacttaaaccagcccgctgcagaggatgataatggaggagacaacaaatcacttttgtcgagaatgcaaaacccacttcgtcatttcagtgcctcatctgattataattcttacgaagatcaaggttatgttcttgatgaggatcaagattatgctcttgaagaagatgtaccattatttcttgatgaagatgtaccattattaccaagtgtcaagcttccaattgttgagaagctaccacgatccattacatgggtcttcaccaaaagtagccagctgatggctgaaagtgattctgtgattggtaagagacaaatctattatttgaatggtgaggcactagaattgagcagtgaagaagatgaggaagatgaagaagaagatgaggaagaaatcaagaaagaaaaatgcgaattttctgaagatgtagaccgatttatatggacggttgggcaggactatggtttggatgatctggtcgtgcggcgtgctctcgccaagtacctcgaagtggatgtttcggacatattggaaagatacaatgaactcaagcttaagaatgatggaactgctggtgaggcttctgatttgacatccaagacaataactactgctttccaggattttgctgatagacgtcattgccgtcgttgcatgatattcgattgtcatatgcatgagaagtatgagcccgagtctagatccagcgaagacaaatctagtttgtttgaggatgaagatagacaaccatgcagtgagcattgttacctcaaggtgaggagtgtgacagaagctgatcatgtgatggataatgataactctatatcaaacaagattgtggtctcagatccaaacaacactatgtggacgcctgtagagaaggatctttacttgaaaggaattgagatatttgggagaaacagttgtgatgttgcattaaacatacttcgggggcttaagacgtgcctagagatttacaattacatgcgcgaacaagatcaatgtactatgtcattagaccttaacaaaactacacaaagacacaatcaggttaccaaaaaagtatctcgaaaaagtagtaggtcggtccgcaaaaaatcgagactccgaaaatatgctcgttatccgcctgctttaaagaaaacaactagtggagaagctaagttttataagcactacacaccatgcacttgcaagtcaaaatgtggacagcaatgcccttgtttaactcacgaaaattgctgcgagaaatattgcgggtgctcaaaggattgcaacaatcgctttggaggatgtaattgtgcaattggccaatgcacaaatcgacaatgtccttgttttgctgctaatcgtgaatgcgatccagatctttgtcggagttgtcctcttagctgtggagatggcactcttggtgagacaccagtgcaaatccaatgcaagaacatgcaattcctccttcaaaccaataaaaagattctcattggaaagtctgatgttcatggatggggtgcatttacatgggactctcttaaaaagaatgagtatctcggagaatatactggagaactgatcactcatgatgaagctaatgagcgtgggagaatagaagatcggattggttcttcctacctctttaccttgaatgatcagctcgaaatcgatgctcgccgtaaaggaaacgagttcaaatttctcaatcactcagcaagacctaactgctacgccaagttgatgattgtgagaggagatcagaggattggtctatttgcggagagagcaatcgaagaaggtgaggagcttttcttcgactactgctatggaccagaacatgcggattggtcgcgtggtcgagaacctagaaagactggtgcttctaaaaggtctaaggaagcccgtccagctcgttagtttttgatctgaggagaagcagcaattcaagcagtcctttttttatgttatggtatatcaattaataatgtaatgctattttgtgttactaaaccaaaacttaagtttctgttttatttgttttagggtgttttgtttgtatcatatgtgtcttaactttcaaagttttctttttgtatttcaatttaaaaacaatgtttatgttgtt
|
6
6
|
5 At1g02580 - shortened for test - inserted cutpoint gattgcaacaatcgctttggaggatgtaattgtgcaattggccaatgcacaaatcgacaatgtccttgttttgctgctaatcgtgaatgcgatccagatctttgtcggagttgtcctcttagctgtggagatggcactcttggtgagacaccagtgcaaatccaatgcaagaacatgcaataataaaaagattctcattggaaagtctgatgttcatggattcatggttttaattggggtgcatttacatgggactctcttaaaaagaatgagtatctcggagaatatactggagaactgatcactcatgatgaagctaatgagcgtgggagaatagaagatcggattggttcttcctacctctttaccttgaatgatca
|
@@ -51,7 +51,7 @@ describe Genfrag::App::SearchCommand::ProcessFile do
|
|
51
51
|
describe 'with an array of data' do
|
52
52
|
before :all do
|
53
53
|
ary = [ %w(id Definitions Sequence),
|
54
|
-
[1,'DescA
|
54
|
+
[1,'DescA!!-genfrag-!!DescB','seq-abc'],
|
55
55
|
[2,'DescC','seq-def'],
|
56
56
|
[3,'DescD,DescE,DescF','seq-ghi'] ]
|
57
57
|
d = ary.map {|x| x.join("\t")}
|
data/spec/genfrag_spec.rb
CHANGED
data/tasks/setup.rb
CHANGED
@@ -147,7 +147,7 @@ RCOV = "#{RUBY} -S rcov"
|
|
147
147
|
RDOC = "#{RUBY} -S rdoc"
|
148
148
|
GEM = "#{RUBY} -S gem"
|
149
149
|
|
150
|
-
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
150
|
+
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode zentest).each do |lib|
|
151
151
|
begin
|
152
152
|
require lib
|
153
153
|
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
data/tasks/zentest.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
if HAVE_ZENTEST
|
2
|
+
|
3
|
+
# --------------------------------------------------------------------------
|
4
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
5
|
+
require 'autotest'
|
6
|
+
|
7
|
+
namespace :test do
|
8
|
+
task :autotest do
|
9
|
+
Autotest.run
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run the autotest loop"
|
14
|
+
task :autotest => 'test:autotest'
|
15
|
+
|
16
|
+
end # if test
|
17
|
+
|
18
|
+
# --------------------------------------------------------------------------
|
19
|
+
if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
|
20
|
+
require 'autotest/rspec'
|
21
|
+
|
22
|
+
namespace :spec do
|
23
|
+
task :autotest do
|
24
|
+
load '.autotest' if test(?f, '.autotest')
|
25
|
+
Autotest::Rspec.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run the autotest loop"
|
30
|
+
task :autotest => 'spec:autotest'
|
31
|
+
|
32
|
+
end # if rspec
|
33
|
+
|
34
|
+
end # if HAVE_ZENTEST
|
35
|
+
|
36
|
+
# EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genfrag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pjotr Prins and Trevor Wennblom
|
@@ -9,18 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-06 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: bio
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 1.3.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.
|
33
|
+
version: 0.8.4
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: bones
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.5.1
|
44
44
|
version:
|
45
45
|
description: This is a development release. Some features are functional at this time. Genfrag allows for rapid in-silico searching of fragments cut by different restriction enzymes in large nucleotide acid databases, followed by matching specificity adapters which allow a further data reduction when looking for differential expression of genes and markers.
|
46
46
|
email: trevor@corevx.com
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- tasks/spec.rake
|
102
102
|
- tasks/svn.rake
|
103
103
|
- tasks/test.rake
|
104
|
+
- tasks/zentest.rake
|
104
105
|
has_rdoc: true
|
105
106
|
homepage: http://genfrag.rubyforge.org
|
106
107
|
post_install_message: |
|