Permalink
Browse files

update underlying bio-gem system, script now runs properly and return…

…s stuff
  • Loading branch information...
1 parent 82219d2 commit c807ef9b2e648bd677180dca864d56bdfeff9f5d Ben J Woodcroft committed May 3, 2012
Showing with 179 additions and 138 deletions.
  1. +14 −3 .gitignore
  2. +12 −0 .travis.yml
  3. +5 −4 Gemfile
  4. +1 −1 LICENSE.txt
  5. +39 −10 README.rdoc
  6. +4 −12 Rakefile
  7. +1 −1 VERSION
  8. +69 −0 bin/bio-tm_hmm
  9. +0 −72 bin/biotm_hmm
  10. +34 −35 bio-tm_hmm.gemspec
View
@@ -1,5 +1,6 @@
# rcov generated
coverage
+coverage.data
# rdoc generated
rdoc
@@ -28,15 +29,25 @@ pkg
# For MacOS:
#
#.DS_Store
-#
+
# For TextMate
#*.tmproj
#tmtags
-#
+
# For emacs:
#*~
#\#*
#.\#*
-#
+
# For vim:
#*.swp
+
+# For redcar:
+#.redcar
+
+# For rubinius:
+#*.rbc
+# Ignore Gemfile.lock for gems. See http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
+Gemfile.lock
+*.gemspec
+bin/bio-tm_hmm.rb
View
@@ -0,0 +1,12 @@
+language: ruby
+rvm:
+ - 1.9.2
+ - 1.9.3
+ - jruby-19mode # JRuby in 1.9 mode
+ - rbx-19mode
+# - 1.8.7
+# - jruby-18mode # JRuby in 1.8 mode
+# - rbx-18mode
+
+# uncomment this line if your project needs to run something other than `rake`:
+# script: bundle exec rspec spec
View
@@ -2,12 +2,13 @@ source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
-gem "bio", ">= 1.4.1"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.5.2"
- gem "rcov", ">= 0"
+ gem "shoulda", ">= 0"
+ gem "rdoc", "~> 3.12"
+ gem "jeweler", "~> 1.8.3"
+ gem "bundler", ">= 1.0.21"
+ gem "bio", ">= 1.4.2"
end
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Ben J. Woodcroft
+Copyright (c) 2012 Ben J Woodcroft
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,21 +1,50 @@
= bio-tm_hmm
+{<img
+src="https://secure.travis-ci.org/wwood/bioruby-tm_hmm.png"
+/>}[http://travis-ci.org/#!/wwood/bioruby-tm_hmm]
+
A bioruby plugin for running TMHMM automatically on multiple sequences in a FASTA file and manipulation of the results
+Note: this software is under active development!
+
+== Installation
+
+ gem install bio-tm_hmm
+
+== Usage
+
biotm_hmm -f proteome.fasta
-== Contributing to bio-tm_hmm
+== Developers
+
+To use the library
+
+ require 'bio-tm_hmm'
+
+The API doc is online. For more code examples see also the test files in
+the source tree.
+
+== Project home page
+
+Information on the source tree, documentation, issues and how to contribute, see
+
+ http://github.com/wwood/bioruby-tm_hmm
+
+The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
+
+== Cite
+
+ If you use this software, please cite one of
-* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
-* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
-* Fork the project
-* Start a feature/bugfix branch
-* Commit and push until you are happy with your contribution
-* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
-* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
+* [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
+* [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
+
+== Biogems.info
+
+This Biogem is published at http://biogems.info/index.html#bio-tm_hmm
== Copyright
-Copyright (c) 2011 Ben J. Woodcroft. See LICENSE.txt for
-further details.
+Copyright (c) 2012 Ben J Woodcroft. See LICENSE.txt for further details.
View
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
require 'rubygems'
require 'bundler'
begin
@@ -19,10 +21,7 @@ Jeweler::Tasks.new do |gem|
gem.description = %Q{A bioruby plugin for interaction with the transmembrane predictor TMHMM}
gem.email = "donttrustben@gmail.com"
gem.authors = ["Ben J. Woodcroft"]
- # Include your dependencies below. Runtime dependencies are required when using your gem,
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
- # gem.add_development_dependency 'rspec', '> 1.2.3'
+ # dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new
@@ -33,16 +32,9 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
-require 'rcov/rcovtask'
-Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
-end
-
task :default => :test
-require 'rake/rdoctask'
+require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
View
@@ -1 +1 @@
-0.2.0
+0.0.0
View
@@ -0,0 +1,69 @@
+#!/usr/bin/env ruby
+
+# Author:: Ben J. Woodcroft
+# Copyright:: 2011
+# License:: The Ruby License
+
+require 'rubygems'
+require 'bio'
+require 'bio-tm_hmm'
+require 'optparse'
+
+# If being run directly instead of being require'd,
+# output one transmembrane per line, and
+# indicate that a particular protein has no transmembrane domain
+options = {
+ :filter_in => false,
+ :filter_out => false,
+}
+o = OptionParser.new do |opts|
+ opts.banner = [
+ 'Usage: tm_hmm_wrapper.rb [-fg] [fasta_filename]',
+ "\tfasta file can also be piped in on STDIN.",
+ "\twithout arguments, a description of the transmembranes is printed out for each input sequence"
+ ]
+ opts.on('-f','--filter-in [MIN_TRANSMEMBRANE_DOMAINS]','Print those sequences that have a transmembrane domain. If MIN_TRANSMEMBRANE_DOMAINS is defined, only those proteins with that many TMDs or more are printed out') do |m|
+ options[:filter_in] = m.to_i #gets set to 0 when optional MIN_TRANSMEMBRANE_DOMAINS is omitted
+ end
+ opts.on('-g','--filter-out [MIN_TRANSMEMBRANE_DOMAINS]','Print those sequences that do NOT have a transmembrane domain. If MIN_TRANSMEMBRANE_DOMAINS is defined, only those proteins with that many TMDs or more are filtered out') do |m|
+ options[:filter_out] = m.to_i #gets set to 0 when optional MIN_TRANSMEMBRANE_DOMAINS is omitted
+ end
+end
+o.parse!
+
+runner = Bio::TMHMM::TmHmmWrapper.new
+
+Bio::FlatFile.auto(ARGF).each do |seq|
+ result = runner.calculate(seq.seq)
+ name = seq.definition
+
+ # Default output - a description of the TMDs for each input aaseq
+ if options[:filter_in] == false and options[:filter_out] == false
+ if result.has_domain?
+ # At least one TMD found. Output each on a separate line
+ result.transmembrane_domains.each do |tmd|
+ puts [
+ name,
+ result.transmembrane_type,
+ tmd.start,
+ tmd.stop,
+ tmd.orientation
+ ].join("\t")
+ end
+ else
+ puts [
+ name,
+ 'No Transmembrane Domain Found'
+ ].join("\t")
+ end
+
+ elsif options[:filter_in] != false
+ if result.transmembrane_domains.length >= options[:filter_in]
+ puts seq
+ end
+ elsif options[:filter_out] != false
+ unless result.transmembrane_domains.length >= options[:filter_out]
+ puts seq
+ end
+ end
+end
View
@@ -1,72 +0,0 @@
-#!/usr/bin/env ruby
-
-# Author:: Ben J. Woodcroft
-# Copyright:: 2011
-# License:: The Ruby License
-
-require 'rubygems'
-require 'bio'
-require 'bio-tm_hmm'
-require 'optparse'
-
-# If being run directly instead of being require'd,
-# output one transmembrane per line, and
-# indicate that a particular protein has no transmembrane domain
-if $0 == __FILE__
- options = {
- :filter_in => false,
- :filter_out => false,
- }
- o = OptionParser.new do |opts|
- opts.banner = [
- 'Usage: tm_hmm_wrapper.rb [-fg] [fasta_filename]',
- "\tfasta file can also be piped in on STDIN.",
- "\twithout arguments, a description of the transmembranes is printed out for each input sequence"
- ]
- opts.on('-f','--filter-in [MIN_TRANSMEMBRANE_DOMAINS]','Print those sequences that have a transmembrane domain. If MIN_TRANSMEMBRANE_DOMAINS is defined, only those proteins with that many TMDs or more are printed out') do |m|
- options[:filter_in] = m.to_i #gets set to 0 when optional MIN_TRANSMEMBRANE_DOMAINS is omitted
- end
- opts.on('-g','--filter-out [MIN_TRANSMEMBRANE_DOMAINS]','Print those sequences that do NOT have a transmembrane domain. If MIN_TRANSMEMBRANE_DOMAINS is defined, only those proteins with that many TMDs or more are filtered out') do |m|
- options[:filter_out] = m.to_i #gets set to 0 when optional MIN_TRANSMEMBRANE_DOMAINS is omitted
- end
- end
- o.parse!
-
- runner = Bio::TMHMM::TmHmmWrapper.new
-
- Bio::FlatFile.auto(ARGF).each do |seq|
- result = runner.calculate(seq.seq)
- name = seq.definition
-
- # Default output - a description of the TMDs for each input aaseq
- if options[:filter_in] == false and options[:filter_out] == false
- if result.has_domain?
- # At least one TMD found. Output each on a separate line
- result.transmembrane_domains.each do |tmd|
- puts [
- name,
- result.transmembrane_type,
- tmd.start,
- tmd.stop,
- tmd.orientation
- ].join("\t")
- end
- else
- puts [
- name,
- 'No Transmembrane Domain Found'
- ].join("\t")
- end
-
- elsif options[:filter_in] != false
- if result.transmembrane_domains.length >= options[:filter_in]
- puts seq
- end
- elsif options[:filter_out] != false
- unless result.transmembrane_domains.length >= options[:filter_out]
- puts seq
- end
- end
- end
-end
-
Oops, something went wrong.

0 comments on commit c807ef9

Please sign in to comment.