Documentation ¶
Index ¶
- Constants
- type Galaxy
- func (g *Galaxy) CheckJob(jobid string) (jobstate string, outfiles map[string]string, err error)
- func (g *Galaxy) CheckWorkflow(wfi *WorkflowInvocation) (wfstatus *WorkflowStatus, err error)
- func (g *Galaxy) CreateHistory(name string) (history HistoryFullInfo, err error)
- func (g *Galaxy) DeleteHistory(historyid string) (state string, err error)
- func (g *Galaxy) DeleteWorkflow(workflowid string) (state string, err error)
- func (g *Galaxy) DeleteWorkflowRun(wfi *WorkflowInvocation) (err error)
- func (g *Galaxy) DownloadFile(historyid, fileid string) (content []byte, err error)
- func (g *Galaxy) GetToolById(id string) (tool ToolInfo, err error)
- func (g *Galaxy) GetWorkflowByID(inputid string, published bool) (wf WorkflowInfo, err error)
- func (g *Galaxy) ImportSharedWorkflow(sharedworkflowid string) (workflow WorkflowInfo, err error)
- func (g *Galaxy) LaunchTool(tl *ToolLaunch) (outfiles map[string]string, jobids []string, err error)
- func (g *Galaxy) LaunchWorkflow(launch *WorkflowLaunch) (answer *WorkflowInvocation, err error)
- func (g *Galaxy) ListHistories() (histories []HistoryShortInfo, err error)
- func (g *Galaxy) ListWorkflows(published bool) (workflows []WorkflowInfo, err error)
- func (g *Galaxy) NewToolLauncher(historyid string, toolid string) (tl *ToolLaunch)
- func (g *Galaxy) NewWorkflowLauncher(historyid string, workflowid string) (launch *WorkflowLaunch)
- func (g *Galaxy) SearchToolID(name string) (toolIds []string, err error)
- func (g *Galaxy) SearchWorkflowIDs(name string, published bool) (ids []string, err error)
- func (g *Galaxy) SearchWorkflowIDsByName(name string, published bool) (ids []string, err error)
- func (g *Galaxy) SetNbRequestAttempts(attempts int)
- func (g *Galaxy) UploadFile(historyid string, path string, ftype string) (fileid, jobid string, err error)
- func (g *Galaxy) Version() (version string, err error)
- type HistoryFullInfo
- type HistoryShortInfo
- type HistoryStateDetails
- type HistoryStateIds
- type ToolInfo
- type ToolLaunch
- type ToolShedRepository
- type WorkflowInfo
- type WorkflowInput
- type WorkflowInputStep
- type WorkflowInvocation
- type WorkflowInvocationStep
- type WorkflowLaunch
- type WorkflowStatus
- func (ws *WorkflowStatus) ListStepRanks() (stepRanks []int)
- func (ws *WorkflowStatus) Status() string
- func (ws *WorkflowStatus) StepOutFileNames(stepRank int) (fileNames []string, err error)
- func (ws *WorkflowStatus) StepOutputFileId(stepRank int, filename string) (fileId string, err error)
- func (ws *WorkflowStatus) StepStatus(stepRank int) (status string, err error)
- type WorkflowStep
Constants ¶
const ( HISTORY = "/api/histories" CHECK_JOB = "/api/jobs/" TOOLS = "/api/tools" WORKFLOWS = "/api/workflows" VERSION = "/api/version" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Galaxy ¶
type Galaxy struct {
// contains filtered or unexported fields
}
func NewGalaxy ¶
Initializes a new Galaxy with given:
- url of the form http(s)://ip:port
- and an api key
func (*Galaxy) CheckJob ¶
Queries the galaxy instance to check the job defined by its Id Returns:
- job State
- Output files: map : key: out filename value: out file id
func (*Galaxy) CheckWorkflow ¶
func (g *Galaxy) CheckWorkflow(wfi *WorkflowInvocation) (wfstatus *WorkflowStatus, err error)
This function Checks the status of each step of the workflow
It returns workflowstatus: An indicator of the whole workflow status, its step status, and its step outputfiles. The whole status is computed as follows:
- If all steps are "ok": then == "ok"
- Else if one step is "error": then == "error"
- Else if one step is "deleted": then == "deleted"
- Else if one step is "running": then == "running"
- Else if one step is "queued": then == "queued"
- Else if one step is "waiting": then == "waiting"
- Else if one is is "new": then == "new"
- Else : Unknown state
func (*Galaxy) CreateHistory ¶
func (g *Galaxy) CreateHistory(name string) (history HistoryFullInfo, err error)
Creates an history with given name on the Galaxy instance and returns its id
func (*Galaxy) DeleteHistory ¶
Deletes and purges an history defined by its id Returns:
- The state of the deletion ("ok")
- A potential error
func (*Galaxy) DeleteWorkflow ¶
Deletes a Workflow defined by its id
- The state of the deletion ("Workflow '<name>' successfully deleted" for example)
- A potential error if the workflow cannot be deleted (server response does not contain "successfully deleted")
func (*Galaxy) DeleteWorkflowRun ¶
func (g *Galaxy) DeleteWorkflowRun(wfi *WorkflowInvocation) (err error)
Cancels a running workflow.
TODO: handle json response from the server in case of success... nothing described.
func (*Galaxy) DownloadFile ¶
Downloads a file defined by its id from the given history of the galaxy instance Returns:
- The content of the file in []byte
- A potential error
func (*Galaxy) GetWorkflowByID ¶
func (g *Galaxy) GetWorkflowByID(inputid string, published bool) (wf WorkflowInfo, err error)
Call galaxy api to look for a workflow with the given ID
If published: then search the workflow in the published+imported workflows
func (*Galaxy) ImportSharedWorkflow ¶
func (g *Galaxy) ImportSharedWorkflow(sharedworkflowid string) (workflow WorkflowInfo, err error)
Lists all the workflows imported in the user's account
func (*Galaxy) LaunchTool ¶
func (g *Galaxy) LaunchTool(tl *ToolLaunch) (outfiles map[string]string, jobids []string, err error)
Launches a job at the given galaxy instance, with:
- The tool given by its id (name)
- Using the given history
- Giving as input the files in the map : key: tool input name, value: dataset id
Returns:
- Tool outputs : map[out file name]=out file id
- Jobs: array of job ids
func (*Galaxy) LaunchWorkflow ¶
func (g *Galaxy) LaunchWorkflow(launch *WorkflowLaunch) (answer *WorkflowInvocation, err error)
Launches the given workflow (defined by its ID), with given inputs and params.
Infiles are defined by their indexes on the workflow ¶
Inparams are defined as key: step id of the workflow, value: map of key:param name/value: param value
func (*Galaxy) ListHistories ¶
func (g *Galaxy) ListHistories() (histories []HistoryShortInfo, err error)
func (*Galaxy) ListWorkflows ¶
func (g *Galaxy) ListWorkflows(published bool) (workflows []WorkflowInfo, err error)
Lists all the workflows imported in the user's account
If published: then lists published+imported workflows
func (*Galaxy) NewToolLauncher ¶
func (g *Galaxy) NewToolLauncher(historyid string, toolid string) (tl *ToolLaunch)
Initializes a ToolLaunch that will be used to start a new job with the given tool on the given history
func (*Galaxy) NewWorkflowLauncher ¶
func (g *Galaxy) NewWorkflowLauncher(historyid string, workflowid string) (launch *WorkflowLaunch)
func (*Galaxy) SearchToolID ¶
This function returns ID of the tools corresponding to the name/ID in argument.
It first queryies the
api/tools/<name>
entry point. If The returned tool has its ID == given name then returns it. Otherwise, it queries the galaxy entry point
api/tools?q=<name>
func (*Galaxy) SearchWorkflowIDs ¶
Search a workflow on the glaaxy server.
It will first search for a workflow with ID exactly equal to the given name. If it does not exist, then will search a workflow having a lower(name) matching containing the given lower(name).
func (*Galaxy) SearchWorkflowIDsByName ¶
Searches workflow ids by name.
If published: then search the workflow in the published+imported workflows
func (*Galaxy) SetNbRequestAttempts ¶
Sets the number of times golaxy will try to execute a request on the galaxy server if an error occurs (like a timeout).
Default: 1
It only applies on get, post and delete http request errors (timeout, etc.), and not Galaxy server errors.
If given attempts is <=0, will not change anything.
func (*Galaxy) UploadFile ¶
func (g *Galaxy) UploadFile(historyid string, path string, ftype string) (fileid, jobid string, err error)
Uploads the given file to the galaxy instance in the history defined by its id and the given type (auto/txt/nhx/etc.)
Returns the file id, the job id and a potential error
type HistoryFullInfo ¶
type HistoryFullInfo struct { Importable bool `json:"importable"` Create_time string `json:"create_time"` Contents_url string `json:"contente_url"` Id string `json:"id"` Size int `json:"size"` User_id string `json:"user_id"` Username_and_slug string `json:"username_and_slug"` Annotation string `json:"annotation"` State_details HistoryStateDetails `json:"state_details"` State string `json:"state"` Empty bool `json:"empty"` Update_time string `json:"update_time"` Tags []string `json:"tags"` Deleted bool `json:"deleted"` Genome_build string `json:"genome_build"` Slug string `json:"slug"` Name string `json:"name"` Url string `json:"url"` State_ids HistoryStateIds `json:"state_ids"` Published bool `json:"published"` Model_class string `json:"model_class"` Purged bool `json:"purged"` Err_msg string `json:"err_msg"` // In case of error, this field is !="" Err_code int `json:"err_code"` // In case of error, this field is !=0 }
Response after the creation/deletion of a history
type HistoryShortInfo ¶
type HistoryShortInfo struct { Annotation string `json:"annotation"` Deleted bool `json:"deleted"` Id string `json:"id"` Model_class string `json:"model_class"` Name string `json:"name"` Published bool `json:"published"` Purged bool `json:"purged"` Tags []string `json:"tags"` Url string `json:"url"` }
type HistoryStateDetails ¶
type HistoryStateDetails struct { Paused int `json:"paused"` Ok int `json:"ok"` Failed_metadata int `json:"failed_metadata"` Upload int `json:"upload"` Discarded int `json:"discarded"` Running int `json:"running"` Setting_metadata int `json:"setting_metadata"` Error int `json:"error"` New int `json:"new"` Queued int `json:"queued"` Empty int `json:"empty"` }
Detail of the job state
type HistoryStateIds ¶
type HistoryStateIds struct { Paused []string `json:"paused"` Ok []string `json:"ok"` Failed_metadata []string `json:"failed_metadata"` Upload []string `json:"upload"` Discarded []string `json:"discarded"` Running []string `json:"running"` Setting_metadata []string `json:"setting_metadata"` Error []string `json:"error"` New []string `json:"new"` Queued []string `json:"queued"` Empty []string `json:"empty"` }
Id of jobs in different states
type ToolInfo ¶
type ToolInfo struct { Description string `json:"description"` // Description of the tool Edam_operations []string `json:"edam_operations"` Edam_topics []string `json:"edam_topics"` Form_style string `json:"form_style"` Id string `json:"id"` Labels []string `json:"labels"` Model_class string `json:"model_class"` Name string `json:"name"` Panel_Section_Id string `json:"panel_section_id"` Panel_Section_Name string `json:"panel_section_name"` Tool_Shed_Repository ToolShedRepository `json:"tool_shed_repository"` Version string `json:"version"` Traceboack string `json:"traceback"` // Set only if the server returns an error Err_Msg string `json:"err_msg"` // Err_Msg =="" if no error Err_Code string `json:"err_code"` // Err_Code=="" if no error }
Informations about a specific tool
type ToolLaunch ¶
type ToolLaunch struct { History_id string `json:"history_id"` // Id of history Tool_id string `json:"tool_id"` // Id of the tool Inputs map[string]interface{} `json:"inputs"` // Inputs: key name of the input, value dataset id }
Request to call a tool
func (*ToolLaunch) AddFileInput ¶
func (tl *ToolLaunch) AddFileInput(paramname string, fileid string, filescr string)
Add new input file to the Tool Launcher
- inputIndex : index of this input in the workflow (see WorkflowInfo / GetWorkflowById)
- fielId: id of input file
- fielScr : one of ["ldda", "ld", "hda", "hdca"]
func (*ToolLaunch) AddParameter ¶
func (tl *ToolLaunch) AddParameter(paramname, paramvalue string)
Add new parameter to Tool launcher
- paramname: name of the tool parameter
- paramvalue: value of the given parameter
type ToolShedRepository ¶
type ToolShedRepository struct { Changeset_Revision string `json:"changeset_revision"` Name string `json:"name"` Owner string `json:"owner"` Tool_shed string `json:"tool_shed"` }
Informations about a toolshed
type WorkflowInfo ¶
type WorkflowInfo struct { Annotation string `json:"annotation"` Deleted bool `json:"deleted"` Id string `json:"id"` Inputs map[string]WorkflowInput `json:"inputs"` Latest_Workflow_UUID string `json:"latest_workflow_uuid"` Model_Class string `json:"model_class"` Name string `json:"name"` Owner string `json:"owner"` Published bool `json:"published"` Steps map[string]WorkflowStep `json:"steps"` Tags []string `json:"tags"` Url string `json:"url"` Traceboack string `json:"traceback"` // Set only if the server returns an error Err_Msg string `json:"err_msg"` // Err_Msg =="" if no error Err_Code int `json:"err_code"` // Err_Code==0 if no error }
Informations about a workflow
type WorkflowInput ¶
type WorkflowInputStep ¶
type WorkflowInvocation ¶
type WorkflowInvocation struct { History string `json:"history"` History_Id string `json:"history_id"` Id string `json:"id"` Inputs map[string]toolInput `json:"inputs"` Model_Class string `json:"model_class"` Outputs []string `json:"outputs"` State string `json:"state"` Steps []WorkflowInvocationStep `json:"steps"` Update_Time string `json:"update_time"` Uuid string `json:"uuid"` Workflow_Id string `json:"workflow_id"` Traceboack string `json:"traceback"` // Set only if the server returns an error Err_Msg string `json:"err_msg"` // Err_Msg =="" if no error Err_Code int `json:"err_code"` // Err_Code=="" if no error }
When a workflow is launched, it is returned by the server
type WorkflowInvocationStep ¶
type WorkflowInvocationStep struct { Action string `json:"action"` Id string `json:"id"` Job_Id string `json:"job_id"` Model_Class string `json:"model_class"` Order_Index int `json:"order_index"` State string `json:"state"` Update_Time string `json:"update_time"` Workflow_Step_Id string `json:"workflow_step_id"` Workflow_Step_Label string `json:"workflow_step_label"` Workflow_Step_Uuid string `json:"workflow_step_uuid"` }
One of the steps given after invocation of the workflow
type WorkflowLaunch ¶
type WorkflowLaunch struct { History_id string `json:"history_id"` // Id of history Workflow_id string `json:"workflow_id"` // Id of the tool Inputs map[string]toolInput `json:"inputs"` // Inputs: key name of the input, value dataset id Parameters map[int]map[string]string `json:"parameters"` // Parameters to the workflow : key: Step id, value: map of key:value parameters }
func (*WorkflowLaunch) AddFileInput ¶
func (wl *WorkflowLaunch) AddFileInput(inputIndex string, fileId string, fileSrc string)
Add new input file to the workflow
- inputIndex : index of this input in the workflow (see WorkflowInfo / GetWorkflowById)
- fielId: id of input file
- fielScr : one of ["ldda", "ld", "hda", "hdca"]
func (*WorkflowLaunch) AddParameter ¶
func (wl *WorkflowLaunch) AddParameter(stepIndex int, paramName string, paramValue string)
Add new parameter to workflow launcher
- fielId: id of input file
- fielScr : one of ["ldda", "ld", "hda", "hdca"]
type WorkflowStatus ¶
type WorkflowStatus struct {
// contains filtered or unexported fields
}
Information about status of a workflow run
- General status
- Status of each step
- Output file ids of each steps
func (*WorkflowStatus) ListStepRanks ¶
func (ws *WorkflowStatus) ListStepRanks() (stepRanks []int)
Gets the list of all the step ranks/numbers
func (*WorkflowStatus) Status ¶
func (ws *WorkflowStatus) Status() string
Returns the global status of the workflow. It is computed as follows:
- If all steps are "ok": then == "ok"
- Else if one step is "deleted": then == "deleted"
- Else if one step is "running": then == "running"
- Else if one step is "queued": then == "queued"
- Else if one step is "waiting": then == "waiting"
- Else if one is is "new": then == "new"
- Else : Unknown state
func (*WorkflowStatus) StepOutFileNames ¶
func (ws *WorkflowStatus) StepOutFileNames(stepRank int) (fileNames []string, err error)
Gets the output file names of the given step number and having the given name
If the step does not exist, returns an error.
func (*WorkflowStatus) StepOutputFileId ¶
func (ws *WorkflowStatus) StepOutputFileId(stepRank int, filename string) (fileId string, err error)
Gets the output file id of the given step number and having the given name
If the step does not exist or the file with the given name does not exist, returns an error.
func (*WorkflowStatus) StepStatus ¶
func (ws *WorkflowStatus) StepStatus(stepRank int) (status string, err error)
Gets the status of the given step number
If the step number does not exist, then returns an error