Updates to the bundle script:
1. Add the symbolic 'current' link for the new bundle dir 2. Don't gzip and copy .out files 3. Don't call chr20 SNPs on the example BAM because it's now just a few reads on chr1
This commit is contained in:
parent
16eb1c5436
commit
18728ec5bd
|
|
@ -44,7 +44,7 @@ class GATKResourcesBundle extends QScript {
|
|||
var exampleFASTA: Reference = _
|
||||
var refs: List[Reference] = _
|
||||
|
||||
class Resource(val file: File, val name: String, val ref: Reference, val useName: Boolean = true, val makeSites: Boolean = true ) {
|
||||
class Resource(val file: File, val name: String, val ref: Reference, val useName: Boolean = true, val makeSites: Boolean = true, val makeCallsIfBam: Boolean = true ) {
|
||||
def destname(target: Reference): String = {
|
||||
if ( useName )
|
||||
return name + "." + target.name + "." + getExtension(file)
|
||||
|
|
@ -68,6 +68,7 @@ class GATKResourcesBundle extends QScript {
|
|||
|
||||
def isVCF(file: File) = file.getName.endsWith(".vcf")
|
||||
def isBAM(file: File) = file.getName.endsWith(".bam")
|
||||
def isOUT(file: File) = file.getName.endsWith(".out")
|
||||
def isFASTA(file: File) = file.getName.endsWith(".fasta")
|
||||
|
||||
var RESOURCES: List[Resource] = Nil
|
||||
|
|
@ -94,7 +95,7 @@ class GATKResourcesBundle extends QScript {
|
|||
addResource(new Resource(DATAROOT + "dbsnp_132_b37.vcf", "dbsnp_132", b37, true, false))
|
||||
|
||||
addResource(new Resource(exampleFASTA.file, "exampleFASTA", exampleFASTA, false))
|
||||
addResource(new Resource("public/testdata/exampleBAM.bam", "exampleBAM", exampleFASTA, false))
|
||||
addResource(new Resource("public/testdata/exampleBAM.bam", "exampleBAM", exampleFASTA, false, false, false))
|
||||
}
|
||||
|
||||
def initializeStandardDataFiles() = {
|
||||
|
|
@ -172,7 +173,7 @@ class GATKResourcesBundle extends QScript {
|
|||
// exampleFASTA file
|
||||
//
|
||||
addResource(new Resource(exampleFASTA.file, "exampleFASTA", exampleFASTA, false))
|
||||
addResource(new Resource("public/testdata/exampleBAM.bam", "exampleBAM", exampleFASTA, false))
|
||||
addResource(new Resource("public/testdata/exampleBAM.bam", "exampleBAM", exampleFASTA, false, false, false))
|
||||
}
|
||||
|
||||
def createBundleDirectories(dir: File) = {
|
||||
|
|
@ -184,6 +185,15 @@ class GATKResourcesBundle extends QScript {
|
|||
}
|
||||
}
|
||||
|
||||
def createCurrentLink(bundleDir: File) = {
|
||||
|
||||
val currentLink = new File(BUNDLE_ROOT + "/current")
|
||||
|
||||
if ( currentLink.exists ) currentLink.delete()
|
||||
|
||||
add(new linkFile(bundleDir, currentLink))
|
||||
}
|
||||
|
||||
def script = {
|
||||
if ( TEST )
|
||||
initializeTestDataFiles();
|
||||
|
|
@ -201,8 +211,10 @@ class GATKResourcesBundle extends QScript {
|
|||
} else if ( isBAM(resource.file) ) {
|
||||
val f = copyBundleFile(resource, resource.ref)
|
||||
add(new IndexBAM(f))
|
||||
@Output val outvcf: File = swapExt(f.getParent, f, ".bam", ".vcf")
|
||||
add(new UG(resource.file, resource.ref.file, outvcf))
|
||||
if ( resource.makeCallsIfBam ) {
|
||||
@Output val outvcf: File = swapExt(f.getParent, f, ".bam", ".vcf")
|
||||
add(new UG(resource.file, resource.ref.file, outvcf))
|
||||
}
|
||||
} else if ( isVCF(resource.file) ) {
|
||||
for ( destRef <- refs ) {
|
||||
val out = destFile(BUNDLE_DIR, destRef, resource.destname(destRef))
|
||||
|
|
@ -240,6 +252,9 @@ class GATKResourcesBundle extends QScript {
|
|||
//throw new ReviewedStingException("Unknown file type: " + resource)
|
||||
}
|
||||
}
|
||||
|
||||
createCurrentLink(BUNDLE_DIR)
|
||||
|
||||
} else {
|
||||
createBundleDirectories(DOWNLOAD_DIR)
|
||||
createDownloadsFromBundle(BUNDLE_DIR, DOWNLOAD_DIR)
|
||||
|
|
@ -249,7 +264,6 @@ class GATKResourcesBundle extends QScript {
|
|||
|
||||
def createDownloadsFromBundle(in: File, out: File) {
|
||||
Console.printf("Visiting %s%n", in)
|
||||
// todo -- ignore some of the other files too (e.g. *.out); will test next time we make a bundle
|
||||
if (! in.getName.startsWith(".")) {
|
||||
if ( in.isDirectory ) {
|
||||
out.mkdirs
|
||||
|
|
@ -261,7 +275,7 @@ class GATKResourcesBundle extends QScript {
|
|||
if ( isBAM(in) ) {
|
||||
add(new cpFile(in, out))
|
||||
add(new md5sum(out))
|
||||
} else {
|
||||
} else if ( !isOUT(in) ) {
|
||||
add(new GzipFile(in, out + ".gz"))
|
||||
add(new md5sum(out + ".gz"))
|
||||
}
|
||||
|
|
@ -299,6 +313,10 @@ class GATKResourcesBundle extends QScript {
|
|||
def commandLine = "cp %s %s".format(in.getAbsolutePath, out.getAbsolutePath)
|
||||
}
|
||||
|
||||
class linkFile(@Input val in: File, @Output val out: File) extends CommandLineFunction {
|
||||
def commandLine = "ln -s %s %s".format(in.getAbsolutePath, out.getAbsolutePath)
|
||||
}
|
||||
|
||||
class md5sum(@Input val in: File) extends CommandLineFunction {
|
||||
@Output val o: File = new File(in.getAbsolutePath + ".md5")
|
||||
def commandLine = "md5sum %s > %s".format(in.getAbsolutePath, o)
|
||||
|
|
|
|||
Loading…
Reference in New Issue