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
|
# File 'lib/ms/sequest/srf/search.rb', line 112
def self.commandline(argv, progname=$0)
opt = {
:format => 'mgf'
}
opts = OptionParser.new do |op|
op.banner = "usage: #{File.basename(__FILE__)} <file>.srf ..."
op.separator "outputs: <file>.mgf ..."
op.on("-f", "--format <mgf|dta>", "the output format (default: #{opt[:format]})") {|v| opt[:format] = v }
op.on("-o", "--outfiles <String,...>", Array, "comma list of output files or directories") {|v| opt[:outfiles] = v }
end
opts.parse!(argv)
if argv.size == 0
puts(opts) || exit
end
format = opt[:format]
if opt[:outfiles] && (opt[:outfiles].size != argv.size)
raise "if outfiles specified, needs the same number of files as input files"
end
argv.each_with_index do |srf_file,i|
base = srf_file.chomp(File.extname(srf_file))
newfile =
if opt[:outfiles]
opt[:outfiles][i]
else
case format
when 'dta'
base
when 'mgf'
base << '.' << format
end
end
srf = MS::Sequest::Srf.new(srf_file, :link_protein_hits => false, :filter_by_precursor_mass_tolerance => false, :read_pephits => false )
case format
when 'mgf'
srf.to_mgf(newfile)
when 'dta'
srf.to_dta(newfile)
end
end
end
|