Class: SearchTool

Inherits:
Tool
  • Object
show all
Defined in:
lib/protk/search_tool.rb

Direct Known Subclasses

ProphetTool

Instance Attribute Summary

Attributes inherited from Tool

#option_parser, #options

Instance Method Summary collapse

Methods inherited from Tool

#input_base_path, #jobid_prefix, #jobid_prefix=, #method_missing, #output_base_path, #run

Constructor Details

#initialize(option_support = {}) ⇒ SearchTool

Initializes commandline options common to all search tools. Individual search tools can add their own options, but should use Capital letters to avoid conflicts



21
22
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/protk/search_tool.rb', line 21

def initialize(option_support={})
  super(option_support)

  if (option_support[:database]==true)          
        
    @options.database = "sphuman"
    @option_parser.on( '-d', '--database dbname', 'Specify the database to use for this search. Default=sphuman' ) do |dbname|
      options.database = dbname
    end

  end
  
  if ( option_support[:msms_search_detailed_options]==true)      
     @options.allowed_charges="1+,2+,3+"
     @option_parser.on(  '--allowed-charges ac', 'Allowed precursor ion charges. Default=1+,2+,3+' ) do |ac|
       @options.allowed_charges = ac
     end       
     
     @options.enzyme = "Trypsin"
     @option_parser.on('--enzyme enz', 'Enzyme') do |enz|
       @options.enzyme=enz
     end
     
     @options.instrument = "ESI-QUAD-TOF"
     @option_parser.on('--instrument instrument', 'Instrument') do |instrument|
       @options.instrument=instrument
     end
     
     
     @options.var_mods = ""
      @option_parser.on('--var-mods vm', 'Variable modifications (Overrides -g)' ) do |vm|
        @options.var_mods = vm
      end

      @options.fix_mods = ""
      @option_parser.on('--fix-mods fm', 'Fixed modifications (Overrides -c and -m options)' ) do |fm|
        @options.fix_mods = fm
      end

      @options.searched_ions = ""
      @option_parser.on('--searched-ions si', 'Ion series to search (default=b,y)' ) do |si|
        @options.searched_ions = si
      end

      
      @options.fragment_tolu="Da"
      @option_parser.on('--fragment-ion-tol-units tolu', 'Fragment ion mass tolerance units (Da or mmu). Default=Da' ) do |tolu|
        @options.fragment_tolu = tolu
      end
      
      @options.precursor_tolu="ppm"
      @option_parser.on('--precursor-ion-tol-units tolu', 'Precursor ion mass tolerance units (ppm or Da). Default=ppm' ) do |tolu|
        @options.precursor_tolu = tolu
      end
      
      @options.email=""
      @option_parser.on('--email em', 'User email.') do |em|
        @options.email = em
      end

      @options.username=""
      @option_parser.on('--username un', 'Username.') do |un|
        @options.username = un
      end

      @options.mascot_server="www.matrixscience.com"
      @option_parser.on( '-S', '--server url', 'The url to the cgi directory of the mascot server' ) do |url| 
        @options.mascot_server=url
      end

      @options.mascot_server=""
      @option_parser.on('--username un', 'Username.') do |un|
        @options.username = un
      end

      @options.num_peaks_for_multi_isotope_search="0"
      @option_parser.on("--num-peaks-for-multi-isotope-search np","Number of peaks to include in multi-isotope search") do |np|
        @options.num_peaks_for_multi_isotope_search=np
      end

     
   end
  
  if ( option_support[:msms_search]==true)      
    @options.fragment_tol=0.65
    @option_parser.on( '-f', '--fragment-ion-tol tol', 'Fragment ion mass tolerance (unit dependent). Default=0.65' ) do |tol|
      @options.fragment_tol = tol
    end
    
    @options.precursor_tol=200
    @option_parser.on( '-p', '--precursor-ion-tol tol', 'Precursor ion mass tolerance in (ppm if precursor search type is monoisotopic or Da if it is average). Default=200' ) do |tol|
      @options.precursor_tol = tol.to_f
    end
    
    @options.respect_precursor_charges=false
    @option_parser.on( '-q', '--respect-charges','Dont respect charges in the input file. Instead impute them by trying various options') do 
      @options.respect_precursor_charges=true
    end
    
    @options.precursor_search_type="monoisotopic"
    @option_parser.on( '-a', '--search-type type', 'Use monoisotopic or average precursor masses. (monoisotopic or average)' ) do |type| 
      @options.precursor_search_type = type
    end
    
    @options.strict_monoisotopic_mass=false
    @option_parser.on( '-s', '--strict-monoisotopic-mass', 'Dont allow for misassignment of monoisotopic mass to another isotopic peak') do
      @options.strict_monoisotopic_mass=true
    end
    
    @options.missed_cleavages=2
    @option_parser.on( '-v', '--num-missed-cleavages num', 'Number of missed cleavages allowed' ) do |num| 
      @options.missed_cleavages = num
    end
  
    @options.carbamidomethyl=true
    @option_parser.on( '-c', '--no-carbamidomethyl', 'Run a search without a carbamidomethyl fixed modification' ) do 
      @options.carbamidomethyl = false
    end

    @options.methionine_oxidation=false
    @option_parser.on( '-m', '--methionine-oxidation', 'Run a search with oxidised methionines as a variable modification' ) do 
      @options.methionine_oxidation = true
    end
    
  end
    
  if ( option_support[:glyco]==true)

    @options.glyco = false
    @option_parser.on( '-g', '--glyco', 'Expect N-Glycosylation modifications as variable mod in a search or as a parameter when building statistical models' ) do 
      @options.glyco = true
    end

  end
  
  if ( option_support[:maldi]==true)
    @options.maldi=false
    @option_parser.on( '-l', '--maldi', 'Run a search on MALDI data') do
      @options.maldi=true
    end
  end
    
end

Dynamic Method Handling

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

Instance Method Details

#current_database(db_type, db = @options.database) ⇒ Object

Based on the database setting and global database path, find the most current version of the required database This function returns the name of the database with an extension appropriate to the database type



178
179
180
# File 'lib/protk/search_tool.rb', line 178

def current_database(db_type,db=@options.database)
  return Constants.new.current_database_for_name(db)
end

#jobid_from_filename(filename) ⇒ Object



166
167
168
169
170
171
172
173
# File 'lib/protk/search_tool.rb', line 166

def jobid_from_filename(filename)
  jobid="protk"
  jobnum_match=filename.match(/(.{1,10})\.d/)
  if (jobnum_match!=nil)
    jobid="#{self.jobid_prefix}#{jobnum_match[1]}"
  end
  return jobid
end