bio-gff3-pltools 0.2.0 → 0.3.0
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/README.md +2 -2
- data/VERSION +1 -1
- data/lib/bio-gff3-pltools/filtering.rb +115 -8
- data/lib/bio-gff3-pltools/validation.rb +3 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -56,7 +56,7 @@ require the library:
|
|
56
56
|
|
57
57
|
The API docs are online:
|
58
58
|
|
59
|
-
http://mamarjan.github.com/
|
59
|
+
http://mamarjan.github.com/gff3-pltools/docs/0.3.0/ruby-api/
|
60
60
|
|
61
61
|
For more code examples see the test files in the source tree.
|
62
62
|
|
@@ -64,7 +64,7 @@ For more code examples see the test files in the source tree.
|
|
64
64
|
|
65
65
|
Project home page can be found at the following location:
|
66
66
|
|
67
|
-
http://mamarjan.github.com/
|
67
|
+
http://mamarjan.github.com/gff3-pltools/
|
68
68
|
|
69
69
|
For information on the source tree, issues and
|
70
70
|
how to contribute, see
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -3,7 +3,8 @@ module Bio
|
|
3
3
|
module GFF3
|
4
4
|
# Runs the gff3-ffetch utility with the specified parameters on
|
5
5
|
# an external file. Options include :output, :at_most,
|
6
|
-
# :
|
6
|
+
# :keep_fasta, :keep_comments, :keep_pragmas, :gtf_output,
|
7
|
+
# :json_output, :select
|
7
8
|
def self.filter_file filename, filter_string, options = {}
|
8
9
|
if !File.exists?(filename)
|
9
10
|
raise Exception.new("No such file - #{filename}")
|
@@ -17,8 +18,8 @@ module Bio
|
|
17
18
|
if !options[:at_most].nil?
|
18
19
|
at_most_option = "--at-most #{options[:at_most]}"
|
19
20
|
end
|
20
|
-
if options[:
|
21
|
-
fasta_option = "--
|
21
|
+
if options[:keep_fasta]
|
22
|
+
fasta_option = "--keep-fasta"
|
22
23
|
end
|
23
24
|
if options[:keep_comments]
|
24
25
|
comments_option = "--keep-comments"
|
@@ -26,7 +27,17 @@ module Bio
|
|
26
27
|
if options[:keep_pragmas]
|
27
28
|
pragmas_option = "--keep-pragmas"
|
28
29
|
end
|
29
|
-
|
30
|
+
if options[:gtf_output]
|
31
|
+
gtf_output_option = "--gtf-output"
|
32
|
+
end
|
33
|
+
if options[:json_output]
|
34
|
+
json_output_option = "--json"
|
35
|
+
end
|
36
|
+
if !options[:select].nil?
|
37
|
+
select_option = "--select \"#{options[:select]}\""
|
38
|
+
end
|
39
|
+
puts "gff3-ffetch --filter \"#{filter_string}\" #{filename} #{output_option} #{at_most_option} #{fasta_option} #{comments_option} #{pragmas_option} #{gtf_output_option} #{json_output_option} #{select_option}"
|
40
|
+
gff3_ffetch = IO.popen("gff3-ffetch --filter \"#{filter_string}\" #{filename} #{output_option} #{at_most_option} #{fasta_option} #{comments_option} #{pragmas_option} #{gtf_output_option} #{json_output_option} #{select_option}")
|
30
41
|
if output_option.nil?
|
31
42
|
output = gff3_ffetch.read
|
32
43
|
end
|
@@ -36,7 +47,8 @@ module Bio
|
|
36
47
|
|
37
48
|
# Runs the gff3-ffetch utility with the specified parameters while
|
38
49
|
# passing data to its stdin. Options include :output and :at_most,
|
39
|
-
# :
|
50
|
+
# :keep_fasta, :keep_comments, :keep_pragmas, :gtf_output,
|
51
|
+
# :json_output, :select
|
40
52
|
def self.filter_data data, filter_string, options = {}
|
41
53
|
output_option = nil
|
42
54
|
output = nil
|
@@ -46,8 +58,8 @@ module Bio
|
|
46
58
|
if !options[:at_most].nil?
|
47
59
|
at_most_option = "--at-most #{options[:at_most]}"
|
48
60
|
end
|
49
|
-
if options[:
|
50
|
-
fasta_option = "--
|
61
|
+
if options[:keep_fasta]
|
62
|
+
fasta_option = "--keep-fasta"
|
51
63
|
end
|
52
64
|
if options[:keep_comments]
|
53
65
|
comments_option = "--keep-comments"
|
@@ -55,7 +67,16 @@ module Bio
|
|
55
67
|
if options[:keep_pragmas]
|
56
68
|
pragmas_option = "--keep-pragmas"
|
57
69
|
end
|
58
|
-
|
70
|
+
if options[:gtf_output]
|
71
|
+
gtf_output_option = "--gtf-output"
|
72
|
+
end
|
73
|
+
if options[:json_output]
|
74
|
+
json_output_option = "--json"
|
75
|
+
end
|
76
|
+
if !options[:select].nil?
|
77
|
+
select_option = "--select \"#{options[:select]}\""
|
78
|
+
end
|
79
|
+
gff3_ffetch = IO.popen("gff3-ffetch --filter \"#{filter_string}\" - #{output_option} #{at_most_option} #{fasta_option} #{comments_option} #{pragmas_option} #{gtf_output_option} #{json_output_option} #{select_option}", "r+")
|
59
80
|
gff3_ffetch.write data
|
60
81
|
gff3_ffetch.close_write
|
61
82
|
if output_option.nil?
|
@@ -65,6 +86,92 @@ module Bio
|
|
65
86
|
output
|
66
87
|
end
|
67
88
|
end
|
89
|
+
|
90
|
+
module GTF
|
91
|
+
# Runs the gtf-ffetch utility with the specified parameters on
|
92
|
+
# an external file. Options include :output, :at_most,
|
93
|
+
# :keep_fasta, :keep_comments, :keep_pragmas, :gff3_output,
|
94
|
+
# :json_output, :select
|
95
|
+
def self.filter_file filename, filter_string, options = {}
|
96
|
+
if !File.exists?(filename)
|
97
|
+
raise Exception.new("No such file - #{filename}")
|
98
|
+
end
|
99
|
+
|
100
|
+
output_option = nil
|
101
|
+
output = nil
|
102
|
+
if !options[:output].nil?
|
103
|
+
output_option = "--output #{options[:output]}"
|
104
|
+
end
|
105
|
+
if !options[:at_most].nil?
|
106
|
+
at_most_option = "--at-most #{options[:at_most]}"
|
107
|
+
end
|
108
|
+
if options[:keep_fasta]
|
109
|
+
fasta_option = "--keep-fasta"
|
110
|
+
end
|
111
|
+
if options[:keep_comments]
|
112
|
+
comments_option = "--keep-comments"
|
113
|
+
end
|
114
|
+
if options[:keep_pragmas]
|
115
|
+
pragmas_option = "--keep-pragmas"
|
116
|
+
end
|
117
|
+
if options[:gff3_output]
|
118
|
+
gff3_output_option = "--gff3-output"
|
119
|
+
end
|
120
|
+
if options[:json_output]
|
121
|
+
json_output_option = "--json"
|
122
|
+
end
|
123
|
+
if !options[:select].nil?
|
124
|
+
select_option = "--select \"#{options[:select]}\""
|
125
|
+
end
|
126
|
+
gff3_ffetch = IO.popen("gtf-ffetch --filter \"#{filter_string}\" #{filename} #{output_option} #{at_most_option} #{fasta_option} #{comments_option} #{pragmas_option} #{gff3_output_option} #{json_output_option} #{select_option}")
|
127
|
+
if output_option.nil?
|
128
|
+
output = gtf_ffetch.read
|
129
|
+
end
|
130
|
+
gtf_ffetch.close
|
131
|
+
output
|
132
|
+
end
|
133
|
+
|
134
|
+
# Runs the gtf-ffetch utility with the specified parameters while
|
135
|
+
# passing data to its stdin. Options include :output and :at_most,
|
136
|
+
# :keep_fasta, :keep_comments, :keep_pragmas, :gff3_output,
|
137
|
+
# :json_output, :select
|
138
|
+
def self.filter_data data, filter_string, options = {}
|
139
|
+
output_option = nil
|
140
|
+
output = nil
|
141
|
+
if !options[:output].nil?
|
142
|
+
output_option = "--output #{options[:output]}"
|
143
|
+
end
|
144
|
+
if !options[:at_most].nil?
|
145
|
+
at_most_option = "--at-most #{options[:at_most]}"
|
146
|
+
end
|
147
|
+
if options[:keep_fasta]
|
148
|
+
fasta_option = "--keep-fasta"
|
149
|
+
end
|
150
|
+
if options[:keep_comments]
|
151
|
+
comments_option = "--keep-comments"
|
152
|
+
end
|
153
|
+
if options[:keep_pragmas]
|
154
|
+
pragmas_option = "--keep-pragmas"
|
155
|
+
end
|
156
|
+
if options[:gff3_output]
|
157
|
+
gff3_output_option = "--gff3-output"
|
158
|
+
end
|
159
|
+
if options[:json_output]
|
160
|
+
json_output_option = "--json"
|
161
|
+
end
|
162
|
+
if !options[:select].nil?
|
163
|
+
select_option = "--select \"#{options[:select]}\""
|
164
|
+
end
|
165
|
+
gtf_ffetch = IO.popen("gtf-ffetch --filter \"#{filter_string}\" - #{output_option} #{at_most_option} #{fasta_option} #{comments_option} #{pragmas_option} #{gff3_output_option} #{json_output_option} #{select_option}", "r+")
|
166
|
+
gtf_ffetch.write data
|
167
|
+
gtf_ffetch.close_write
|
168
|
+
if output_option.nil?
|
169
|
+
output = gtf_ffetch.read
|
170
|
+
end
|
171
|
+
gtf_ffetch.close
|
172
|
+
output
|
173
|
+
end
|
174
|
+
end
|
68
175
|
end
|
69
176
|
end
|
70
177
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Bio
|
2
2
|
module PL
|
3
3
|
module GFF3
|
4
|
+
# Runs the gff3-validate utility with the specified filename
|
5
|
+
# as argument. Returns error messages if the utility found
|
6
|
+
# issues in the file.
|
4
7
|
def self.validate_file filename
|
5
8
|
if !File.exists?(filename)
|
6
9
|
raise Exception.new("No such file - #{filename}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-gff3-pltools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07
|
12
|
+
date: 2012-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash: -
|
171
|
+
hash: -1046642193
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|