Class: Ms::Xcalibur::Convert::RawToDta
- Inherits:
-
Tap::FileTask
- Object
- Tap::FileTask
- Ms::Xcalibur::Convert::RawToDta
- Defined in:
- lib/ms/xcalibur/convert/raw_to_dta.rb
Overview
:startdoc::manifest convert RAW files to dta format Converts a .RAW file to dta files using extract_msn.exe
extract_msn.exe is an Xcalibur/BioWorks tool that extracts spectra from .RAW files into .dta (Sequest) format and must be installed for RawToDta to work. RawToDta was developed against extract_msn version 4.0. You can check if extract_msn is installed at the default location, as well as determine the
version of your executable using:
% tap run -- xcalibur/convert/raw_to_dta --extract_msn_help
Constant Summary collapse
- CONFIG_MAP =
[ [:first_scan, 'F'], [:last_scan, 'L'], [:lower_MW, 'B'], [:upper_MW, 'T'], [:precursor_mass_tol, 'M'], [:num_allowed_intermediate_scans_for_grouping, 'S'], [:charge_state, 'C'], [:num_required_group_scans, 'G'], [:num_ions_required, 'I'], [:output_path, 'D'], [:intensity_threshold, 'E'], [:use_unified_search_file, 'U'], [:subsequence, 'Y'], [:write_zta_files, 'Z'], [:perform_charge_calculations, 'K'], [:template_file, 'O'], [:options_string, 'A'], [:minimum_signal_to_noise, 'R'], [:minimum_number_of_peaks, 'r'] ]
Instance Method Summary collapse
-
#cmd(input_file, output_dir = nil) ⇒ Object
Formats the extract_msn.exe command using the specified input_file, and the current configuration.
-
#cmd_options(output_dir = nil) ⇒ Object
Formats command options for extract_msn.exe using the current configuration.
-
#normalize(path) ⇒ Object
Expands the input path and converts all forward slashes (/) to backslashes () to make it into a Windows-style path.
- #process(input_file, output_dir = nil) ⇒ Object
Instance Method Details
#cmd(input_file, output_dir = nil) ⇒ Object
Formats the extract_msn.exe command using the specified input_file, and the current configuration. A default output directory can be specified using output_dir; it will not override a configured output directory.
Note that output_dir should be an EXISTING filepath or relative filepath. execute_msn.exe will not generate .dta files if the
output_dir doesn’t exist.
108 109 110 111 112 113 114 115 |
# File 'lib/ms/xcalibur/convert/raw_to_dta.rb', line 108 def cmd(input_file, output_dir=nil) args = [] args << "\"#{normalize extract_msn}\"" args << (output_dir) args << "\"#{normalize input_file}\"" args.join(' ') end |
#cmd_options(output_dir = nil) ⇒ Object
Formats command options for extract_msn.exe using the current configuration. Configurations are mapped to their single-letter keys using CONFIG_MAP.
A default output_dir can be specified for when config is not specified.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ms/xcalibur/convert/raw_to_dta.rb', line 76 def (output_dir=nil) = CONFIG_MAP.collect do |key, flag| value = (flag == "D" ? output_dir : config[key]) next unless value # formatting consists of stringifying the value argument, or # in escaping the value if the arguement is a path formatted_value = case key when :use_unified_search_file, :perform_charge_calculations, :write_zta_files "" # no argument when :output_path, :template_file # path argument, escape "\"#{normalize value}\"" else # number or string, simply stringify value.to_s end "-#{flag}#{formatted_value}" end .compact.join(" ") end |
#normalize(path) ⇒ Object
Expands the input path and converts all forward slashes (/) to backslashes () to make it into a Windows-style path.
67 68 69 |
# File 'lib/ms/xcalibur/convert/raw_to_dta.rb', line 67 def normalize(path) File.(path).gsub(/\//, "\\") end |
#process(input_file, output_dir = nil) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/ms/xcalibur/convert/raw_to_dta.rb', line 117 def process(input_file, output_dir=nil) extname = File.extname(input_file) raise "Expected .RAW file: #{input_file}" unless extname =~ /\.RAW$/i # Target the output to a directory with the same basename # as the raw file, unless otherwise specified. output_dir = input_file.chomp(File.extname(input_file)) if output_dir == nil mkdir(output_dir) command = cmd(input_file, output_dir) log :sh, command if app.quiet capture_sh(command, true) else sh(command) puts "" # add extra line to make logging nice end # This may select additional .dta files that existed before raw_to_dta # TODO - maybe read lcq_dta for files? Dir.glob( File.(File.join(output_dir, "*.dta")) ) end |