Sha256: de93469653dea7fbedc1df2d9890c932f134720bfce9a7c7468bcf16f4316752
Contents?: true
Size: 1.19 KB
Versions: 6
Compression:
Stored size: 1.19 KB
Contents
####################################################### # THIS NEEDS TO BE WORKED FOR mzdata! ####################################################### require 'base64' module Spec; end module Spec::MzData #################### # THIS IS FOR mzXML right now!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #################### # takes a base64 peaks string and returns an array of [m/z,intens] doublets # mzXML as network ordered def base64_peaks_to_pairs(string, precision=32) data = base64_peaks_to_array(string, precision) ndata = [] data.each_with_index do |dat,ind| if (ind % 2) == 0 # even arr = Array.new(2) arr[0] = dat ndata.push( arr ) else ndata.last[1] = dat end end ndata end #################### # THIS IS FOR mzXML right now!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #################### # takes a base64 peaks string and returns an array of alternating m/z and # intensity mzXML as network ordered def base64_peaks_to_array(string, precision=32) b64d = Base64.decode64(string) if precision == 32 unpack_code = "g*" elsif precision == 64 unpack_code = "G*" end b64d.unpack(unpack_code) end end
Version data entries
6 entries across 6 versions & 1 rubygems