Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
biotm_hmm is now the script name, and added some README
- Loading branch information
Ben J Woodcroft
committed
Apr 3, 2011
1 parent
96e8386
commit 6cabb16
Showing
3 changed files
with
58 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,76 +1,72 @@ | |||
#!/usr/bin/env ruby | #!/usr/bin/env ruby | ||
# |
|
||
# BioRuby bio-tm_hmm Plugin | |||
# Version 0.0.0 | |||
# Author:: Ben J. Woodcroft | # Author:: Ben J. Woodcroft | ||
# Copyright:: 2011 | # Copyright:: 2011 | ||
# License:: The Ruby License | # License:: The Ruby License | ||
|
|
||
USAGE = "Describe biotm_hmm" | require 'rubygems' | ||
|
require 'bio' | ||
if ARGV.size == 0 | |||
print USAGE | |||
end | |||
|
|||
require 'bio-tm_hmm' | require 'bio-tm_hmm' | ||
require 'optparse' | require 'optparse' | ||
|
|
||
# Uncomment when using the bio-logger | # If being run directly instead of being require'd, | ||
# require 'bio-logger' | # output one transmembrane per line, and | ||
# Bio::Log::CLI.logger('stderr') | # indicate that a particular protein has no transmembrane domain | ||
# Bio::Log::CLI.trace('info') | 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','Print those sequences that have a transmembrane domain') do | |||
options[:filter_in] = true | |||
end | |||
opts.on('-g','--filter-out','Print those sequences that do NOT have a transmembrane domain') do | |||
options[:filter_out] = true | |||
end | |||
end | |||
o.parse! | |||
|
|
||
options = {:example_switch=>false,:show_help=>false} | runner = Bio::TMHMM::TmHmmWrapper.new | ||
opts = OptionParser.new do |o| | |||
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem" | |||
|
|
||
o.on('--example_parameter [EXAMPLE_PARAMETER]', 'TODO: put a description for the PARAMETER') do |example_parameter| | Bio::FlatFile.auto(ARGF).each do |seq| | ||
# TODO: your logic here, below an example | result = runner.calculate(seq.seq) | ||
options[:example_parameter] = 'this is a parameter' | name = seq.definition | ||
end | |||
|
|||
o.separator "" | |||
o.on("--switch-example", 'TODO: put a description for the SWITCH') do | |||
# TODO: your logic here, below an example | |||
self[:example_switch] = true | |||
end | |||
|
|
||
# Uncomment the following when using the bio-logger | # Default output - a description of the TMDs for each input aaseq | ||
# o.separator "" | if options[:filter_in] == false and options[:filter_out] == false | ||
# o.on("--logger filename",String,"Log to file (default stderr)") do | name | | if result.has_domain? | ||
# Bio::Log::CLI.logger(name) | # At least one TMD found. Output each on a separate line | ||
# end | result.transmembrane_domains.each do |tmd| | ||
# | puts [ | ||
# o.on("--trace options",String,"Set log level (default INFO, see bio-logger)") do | s | | name, | ||
# Bio::Log::CLI.trace(s) | result.transmembrane_type, | ||
# end | tmd.start, | ||
# | tmd.stop, | ||
# o.on("-q", "--quiet", "Run quietly") do |q| | tmd.orientation | ||
# Bio::Log::CLI.trace('error') | ].join("\t") | ||
# end | end | ||
# | else | ||
# o.on("-v", "--verbose", "Run verbosely") do |v| | puts [ | ||
# Bio::Log::CLI.trace('info') | name, | ||
# end | 'No Transmembrane Domain Found' | ||
# | ].join("\t") | ||
# o.on("--debug", "Show debug messages") do |v| | end | ||
# Bio::Log::CLI.trace('debug') | |||
# end | |||
|
|
||
o.separator "" | elsif options[:filter_in] | ||
o.on_tail('-h', '--help', 'display this help and exit') do | if result.has_domain? | ||
options[:show_help] = true | puts seq | ||
end | |||
elsif options[:filter_out] | |||
unless result.has_domain? | |||
puts seq | |||
end | |||
end | |||
end | end | ||
end | end | ||
|
|
||
begin | |||
opts.parse!(ARGV) | |||
|
|||
# Uncomment the following when using the bio-logger | |||
# Bio::Log::CLI.configure('bio-tm_hmm') | |||
|
|||
# TODO: your code here | |||
# use options for your logic | |||
rescue OptionParser::InvalidOption => e | |||
options[:invalid_argument] = e.message | |||
end |
This file was deleted.
Oops, something went wrong.