Start of a 'package' format for xml files which should be distributed together.

Uses xslt scripts to transform packages into build scripts.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1005 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-06-15 00:52:48 +00:00
parent 0583459839
commit 93dc2cdc70
2 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="package">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="project.name" select="name" />
<xsl:variable name="ant.basedir" select="'${basedir}'" />
<xsl:variable name="sting.dir" select="'${sting.dir}/'" />
<xsl:variable name="staging.dir" select="'${sting.dir}/staging'" />
<xsl:variable name="package.dir" select="'${package.dir}/'" />
<xsl:variable name="resources.dir" select="'${package.dir}/resources'" />
<project name="{$project.name}" default="package" basedir="..">
<property name="sting.dir" value="{$ant.basedir}" />
<property name="package.dir" value="{concat($ant.basedir,'/packages/',$project.name)}" />
<target name="package">
<mkdir dir="{$package.dir}"/>
<mkdir dir="{$resources.dir}"/>
<copy todir="{$resources.dir}">
<classfileset dir="{$staging.dir}">
<root classname="{main-class}"/>
<xsl:for-each select="dependencies/class">
<root classname="{current()}" />
</xsl:for-each>
</classfileset>
</copy>
<xsl:for-each select="scripts/file">
<xsl:variable name="short.name">
<xsl:call-template name="get-short-name">
<xsl:with-param name="string" select="." />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="full.path">
<xsl:call-template name="get-full-path">
<xsl:with-param name="working-dir" select="$sting.dir"/>
<xsl:with-param name="file" select="."/>
</xsl:call-template>
</xsl:variable>
<symlink link="{concat($package.dir,$short.name)}" resource="{$full.path}" overwrite="true" />
</xsl:for-each>
<xsl:for-each select="resources/file">
<xsl:variable name="short.name">
<xsl:call-template name="get-short-name">
<xsl:with-param name="string" select="." />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="full.path">
<xsl:call-template name="get-full-path">
<xsl:with-param name="working-dir" select="$sting.dir"/>
<xsl:with-param name="file" select="."/>
</xsl:call-template>
</xsl:variable>
<symlink link="{concat($resources.dir,'/',$short.name)}" resource="{$full.path}" overwrite="true" />
</xsl:for-each>
</target>
</project>
</xsl:template>
<xsl:template name="get-short-name">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string,'/')">
<xsl:call-template name="get-short-name">
<xsl:with-param name="string" select="substring-after($string,'/')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$string"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-full-path">
<xsl:param name="working-dir"/>
<xsl:param name="file"/>
<xsl:choose>
<xsl:when test="starts-with($file,'/')"><xsl:value-of select="$file"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat($working-dir,$file)"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<package>
<name>ReadQualityRecalibrator</name>
<main-class>org.broadinstitute.sting.gatk.CommandLineGATK</main-class>
<dependencies>
<class>org.broadinstitute.sting.playground.gatk.walkers.CovariateCounterWalker</class>
<class>org.broadinstitute.sting.playground.gatk.walkers.LogisticRecalibrationWalker</class>
</dependencies>
<scripts>
<file>python/RecalQual.py</file>
<file>python/LogisticRegressionByReadGroup.py</file>
</scripts>
<resources>
<file>R/logistic_regression.R</file>
<file>/humgen/gsa-scr1/GATK_Data/dbsnp_129_b36.rod</file>
<file>/broad/1KG/reference/human_b36_both.fasta</file>
<file>/broad/1KG/reference/human_b36_both.dict</file>
<file>/broad/1KG/reference/human_b36_both.fasta.fai</file>
</resources>
</package>