
En esta publicación, describiré cómo he usado el API bio.herramientas para registrar algunas herramientas de jvarkit.
Autenticarse con sus credenciales
usando curl, el servicio ‘bio.tools’ devuelve una autenticación simbólico.
$ curl -s -H "Content-type: application/json" -X POST -d '' https://bio.tools/api/auth/login | python -m json.tool
Crear un JSON que describa la herramienta.
La herramienta que voy a usar es VCFcabeza. Una herramienta muy sencilla que imprime las primeras variantes de un archivo VCF. En jvarkit No escribo el código analizando los argumentos, todo se describe usando un XML archivo que va a ser procesado con un hoja de estilo XSTL para generar un código java abstracto manejando las opciones, etc….
xsltproc command2java VcfHead.xml > AbstractVcfHead.java
Para VcfCabeza el descriptor XML está disponible aquí: https://github.com/lindenb/jvarkit/blob/master/src/main/java/com/github/lindenb/jvarkit/tools/misc/VcfHead.xml.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <app xmlns="http://github.com/lindenb/jvarkit/" xmlns:h="http://www.w3.org/1999/xhtml" app="VcfHead" package="com.github.lindenb.jvarkit.tools.misc" > <description>Print the first variants of a VCF.</description> <input type="vcf"/> <output type="vcf"/> <options> <option name="count" type="int" opt="n" longopt="count" min-inclusive="0" default="10"> <description>number of variants to be printed</description> </option> </options> <documentation> <h:h3>Example</h:h3> (...) </documentation> </app>
Usando una primera hoja de estilo XSLT https://github.com/lindenb/jvarkit/blob/master/src/main/resources/xsl/jsonxelixir.xsl‘VcfHead.xml’ se convierte primero en ‘infame’ JSONx (JSON+XML) formato.
xsltproc jsonxelixir VcfHead.xml > VcfHead.jsonx
El JSONx archivo:
<?xml version="1.0"?> <jsonx:object xmlns:jsonx="http://www.ibm.com/xmlns/prod/2009/jsonx" xmlns:c="http://github.com/lindenb/jvarkit/" xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://www.ibm.com/xmlns/prod/2009/jsonx"> <jsonx:string name="accessibility">Public</jsonx:string> <jsonx:string name="affiliation">univ-nantes.fr</jsonx:string> <jsonx:string name="cost">Free</jsonx:string> <jsonx:array name="platform"> <jsonx:string>Linux</jsonx:string> <jsonx:string>Mac</jsonx:string> </jsonx:array> <jsonx:string name="version">1.0</jsonx:string> <jsonx:string name="homepage">https://github.com/lindenb/jvarkit/wiki/VcfHead</jsonx:string> <jsonx:array name="function"> <jsonx:object> <jsonx:array name="input"> <jsonx:object> <jsonx:object name="dataType"> <jsonx:string name="term">File name</jsonx:string> <jsonx:string name="uri">http://edamontology.org/data_1050</jsonx:string> </jsonx:object> <jsonx:array name="dataFormat"> <jsonx:object> <jsonx:string name="term">VCF</jsonx:string> <jsonx:string name="uri">http://edamontology.org/format_3016</jsonx:string> </jsonx:object> </jsonx:array> </jsonx:object> </jsonx:array> <jsonx:array name="output"> <jsonx:object> <jsonx:object name="dataType"> <jsonx:string name="term">File name</jsonx:string> <jsonx:string name="uri">http://edamontology.org/data_1050</jsonx:string> </jsonx:object> <jsonx:string name="dataDescription">any format</jsonx:string> <jsonx:array name="dataFormat"> <jsonx:object> <jsonx:string name="term">VCF</jsonx:string> <jsonx:string name="uri">http://edamontology.org/format_3016</jsonx:string> </jsonx:object> </jsonx:array> </jsonx:object> </jsonx:array> <jsonx:array name="functionName"> <jsonx:object> <jsonx:string name="term">Formatting</jsonx:string> <jsonx:string name="uri">http://edamontology.org/operation_0335</jsonx:string> </jsonx:object> </jsonx:array> <jsonx:string name="functionDescription">Print the first variants of a VCF.</jsonx:string> </jsonx:object> </jsonx:array> <jsonx:string name="description">Print the first variants of a VCF.</jsonx:string> <jsonx:object name="docs"> <jsonx:string name="docsTermsOfUse">https://opensource.org/licenses/MIT</jsonx:string> <jsonx:string name="docsGithub">https://github.com/lindenb/jvarkit/wiki/VcfHead</jsonx:string> <jsonx:string name="docsHome">https://github.com/lindenb/jvarkit/wiki/VcfHead</jsonx:string> <jsonx:string name="docsCitationInstructions">https://github.com/lindenb/jvarkit/wiki/Citing</jsonx:string> <jsonx:string name="docsDownloadSource">https://github.com/lindenb/jvarkit/archive/master.zip</jsonx:string> <jsonx:string name="docsDownload">https://github.com/lindenb/jvarkit/archive/master.zip</jsonx:string> </jsonx:object> <jsonx:array name="collection"> <jsonx:string>jvarkit</jsonx:string> </jsonx:array> <jsonx:object name="credits"> <jsonx:array name="creditsInstitution"> <jsonx:string>Institut du Thorax, Nantes, France</jsonx:string> </jsonx:array> <jsonx:array name="creditsDeveloper"> <jsonx:string>Pierre Lindenbaum</jsonx:string> </jsonx:array> </jsonx:object> <jsonx:array name="interface"> <jsonx:object> <jsonx:string name="interfaceType">Command line</jsonx:string> </jsonx:object> </jsonx:array> <jsonx:string name="name">VcfHead</jsonx:string> <jsonx:array name="topic"> <jsonx:object> <jsonx:string name="term">Omics</jsonx:string> <jsonx:string name="uri">http://edamontology.org/topic_3391</jsonx:string> </jsonx:object> </jsonx:array> <jsonx:string name="license">MIT License</jsonx:string> <jsonx:array name="language"> <jsonx:string>Java</jsonx:string> </jsonx:array> <jsonx:array name="resourceType"> <jsonx:string>Tool</jsonx:string> </jsonx:array> <jsonx:string name="maturity">Stable</jsonx:string> <jsonx:array name="contact"> <jsonx:object> <jsonx:string name="contactURL">https://github.com/lindenb</jsonx:string> <jsonx:string name="contactName">Pierre Lindenbaum</jsonx:string> <jsonx:array name="contactRole"> <jsonx:string>Developer</jsonx:string> <jsonx:string>Maintainer</jsonx:string> <jsonx:string>Helpdesk</jsonx:string> </jsonx:array> </jsonx:object> </jsonx:array> <jsonx:object name="publications"> <jsonx:string name="publicationsPrimaryID">doi:10.6084/m9.figshare.1425030.v1</jsonx:string> </jsonx:object> </jsonx:object>
usando otro XSLT hoja de estilo jsonx2json.xslel JSONx se convierte en un JSON archivo.
xsltproc jsonx2json.xsl VcfHead.jsonx > VcfHead.json
el archivo JSON:
Registro de la herramienta
Ahora tenemos el Simbólico y el descriptor json podemos agregar VcfCabeza a Elixir usando curl:
curl -H "Content-type: application/json" -H "Authorization: Token 74dedea023dbad8ecda49ac57bb1074acd794f" -X POST -d @path/to/VcfHead.json "https://bio.tools/api/tool" | python -m json.tool
producción:
{ "accessibility": "Public", "additionDate": "2016-02-24T11:37:17.458Z", "affiliation": "univ-nantes.fr", "collection": [ "jvarkit" ], "contact": [ { "contactName": "Pierre Lindenbaum", "contactRole": [ "Developer", "Maintainer", "Helpdesk" ], "contactURL": "https://github.com/lindenb" (...)
VCfhead ahora es visible desde Elixir Registry en https://bio.tools/tool/univ-nantes.fr/VcfHead/1.0.
Eso es todo,
Pedro.