class Bio::Meme::Mast::Report
Description¶ ↑
A class to parse the output from Mast
WARNING: Currently support is only for -hit_list (machine readable) format
HTML (default) output is not supported
Examples¶ ↑
Attributes
motifs[R]
Public Class Methods
new(mast_hitlist)
click to toggle source
# File lib/bio/appl/meme/mast/report.rb 40 def initialize(mast_hitlist) 41 @motifs = parse_hit_list(mast_hitlist) 42 end
Public Instance Methods
each() { |motif| ... }
click to toggle source
Iterates each motif (Bio::Meme::Motif
)
# File lib/bio/appl/meme/mast/report.rb 45 def each 46 @motifs.each do |motif| 47 yield motif 48 end 49 end
Also aliased as: each_motif
Private Instance Methods
parse_hit_list(data)
click to toggle source
Each line corresponds to one motif occurrence in one sequence.
The format of the hit lines is [<sequence_name> <strand><motif> <start> <end> <p-value>]+ where <sequence_name> is the name of the sequence containing the hit <strand> is the strand (+ or - for DNA, blank for protein), <motif> is the motif number, <start> is the starting position of the hit, <end> is the ending position of the hit, and <p-value> is the position p-value of the hit.
# File lib/bio/appl/meme/mast/report.rb 65 def parse_hit_list(data) 66 motifs = [] 67 data.each_line do |line| 68 69 line.chomp! 70 71 # skip comments 72 next if line =~ /^#/ 73 74 fields = line.split(/\s/) 75 76 if fields.size == 5 77 motifs << Motif.new(fields[0], nil, fields[1], fields[2], fields[3], fields[4]) 78 elsif fields.size == 6 79 motifs << Motif.new(fields[0], fields[1], fields[2], fields[3], fields[4], fields[5]) 80 else 81 raise RuntimeError.new("Could not parse mast output") 82 end 83 84 end 85 motifs 86 end