fasta_util 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/fasta_util +17 -0
  3. data/fasta_util.gemspec +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
data/bin/fasta_util CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'thor'
3
3
  require 'bio'
4
+ require 'set'
4
5
 
5
6
  class FastaUtility < Thor
6
7
  include Thor::Actions
@@ -88,5 +89,21 @@ class FastaUtility < Thor
88
89
  puts entry
89
90
  end
90
91
  end
92
+
93
+ desc "composition FILENAME [options]", "Outputs data on the sequence composition"
94
+ def composition(filename)
95
+ invoke :filecheck
96
+ composition_hash = Hash[Bio::FlatFile.open(filename).map{|entry| [entry.definition, entry.seq.composition]}]
97
+
98
+ all_chars = composition_hash.values.map{|h| h.keys}.inject(:+).to_set
99
+
100
+ puts "definition\t#{all_chars.to_a.join("\t")}"
101
+ composition_hash.each do |definition, composition|
102
+ composition.default = 0
103
+ print definition, "\t"
104
+ puts all_chars.map{|char| composition[char]}.join("\t")
105
+ end
106
+ end
91
107
  end
108
+
92
109
  FastaUtility.start
data/fasta_util.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fasta_util}
8
- s.version = "0.2.3"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["robsyme"]
12
- s.date = %q{2011-03-09}
12
+ s.date = %q{2011-05-09}
13
13
  s.default_executable = %q{fasta_util}
14
14
  s.description = %q{Easy fasta filtering, wrapping, calculating common statistics, sorting etc. Based on the fasta_tool script that I think was written by Jason Stajich.}
15
15
  s.email = %q{rob.syme@gmail.com}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fasta_util
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.3
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - robsyme
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-09 00:00:00 +08:00
13
+ date: 2011-05-09 00:00:00 +08:00
14
14
  default_executable: fasta_util
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
- hash: 1980362110866900024
128
+ hash: -421712537586483233
129
129
  segments:
130
130
  - 0
131
131
  version: "0"