Class: Bio::FinishM::ORFsFinder
- Inherits:
-
Object
- Object
- Bio::FinishM::ORFsFinder
- Includes:
- Logging
- Defined in:
- lib/finishm/orfs_finder.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :min_orf_length => 100 }
Instance Method Summary collapse
- #add_options(optparse_object, options) ⇒ Object
- #find_orfs_in_graph(finishm_graph, initial_onodes, options = {}) ⇒ Object
- #orf_to_settable(path, start_index, start_offset, end_index, end_offset) ⇒ Object
- #run(options, argv) ⇒ Object
- #validate_options(options, argv) ⇒ Object
Methods included from Logging
Instance Method Details
#add_options(optparse_object, options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/finishm/orfs_finder.rb', line 8 def (optparse_object, ) .merge! Bio::FinishM::Visualise::DEFAULT_OPTIONS .merge! DEFAULT_OPTIONS optparse_object. = "\nUsage: finishm find_orfs --assembly-??? Find possible open reading frames in assembly graph \n\n" optparse_object.separator "Input genome information" optparse_object.separator "\nIf an assembly is to be done, there must be some definition of reads:\n\n" #TODO improve this help Bio::FinishM::ReadInput.new.(optparse_object, ) optparse_object.separator "\nOptional graph-exploration arguments:\n\n" Bio::FinishM::Visualise.new.(optparse_object, ) optparse_object.separator "\nOptional graph-related arguments:\n\n" Bio::FinishM::GraphGenerator.new.(optparse_object, ) end |
#find_orfs_in_graph(finishm_graph, initial_onodes, options = {}) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/finishm/orfs_finder.rb', line 65 def find_orfs_in_graph(finishm_graph, initial_onodes, ={}) initial_paths = initial_onodes.collect do |onode| path = Bio::Velvet::Graph::OrientedNodeTrail.new path.add_oriented_node onode path end orfer = Bio::AssemblyGraphAlgorithms::AllOrfsFinder.new orf_trails = orfer.find_orfs_in_graph(finishm_graph.graph, initial_paths, [:min_orf_length], [:range]) found_orfs = orfer.orf_sequences_from_trails(orf_trails) found_orfs.each_pair do |name, sequence| puts ">#{name}" puts sequence end end |
#orf_to_settable(path, start_index, start_offset, end_index, end_offset) ⇒ Object
85 86 87 |
# File 'lib/finishm/orfs_finder.rb', line 85 def orf_to_settable(path, start_index, start_offset, end_index, end_offset) [path[start_index..end_index].collect{|onode| onode.to_settable},[start_offset, end_offset]] end |
#run(options, argv) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/finishm/orfs_finder.rb', line 34 def run(, argv) read_input = Bio::FinishM::ReadInput.new read_input. visualise = Bio::FinishM::Visualise.new if [:interesting_probes] or [:interesting_probe_names] finishm_graph, interesting_node_ids = visualise.generate_graph_from_probes(read_input, ) elsif [:interesting_nodes] finishm_graph = visualise.generate_graph_from_nodes(read_input, ) interesting_node_ids = [:interesting_nodes] elsif [:assembly_files] finishm_graph, interesting_node_ids, = visualise.generate_graph_from_assembly(read_input, ) else finishm_graph = Bio::FinishM::GraphGenerator.new.generate_graph([], read_input, ) end if [:graph_search_leash_length] #log.info "Finding nodes within the leash length of #{options[:graph_search_leash_length] }.." nodes_within_leash, node_ids_at_leash = visualise.get_nodes_within_leash(finishm_graph, interesting_node_ids, ) log.info "Found #{node_ids_at_leash.length} nodes at the end of the #{options[:graph_search_leash_length] }bp leash" if [:graph_search_leash_length] [:range] = nodes_within_leash else [:range] = finishm_graph.graph.nodes end initial_onodes = Bio::FinishM::PathCounter.new.get_leash_start_nodes(finishm_graph, [:range]) find_orfs_in_graph(finishm_graph, initial_onodes, ) end |
#validate_options(options, argv) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/finishm/orfs_finder.rb', line 27 def (, argv) visualise = Bio::FinishM::Visualise.new return visualise.validate_argv_length(argv) || visualise.() || visualise.() end |