Bonjour,
Volontier, voilà le code xml :
<tool id="export" name="export data" version="1.2"> <description interpreter="bash">export an history data, WARNING this tool duplicate the data, remember to delete redundant data</description> <command interpreter="bash">export.sh -i $input -f "$input.name" -n $name -e $__root_dir__ -o $output</command> <inputs> <param name="input" type="data" label="Source file"/> <param name="name" label="Name of the data" type="text" size="50" help="No space or accent in the name"> <validator type="regex" message="Use only alphanumeric characters or tidashret or underscore and only one dot">[A-Za-z0-9_-.]+$</validator> </param> </inputs> <outputs> <data format="txt" name="output" label="log of export of $input.name in /project/export/$name"/> </outputs> <help>
.. class:: warningmark
WARNING: this tool duplicates the data, remember to delete redundant data.
.. class:: warningmark
WARNING: this tool duplicates the data, remember to delete redundant data.
.. class:: warningmark
WARNING: this tool duplicates the data, remember to delete redundant data.
.. class:: warningmark
WARNING: this tool duplicates the data, remember to delete redundant data.
.. class:: warningmark
WARNING: this tool duplicates the data, remember to delete redundant data.
</help> </tool>
Et le code shell :
#!/bin/bash
while getopts "i:f:n:e:o:" optionName; do case "$optionName" in
i) INPUT="$OPTARG";; f) INPUT_NAME="$OPTARG";; n) NAME="$OPTARG";; e) EXPORT_DIR="$OPTARG";; o) OUTPUT="$OPTARG";; esac done
EXPORT_DIR=$EXPORT_DIR/../projets/export a=`echo $NAME | sed 's/[A-Za-z0-9_-]//g' | sed 's/.//'` if [ -z "${a}" ]; then if [ -e "$EXPORT_DIR/$NAME" ]; then echo "$EXPORT_DIR/$NAME already exists: delete file or change the name" >&2 exit 1 elif [ `du -c $EXPORT_DIR | grep 'total' | awk '{print $1}'` -gt 104857600 ]; then echo "$EXPORT_DIR is too large: move or delete files \nif you do not have permission,please contact an admin" >&2 exit 1 else echo -e "command : cp $INPUT_NAME $EXPORT_DIR/$NAME\n" > $OUTPUT cp "$INPUT" "$EXPORT_DIR/$NAME" chmod 660 "$EXPORT_DIR/$NAME" echo -e "$INPUT_NAME \nhave been copied in \n$EXPORT_DIR \nand named \n$NAME \nWARNING: this tool duplicates the data, remember to delete redundant data.">> $OUTPUT fi else e=0 while [ $e -lt `echo ${#a}` ]; do if [ ${a:$e:$e+1} == "." ]; then echo "too many points ('.' character) in the filename" >&2 exit 1 else echo "wrong character in the filename" >&2 exit 1 fi ; e=$(($e+1)) done fi
Il faut auparavant créer un répertoire $GALAXY-DIST/../projets/export avec les bons droits (rws pour le groupe) de façon à ce que l'utilisateur puisse récupérer la donnée.
Si besoin je peux répondre aux questions et j'ai utilisé du shell mais c pas une obligation ;).
Fabien
Salut,
J'avais aussi pensé a écrire un outil dans le style, mais j'ai finalement choisit la solution que j'ai exposé plus tôt dans la semaine..
Je reste interressé par tester ton outil, si tu peux partager le code sur la liste..
Merci!
Alban
-- Alban Lermine Unité 900 : Inserm - Mines ParisTech - Institut Curie « Bioinformatics and Computational Systems Biology of Cancer » 11-13 rue Pierre et Marie Curie (1er étage) - 75005 Paris - France Tel : +33 (0) 1 56 24 69 84
Galaxy-France mailing list Galaxy-France@lists.bx.psu.edu http://lists.bx.psu.edu/listinfo/galaxy-france