Class: Unipept::Commands::Uniprot
Instance Attribute Summary collapse
-
#root_command ⇒ Object
readonly
Returns the value of attribute root_command.
-
#valid_formats ⇒ Object
readonly
Returns the value of attribute valid_formats.
Class Method Summary collapse
-
.get_uniprot_entry(accession, format) ⇒ String
Fetches a UniProt entry from the UniProt website with the given accession number in the requested format.
-
.run(args) ⇒ void
Invokes the uniprot command-line tool with the given arguments.
Instance Attribute Details
#root_command ⇒ Object (readonly)
Returns the value of attribute root_command.
5 6 7 |
# File 'lib/commands/uniprot.rb', line 5 def root_command @root_command end |
#valid_formats ⇒ Object (readonly)
Returns the value of attribute valid_formats.
5 6 7 |
# File 'lib/commands/uniprot.rb', line 5 def valid_formats @valid_formats end |
Class Method Details
.get_uniprot_entry(accession, format) ⇒ String
Fetches a UniProt entry from the UniProt website with the given accession number in the requested format.
58 59 60 61 62 63 64 65 66 |
# File 'lib/commands/uniprot.rb', line 58 def self.get_uniprot_entry(accession, format) if format == 'sequence' get_uniprot_entry(accession, 'fasta').lines.map(&:chomp)[1..].join else # other format has been specified, just download and output resp = Typhoeus.get("https://rest.uniprot.org/uniprotkb/#{accession}.#{format}") resp.response_body if resp.success? end end |
.run(args) ⇒ void
This method returns an undefined value.
Invokes the uniprot command-line tool with the given arguments.
46 47 48 |
# File 'lib/commands/uniprot.rb', line 46 def self.run(args) @root_command.run(args) end |