Class: TandemSearchTool

Inherits:
SearchTool show all
Defined in:
lib/protk/tandem_search_tool.rb

Instance Attribute Summary collapse

Attributes inherited from Tool

#option_parser, #options, #options_defined_by_user

Instance Method Summary collapse

Methods inherited from Tool

#add_boolean_option, #add_value_option, #check_options, #database_info, default_output_path, extension_from_filename, #jobid_prefix, #jobid_prefix=, #method_missing, #run, #supported_options

Constructor Details

#initializeTandemSearchTool

Returns a new instance of TandemSearchTool.



23
24
25
26
27
28
29
30
31
32
33
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
64
65
66
67
68
69
70
# File 'lib/protk/tandem_search_tool.rb', line 23

def initialize

	super([
		:database,
		:explicit_output,
		:over_write,
		:enzyme,
		:modifications,
		:mass_tolerance_units,
		:mass_tolerance,
		:multi_isotope_search,
		:missed_cleavages,
		:cleavage_semi,
		:methionine_oxidation,
		:glyco,
		:acetyl_nterm,
		:threads
 			])

	@xtandem_keys_with_single_multiplicity = {
		:fragment_tol => "spectrum, fragment monoisotopic mass error",
		:missed_cleavages => "scoring, maximum missed cleavage sites",
		:cleavage_semi => "protein, cleavage semi",
		:precursor_tolu => "spectrum, parent monoisotopic mass error units",
		:multi_isotope_search => "spectrum, parent monoisotopic mass isotope error",
		:fragment_tolu => "spectrum, fragment monoisotopic mass error units",
		:acetyl_nterm => "protein, quick acetyl",
		:output_spectra => "output, spectra",
		:threads => "spectrum, threads",
		:enzyme => "protein, cleavage site"
	}

	@xtandem_keys_for_precursor_tol = {
		:precursor_tol => ["spectrum, parent monoisotopic mass error minus", "spectrum, parent monoisotopic mass error plus"]
	}

	@defaults_path="#{File.dirname(__FILE__)}/data/tandem_params.xml"
	@taxonomy_path="#{File.dirname(__FILE__)}/data/taxonomy_template.xml"
	@default_data_path="#{File.dirname(__FILE__)}/data/"
	
	@option_parser.banner = "Run an X!Tandem msms search on a set of mzML input files.\n\nUsage: tandem_search.rb [options] file1.mzML file2.mzML ..."
	@options.output_suffix="_tandem"
	@options.enzyme="[RK]|{P}"
	add_value_option(:tandem_params,"isb_native",['-T', '--tandem-params tandem', 'Either the full path to an xml file containing a complete set of default parameters, or one of the following (isb_native,isb_kscore,gpm). Default is isb_native'])
	add_boolean_option(:keep_params_files,false,['-K', '--keep-params-files', 'Keep X!Tandem parameter files'])
	add_boolean_option(:output_spectra,false,['--output-spectra', 'Include spectra in the output file'])

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Tool

Instance Attribute Details

#default_data_pathObject (readonly)

Returns the value of attribute default_data_path.



19
20
21
# File 'lib/protk/tandem_search_tool.rb', line 19

def default_data_path
  @default_data_path
end

#defaults_pathObject (readonly)

Returns the value of attribute defaults_path.



17
18
19
# File 'lib/protk/tandem_search_tool.rb', line 17

def defaults_path
  @defaults_path
end

#supported_xtandem_keysObject (readonly)

Returns the value of attribute supported_xtandem_keys.



21
22
23
# File 'lib/protk/tandem_search_tool.rb', line 21

def supported_xtandem_keys
  @supported_xtandem_keys
end

#taxonomy_pathObject (readonly)

Returns the value of attribute taxonomy_path.



18
19
20
# File 'lib/protk/tandem_search_tool.rb', line 18

def taxonomy_path
  @taxonomy_path
end

Instance Method Details

#params_doc(db_info, taxo_path, input_path, output_path) ⇒ Object



257
258
259
260
261
262
263
264
265
# File 'lib/protk/tandem_search_tool.rb', line 257

def params_doc(db_info,taxo_path,input_path,output_path)
		params_parser=XML::Parser.file(@defaults_path)
		std_params=params_parser.parse

		
		throw "Invalid input db_info must be a FastaDatabase object" unless db_info.class==FastaDatabase

	generate_parameter_doc(std_params,output_path,input_path,db_info,taxo_path)
end

#taxonomy_doc(db_info) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/protk/tandem_search_tool.rb', line 236

def taxonomy_doc(db_info)
	throw "Invalid input db_info must be a FastaDatabase object" unless db_info.class==FastaDatabase
	database_path=db_info.path
	taxon=db_info.name
	# Parse taxonomy template file
	#
	taxo_parser=XML::Parser.file(@taxonomy_path)
	taxo_doc=taxo_parser.parse

	taxon_label=taxo_doc.find('/bioml/taxon')
	throw "Exactly one taxon label is required in the taxonomy_template file" unless taxon_label.length==1
	taxon_label[0].attributes['label']=taxon

	db_file=taxo_doc.find('/bioml/taxon/file')
	throw "Exactly one database file is required in the taxonomy_template file" unless db_file.length==1
	db_file[0].attributes['URL']=database_path

	taxo_doc
end