view metascreen.xml @ 0:600a6823fcd4 draft

Uploaded
author sigven
date Thu, 10 Nov 2022 20:47:57 +0000
parents
children
line wrap: on
line source

<tool id="metascreenPre" name="mscreen: pre-experimental" version="0.2.0">
  <description>Pre-experimental setup of drug combination screens</description>
  <command detect_errors="aggressive"><![CDATA[
      ln -s $input_data.list_of_drugs "$input_data.list_of_drugs.element_identifier" &&
      #set drugs_csv = './' + str($input_data.list_of_drugs.element_identifier)

	 ln -s $input_data.list_of_volumes "$input_data.list_of_volumes.element_identifier" &&
      #set volumes_csv = './' + str($input_data.list_of_volumes.element_identifier)

	 ln -s $input_data.list_of_doses "$input_data.list_of_doses.element_identifier" &&
      #set doses_csv = './' + str($input_data.list_of_doses.element_identifier)

	 ln -s $input_data.list_of_ctrls "$input_data.list_of_ctrls.element_identifier" &&
      #set ctrls_csv = './' + str($input_data.list_of_ctrls.element_identifier)

	 ln -s $input_data.list_of_stock_cons "$input_data.list_of_stock_cons.element_identifier" &&
      #set stock_cons_csv = './' + str($input_data.list_of_stock_cons.element_identifier)

	 #for $pmap in $input_data.platemaps
	 	ln -s '$pmap' '$pmap.element_identifier';
	 #end for


	 #set excluded_well_ids_file = ''
      #if $dispensing_options.well_exclusion.exclude_wells
	      echo $dispensing_options.well_exclusion.well_ids | sed 's/__cn__/\n/g' > excl_well_ids.csv &&
	      #set excluded_well_ids_file = './excl_well_ids.csv'
	 #end if

       R -e 'suppressPackageStartupMessages(library(metascreen));

	  custom_excluded_wells = NULL;
	  #if $excluded_well_ids_file
           custom_excluded_wells = read.csv(
		   	"$excluded_well_ids_file", stringsAsFactors = F, header = F);
		 custom_excluded_wells = custom_excluded_wells[[1]];
       #end if

	  list_of_drugs_raw <- read.csv(
  		file = "$drugs_csv",
  		check.names = FALSE,
  		na.strings = "",
  		dec = ".", encoding = "UTF-8");
	  list_of_volumes_raw <- read.csv(
		file = "$volumes_csv",
		check.names = FALSE,
		na.strings = "",
		dec = ".", encoding = "UTF-8");
	  list_of_doses_raw <- read.csv(
     	file = "$doses_csv",
     	check.names = FALSE,
     	na.strings = "",
     	dec = ".", encoding = "UTF-8");
	  list_of_controls_raw <- read.csv(
	     file = "$ctrls_csv",
	     check.names = FALSE,
	     na.strings = "",
	     dec = ".", encoding = "UTF-8");
	  list_of_stock_cons_raw <- read.csv(
		file = "$stock_cons_csv",
		check.names = FALSE,
		na.strings = "",
		dec = ".", encoding = "UTF-8");

	  listofDoses <-
        	metascreen::generateListofDoses(
          		list_of_doses_raw,
          		.dropCol = TRUE);


       sourcePlate = data.frame();
	  #for $pmap in $input_data.platemaps

	     sourcePlate = dplyr::bind_rows(
	         sourcePlate,
     	    metascreen::importPlateMap(
       	   		"$pmap.element_identifier",
             		.fileFormat = "PlateMap",
				galaxy = TRUE,
             		.sourcePlateConv = $input_data.convert_platemap_format
			)
		);
	  #end for

	  combine_doses = c(1:min(unique(table(listofDoses[,"Drug"]))));
	  exclude_outer_wells = FALSE;

	  #if $dispensing_options.well_exclusion.exclude_wells
	  	exclude_outer_wells = $dispensing_options.well_exclusion.outer_wells;
	  #end if

	  #if $combination_options.combo_design.type_combination == "all"
	  	#if $combination_options.combo_design.inner_dosing
			combine_doses = c(2:(min(unique(table(listofDoses[,"Drug"])))-1));
		#end if
	  #end if

	  add_untreated = NULL;
	  #if $dispensing_options.add_untreated.untreated
	     add_untreated = list(
			name = "$dispensing_options.add_untreated.untreated_name",
		     replicates = $dispensing_options.add_untreated.untreated_replicates);
	  #end if


	  listofExWells <-
     	metascreen::excludeWells(
			plateType = $input_data.plateformat,
			wells = custom_excluded_wells,
			outer.wells = exclude_outer_wells);


	  listofCombinations <-
     	metascreen::combineDrugs(
       		listofDoses,
       		.combineDoses = combine_doses,
       		.noReplicates = $combination_options.num_replicates,
       		.drugRepAttrib = "$combination_options.combo_design.type_combination");


	  dispensingData <-
     	metascreen::generateDispensingData(
       		listofCombinations,
       		list_of_drugs_raw,
       		listofDoses,
       		list_of_volumes_raw,
       		list_of_controls_raw,
       		list_of_stock_cons_raw,
       		sourcePlate,
       		listofExWells,
       		.ctrlReplicates = $dispensing_options.num_control_replicates,
       		.addUntreated = add_untreated,
       		.finalWellVolume = $dispensing_options.well_volume,
       		.plateFormat = $input_data.plateformat,
       		.destinationPlateID = "$dispensing_options.dest_plate_ID",
       		.randomizeDispensing = $dispensing_options.randomise_dispensing,
       		.probeDispensing = $dispensing_options.probe_dispensing);

	   df = as.data.frame(dispensingData[["output"]]);
	   readr::write_tsv(listofCombinations,file="$doseComb",col_names=T, quote="none");
	   readr::write_tsv(df,file="$dispensingDF", col_names = T, quote = "none");' 2>&1

  ]]></command>
  <inputs>

      <section name="input_data" title="User-defined input files - see below for strict formatting requirements" expanded="true">
        <param name="list_of_doses" type="data" format="txt" label="List of drug doses (CSV)" multiple="false"/>
	   <param name="list_of_drugs" type="data" format="txt" label="List of drugs (CSV)" multiple="false"/>
	   <param name="list_of_volumes" type="data" format="txt" label="List of volumes (CSV)" multiple="false"/>
	   <param name="list_of_ctrls" type="data" format="txt" label="List of controls (CSV)" multiple="false"/>
	   <param name="list_of_stock_cons" type="data" format="txt" label="List of stock concentrations (CSV)" multiple="false"/>
	   <param name="platemaps" type="data" format="xml" label="PlateMap file (XML)" multiple="true"/>
        <param name="convert_platemap_format" type="boolean" label="Convert platemap to a source plate format" truevalue="T" falsevalue="F" checked="false"/>
        <param name="plateformat" type="select" label="Plate format" display="radio" multiple="false">
		  <option value="6">6</option>
		  <option value="12">12</option>
		  <option value="24">24</option>
		  <option value="48">48</option>
		  <option value="96">96</option>
		  <option value="384">384</option>
            <option value="1536">1536</option>
	   </param>
      </section>

	 <section name="combination_options" title="Options - drug combination design" expanded="true">
		 <conditional name="combo_design">
		 	<param name="type_combination" type="select" display="radio" multiple="false" label="Type of dose combinations">
			 	<option value="all">All - both single treatments and combination treatments</option>
			 	<option value="single">Single - only single treatments</option>
		 	</param>
			<when value="all">
				<param name="inner_dosing" type="boolean" label="Exclude lowest and highest dose (inner dosing only)" truevalue="T" falsevalue="F" checked="false"/>
			</when>
		</conditional>
		 <param type="integer" name="num_replicates" label="Number of replicates for each dose combination" value="3" min="1" max="20"/>
	 </section>
	 <section name="dispensing_options" title="Options - dispensing layout" expanded="true">
		 <conditional name="well_exclusion">
	 		<param name="exclude_wells" type="boolean" label="Exclusion of wells" truevalue="T" falsevalue="F" checked="false"/>
	 		<when value="T">
				<param name="well_ids" type="text" label="Custom set of well identifiers to exclude (one per line):" area="true"/>
				<param name="outer_wells" type="boolean" label="Exclude all outer wells" truevalue="T" falsevalue="F" checked="true"/>
			</when>
		</conditional>
		<param name="num_control_replicates" type="integer" label="Number of control replicates" value="5" min="1" max="10"/>
		<param name="well_volume" type="integer" label="Final well volume" value="10" min="1" max="500"/>
		<param name="randomise_dispensing" type="boolean" label="Randomise dispensing" truevalue="T" falsevalue="F" checked="true"/>
		<param name="probe_dispensing" type="boolean" label="Probe dispensing" truevalue="T" falsevalue="F" checked="false"/>
		<param name="dest_plate_ID" type="text" value="PLATE_012" label="A unique destination plate ID - for destination plate barcode"/>
		<conditional name="add_untreated">
		    <param name="untreated" type="boolean" label="Add untreated" truevalue="T" falsevalue="F" checked="true"/>
		    <when value="T">
			    <param name="untreated_name" type="text" label="Identifier (name) for untreated" value="Untreated"/>
			    <param name="untreated_replicates" type="integer" label="Number of untreated replicates" value="5" min="1" max="500"/>
		    </when>
	    </conditional>

	</section>
  </inputs>
    <outputs>
        <!--data format="xlsx" name="output_xlsx" label="crisprFPA - xlsx"/-->
        <data format="txt" name="doseComb" label="doseCombinations - tsv"/>
	   <data format="txt" name="dispensingDF" label="dispensingData - tsv"/>
    </outputs>


  <help><![CDATA[
.. class:: infomark

Limitations etc:

-----

**Dataset formats**

The input datasets are in text_ (CSV) format and in XML format. The output datasets are also in text_ formats.

.. _text: ${static_path}/formatHelp.html#text

Specific input file requirements:

-  **List of drug doses** - `CSV <https://en.wikipedia.org/wiki/Comma-separated_values/>`_ file

   Provides a list of all the doses for each drug used in
   a drug sensitivity screen. The list needs to include a column with the drug number,
   drug name, one or multiple columns for the doses, and a column with the unit.
   ['Number', 'Drug',	'6th Dose', ..., '1st Dose', 'Unit'].
   An example is shown with https://raw.githubusercontent.com/Enserink-lab/metascreen/main/inst/extdata/library/listofdoses.csv

-  **List of drugs.** - `CSV <https://en.wikipedia.org/wiki/Comma-separated_values/>`_ file

   Provides a list of drugs used in the drug screen. The list
   needs to include a column with a unique drug number / id for each drug, the
   drug name and the CAS number. ['ID', 'NAME', 'CAS_NUMBER']. For custom
   compunds without CAS number, include column, but leave field empty.
   An example is shown with https://raw.githubusercontent.com/Enserink-lab/metascreen/main/inst/extdata/library/listofdrugs.csv

- **List of stock concentrations.** - A `CSV <https://en.wikipedia.org/wiki/Comma-separated_values/>`_ file

   Provides a list of the stock concentrations
   for each drug used in the drug screen. If the stock concentrations are not
   known, use the highest dose. The list  needs to include column with the unique
   drug number / id, the drug name, the stock concentration and the concentration unit.
   ['NUMBER', 'NAME', 'CONCENTRATION', 'UNIT'].
   An example is shown with https://raw.githubusercontent.com/Enserink-lab/metascreen/main/inst/extdata/library/listofstockconcentrations.csv

 - **List of controls.** - A `CSV <https://en.wikipedia.org/wiki/Comma-separated_values/>`_ file

   Provides the controls to be used in a drug
   screen. The list needs to include a column with the name, CAS number,
   dose, unit, the source plate from which the control is dispensed from and the
   volume. ['NAME', 'CAS_NUMBER', 'DOSE', 'UNIT', 'SOURCE_PLATE', 'VOLUME'].
   An example is shown with https://raw.githubusercontent.com/Enserink-lab/metascreen/main/inst/extdata/library/listofctrls.csv

 - **List of drug volumes.** - A `CSV <https://en.wikipedia.org/wiki/Comma-separated_values/>`_ file

   Provides the volumes for each drug that
   have been or will be dispensed. The list follows the same format as the
   list of drug doses. The list needs to include a column with the drug  number,
   drug name, one or multiple columns with doses, and a column with the unit.
   ['Number', 'Drug',	'Vol 6th Dose', ..., 'Vol 1st Dose', 'Unit'].
   An example is shown with https://raw.githubusercontent.com/Enserink-lab/metascreen/main/inst/extdata/library/listofvolumes.csv


 - **plateMap** - XML file (s)

   One or more plate map files with the contents (usually compounds/drugs) of the
   source plate from which drugs are dispensed from. Plate maps can currently be imported
   using .PlateMap (XML files) provided by the IncuCyte® Plate Map Editor. **IMPORTANT: when uploading
   PlateMap files to Galaxy, please make sure you denote file 'Type' as XML.**

   An example is shown with https://github.com/Enserink-lab/metascreen/blob/main/inst/extdata/library/C008.PlateMap

-----

**What it does**

The *pre-experimental* modules of metascreen is intended to serve the following purposes:

allowing to set-up a drug combination screens by (a) generating drug combinations from a list of drugs and
(b) distributing those drug combinations across a number of experimental plates. (c) generating instructions
for dispensing robots for the creation of those experimental plates.






]]>
  </help>

</tool>