bgruening / galaxytools

:microscope::books: Galaxy Tool wrappers
MIT License
116 stars 234 forks source link

question about my first galaxy tool #1112

Open ZeroDesigner opened 3 years ago

ZeroDesigner commented 3 years ago

hi, I am a new one to galaxy. And I want to write a new tool. My scrip is here and it's for ledock. And when it runs, errors are here:

/Users/sujiaqi/Desktop/Github/galaxy/database/jobs_directory/000/11/tool_script.sh: line 9: unexpected EOF while looking for matching `''
/Users/sujiaqi/Desktop/Github/galaxy/database/jobs_directory/000/11/tool_script.sh: line 10: syntax error: unexpected end of file

So my question is : how can I fix the problem. And I also want to know , when I upload my file to galaxy , where my file is (the path) .

import os
import sys
import zipfile

conf = '''
Receptor
pro.pdb

RMSD
1.0

Binding pocket
xmin xmax
ymin ymax
zmin zmax

Number of binding poses
20

Ligands list
ligands

END
'''

zip_file = zipfile.ZipFile(sys.argv[2])
zip_file.extractall()
zip_file.close()

mol_file = [i for i in  os.listdir() if 'mol2' in i]

mol_str = ''
for i in mol_file:
    mol_str = mol_str + i + '\n'

conf = conf.replace('pro.pdb',sys.argv[1])
conf = conf.replace('ligands',mol_str)
conf = conf.replace('1.0',sys.argv[3])
conf = conf.replace('xmin',sys.argv[4])
conf = conf.replace('xmax',sys.argv[5])
conf = conf.replace('ymin',sys.argv[6])
conf = conf.replace('ymax',sys.argv[7])
conf = conf.replace('zmin',sys.argv[8])
conf = conf.replace('zmax',sys.argv[9])
conf = conf.replace('20',sys.argv[10])

f = open('dock.in','w+')
f.write(conf)
f.close()
os.system('ledock_mac dock.in')

f_z = zipfile.ZipFile(sys.argv[11], 'w')
for i in os.listdir('./'):
    f_z.write(i, sys.argv[11], zipfile.ZIP_DEFLATED)
f_z.close()
simonbray commented 3 years ago

I'm not sure I fully understand the question, but it seems there is some error in the XML wrapper.

All the best,

Simon

bgruening commented 3 years ago

@ZeroDesigner please have a look at https://planemo.readthedocs.io/en/latest/standards/docs/best_practices.html this will get you started in Galaxy tool development. Please try planemo it will for example lint your XML file and point you to the errors.

ZeroDesigner commented 3 years ago

I'm not sure I fully understand the question, but it seems there is some error in the XML wrapper.

All the best,

Simon

XML file is here.

<tool id="ledock001" name="easy ledock" version="0.0.1" >
  <description>easy for ledock</description>
  <requirements>
    <requirement type="package" version="v1.0">LeDock</requirement>
    <requirement type="package" version="3.5~3.7">Python</requirement>
  </requirements>
    <command>
    <![CDATA[
        python '/Users/sujiaqi/Desktop/Github/GalaxyNote/galaxy_tool/ledock_1/ledock.py'
        '$protein_file' '$lig_list' $RMSD' '$xmin' '$xmax' '$ymin' '$ymax' '$zmin' '$zmax' '$RMSD' 
    ]]>
    </command>
  <inputs>
    <param format="pdb" name="protein_file" type="data" label="protein file"/>
    <param name="lig_list" type="data" format="zip" label="lig file"/>
    <param name="RMSD" type="float" value="1"  min="0" max="2" label="RMSD"/>
    <param name="xmin" type="float" value="0" min="-1000" max="1000" label="xmin"/>
    <param name="xmax" type="float" value="0" min="-1000" max="1000" label="xmax"/>
    <param name="ymin" type="float" value="0" min="-1000" max="1000" label="ymin"/>
    <param name="ymax" type="float" value="0" min="-1000" max="1000" label="ymax"/>
    <param name="zmin" type="float" value="0" min="-1000" max="1000" label="zmin"/>
    <param name="zmax" type="float" value="0" min="-1000" max="1000" label="zmax"/>
    <param name="nbp" type="integer" value="20" min="0" max="100" label="num of pose"/>
  </inputs>

  <outputs>
    <data format="txt" type="data" name="out" />
  </outputs>

  <help>
this tool is designed for docking
  </help>

</tool>
simonbray commented 3 years ago

Hi @ZeroDesigner,

check the command - a ' is missing before $RMSD.

Can you spend some time looking at this tutorial please? https://planemo.readthedocs.io/en/latest/writing_standalone.html

Also, can I ask how you plan to deploy this tool? It seems Ledock is proprietary software and you will have problems deploying it on a public-facing server.

ZeroDesigner commented 3 years ago

Hi @ZeroDesigner,

check the command - a ' is missing before $RMSD.

Can you spend some time looking at this tutorial please? https://planemo.readthedocs.io/en/latest/writing_standalone.html

Also, can I ask how you plan to deploy this tool? It seems Ledock is proprietary software and you will have problems deploying it on a public-facing server.

Thank You,I will read the tutorial carefully. I will deploy it on local computer without facing the public. And if necessary, I will contact the lephar to see whether we can deloy it on a public server.