MCPcopy Create free account
hub / github.com/MG-RAST/Shock / ParseSamtoolsArgs

Function ParseSamtoolsArgs

shock-server/request/streamer.go:219–251  ·  view source on GitHub ↗

helper function to translate args in URL query to samtools args manual: http://samtools.sourceforge.net/samtools.shtml

(query url.Values)

Source from the content-addressed store, hash-verified

217//helper function to translate args in URL query to samtools args
218//manual: http://samtools.sourceforge.net/samtools.shtml
219func ParseSamtoolsArgs(query url.Values) (argv []string, err error) {
220 var (
221 filter_options = map[string]string{
222 "head": "-h",
223 "headonly": "-H",
224 "count": "-c",
225 }
226 valued_options = map[string]string{
227 "flag": "-f",
228 "lib": "-l",
229 "mapq": "-q",
230 "readgroup": "-r",
231 }
232 )
233
234 for src, des := range filter_options {
235 if _, ok := query[src]; ok {
236 argv = append(argv, des)
237 }
238 }
239
240 for src, des := range valued_options {
241 if _, ok := query[src]; ok {
242 if val := query.Get(src); val != "" {
243 argv = append(argv, des)
244 argv = append(argv, val)
245 } else {
246 return nil, errors.New(fmt.Sprintf("required value not found for query arg: %s ", src))
247 }
248 }
249 }
250 return argv, nil
251}

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected