view gmql_rest_datasets_upload.xml @ 0:078d77023c34 draft default tip

planemo upload for repository https://github.com/lu-brn/gmql-galaxy commit 953ee36ceda5814dc9baa03427bc0eb4ee2e93bd-dirty
author geco-team
date Tue, 26 Jun 2018 08:59:19 -0400
parents
children
line wrap: on
line source

<tool id="gmql_upload" name="GMLQ Upload Dataset" version="0.1.1">
  <macros>
    <import>gmql_rest_macros.xml</import>
  </macros>
  <command><![CDATA[
      python $__tool_directory__/gmql_rest_datasets.py $output
	  -user=$authToken
	  -dataset=$name
	  #if $upload.source == 'remote'
	   -cmd=upload_url
	   #if $upload.schema.schema_type == "custom" :
	    -schema=$upload.schema.schema_url
	   #else :
	    -schema=$upload.schema.schema_type
	   #end if
	   -samples=$upload.samples_urls
	  #else:
	   -cmd=upload
	   #if $upload.schema_local.schema_type == "custom" :
	    -schema=$upload.schema_local.schema
	   #else :
	    -schema=$upload.schema_local.schema_type
	   #end if
	    -samples=$samples
	  #end if
	    -add_output=$updated_list
	  ]]></command>
    <configfiles>
        <configfile name="samples" >#if $upload.source == 'local' :
            #if $upload.stype.st_flag == 'one' :
            #echo '%s\t%s\n'%($upload.stype.samples.name,$upload.stype.samples)
            #else :
            #for $i in $upload.stype.samples :
            #echo '%s\t%s\n'%($i.name,$i)
            #end for
            #end if
            #end if
            <!-- #if $upload.samples.is_collection :
            #for $i in $upload.samples
            #for $file in $i
            #echo '%s\t%s\n'%($file.element_identifier,$file)
            #end for
            #else :
            #echo '%s\t%s\n'%($i.name,$i)
            #end if
            #end for
            #else :
            #echo '%s\t%s\n'%($upload.samples.name,$upload.samples)
            #end if
            #end if -->
        </configfile>
    </configfiles>
  <code file="dynamic_utils.py">
      <hook validate_input="validate_upload" />
  </code>
  <inputs>
	<param format="gmql_user" name="authToken" type="data" label="Select user" />
	<param name="name" type="text" label="Name of the new dataset" >
		<validator type="regex" message="Only alphanumeric characters and underscore are allowed">[\w]+$</validator>
	</param>
	<conditional name="upload">
		<param name="source" type="select" label="Upload from local or another server" display="radio" multiple="false">
            <option value="local">Local</option>
            <option value="remote">Provide Urls</option>
        </param>
		<when value="remote">
			<conditional name="schema">
				<param name="schema_type" type="select" label="File type" >
					<option value="bed">bed</option>
					<option value="bedGraph">bedGraph</option>
					<option value="NarrowPeak">NarrowPeak</option>
					<option value="BroadPeak">BroadPeak</option>
					<option value="vcf">vcf</option>
					<option value="custom">Custom</option>
				</param>
				<when value="custom">
					<param name="schema_url" type="text" format="text" size="80" label="Schema URL">
						<validator type="regex" message="Does not look as a valid url">[\w:/\.\?@#+-=&amp;]+$</validator>
                        <sanitizer>
                             <valid initial="default">
                                <remove value="&amp;"/>
                             </valid>
                            <mapping initial="default">
                                <add source="&amp;" target="__amp__" />
                            </mapping>
                        </sanitizer>
					</param>
				</when>
			</conditional>
			<param name="samples_urls" type="text" format="text" area="True" size="10x80" label="Samples URLs">
				<validator type="regex" message="Please one url per line">[\w:/\.\?@#+-=%&amp;]+(\n[\w:/\.\?@#+-=%&amp;]+)*$</validator>
                <sanitizer>
                    <valid initial="default">
                        <remove value="&amp;"/>
                    </valid>
                    <mapping initial="default">
                        <add source="X" target="__cn__" />
                        <add source="&amp;" target="__amp__" />
                    </mapping>
                </sanitizer>
			</param>
        </when>
		<when value="local">
            <conditional name="schema_local">
				<param name="schema_type" type="select" label="File type" >
					<option value="bed">bed</option>
					<option value="bedGraph">bedGraph</option>
					<option value="NarrowPeak">NarrowPeak</option>
					<option value="BroadPeak">BroadPeak</option>
					<option value="vcf">vcf</option>
					<option value="custom">Custom</option>
				</param>
				<when value="custom">
					<param name="schema" type="data" format="xml" label="Schema XML Definition" />
				</when>
			</conditional>
            <conditional name="stype">
                <param name="st_flag" type="select" display="radio" label="Single Sample or Collection?">
                    <option value="one">Single Sample</option>
                    <option value="more">Collection</option>
                </param>
                <when value="one">
                    <param name="samples" type="data" label="Data: " />
                </when>
                <when value="more">
                    <param name="samples" type="data_collection" collection_type="list" label="Data: "/>
                </when>
            </conditional>
		</when>
	</conditional>
  </inputs>
  <outputs>
     <data format="tabular" name="output" label="${name} updated samples" >
            <actions>
                <action name="column_names" type="metadata" default="id,sample,ext" />
            </actions>
      </data>
      <data format="gmql_repository" name="updated_list" label="${authToken.name.split()[0].rstrip('')} GMQL Datasets">
           <actions>
                <action name="column_names" type="metadata" default="dataset,owner" />
            </actions>
       </data>
  </outputs>
  <tests>
      <test>
          <param name="authToken" value="guest.gmql_user" />
          <param name="name" value="test1" />
          <conditional name="upload">
              <param name="source" value="remote" />
              <conditional name="schema">
                  <param name="schema_type" value="custom" />
                  <param name="schema_url" value="http://www.bioinformatics.deib.polimi.it/canakoglu/guest_data/HG19_ANN.schema" />
              </conditional>
              <param name="samples_urls" value="http://www.bioinformatics.deib.polimi.it/canakoglu/guest_data/VistaEnhancers_hg19.bed" />
          </conditional>
           <output name="updated_list" ftype="gmql_repository">
                <assert_contents>
                    <has_n_columns n="2" />
                    <has_line_matching expression="test1\t.+" />
                </assert_contents>
           </output>
           <output name="output" ftype="gmql_repository">
               <metadata name="name" value="test1 updated samples" />
                <assert_contents>
                    <has_n_columns n="3" />
                    <has_line_matching expression=".+\tVistaEnhancers_hg19\tbed.+" />
                </assert_contents>
           </output>
      </test>
      <test>
          <param name="authToken" value="guest.gmql_user" />
          <param name="name" value="test2" />
          <conditional name="upload">
              <param name="source" value="local" />
              <conditional name="schema_local">
                  <param name="schema_type" value="bed" />
              </conditional>
              <conditional name="stype">
                  <param name="stflag" value="one" />
                  <param name="samples" value="sample2.bed" />
              </conditional>
          </conditional>
          <output name="updated_list" ftype="gmql_repository">
                <assert_contents>
                    <has_n_columns n="2" />
                    <has_line_matching expression="test2\t.+" />
                </assert_contents>
           </output>
           <output name="output" ftype="gmql_repository">
               <metadata name="name" value="test2 updated samples" />
                <assert_contents>
                    <has_n_columns n="3" />
                    <has_text text="sample2" />
                </assert_contents>
           </output>
      </test>
      <test>
          <param name="authToken" value="guest.gmql_user" />
          <param name="name" value="test3" />
          <conditional name="upload">
              <param name="source" value="local" />
              <conditional name="schema_local">
                  <param name="schema_type" value="bed" />
              </conditional>
              <conditional name="stype">
                  <param name="stflag" value="more" />
                  <param name="samples">
                      <collection type="list">
                          <element name="sample1" value="sample1.bed" />
                          <element name="sample2" value="sample2.bed" />
                      </collection>
                  </param>
              </conditional>
          </conditional>
          <output name="updated_list" ftype="gmql_repository">
                <assert_contents>
                    <has_n_columns n="2" />
                    <has_line_matching expression="test3\t.+" />
                </assert_contents>
           </output>
           <output name="output" ftype="gmql_repository">
                <metadata name="name" value="test3 updated samples" />
                <assert_contents>
                    <has_n_columns n="3" />
                    <has_text text="sample1" />
                    <has_text text="sample2" />
                </assert_contents>
           </output>

      </test>
  </tests>
  <help>
It allows uploading a new dataset on the user’s private space of the GMQL Repository.

----

**What it does**

- **Upload local data**: data to upload are in the current galaxy history
- **Upload remote data**: data is on a remote location, URLs must be provided

The user must provide a name for the new dataset, the locations of the samples and their reference schema. Schema can
be a common type or custom. In this second case, schema xml or its location must be provided.

.. class:: warningmark

A gmql_user authentication token is required for every action.

----

.. class:: infomark

**File formats**

Formats accepted for data are:

- bed
- bedGraph
- NarrowPeak
- BroadPeak
- vcf


  </help>
  <expand macro="citations" />
</tool>