Last active
March 11, 2016 07:05
-
-
Save mpkocher/fb177384639c926a5ba2 to your computer and use it in GitHub Desktop.
Get AlignmentSet by SL system and Job Id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
# ls /pbi/dept/secondary/siv/smrtlink/smrtlink-* | |
ALPHA <- "alpha" | |
BETA <- "beta" | |
BIHOURLY <- "bi-hourly" | |
NIGHLTLY <- "nightly" | |
SIV <- "siv" | |
SIV_ALPHA <- "siv-alpha" | |
.getRootJobsDir <- function(smrtLinkId) { | |
return(paste0("/pbi/dept/secondary/siv/smrtlink/smrtlink-", smrtLinkId, "/smrtsuite/userdata/jobs_root")) | |
} | |
.toJobDir <- function(rootDir, jobId) { | |
prefix <- floor(jobId / 1000) | |
return(paste(rootDir, sprintf("%03d", prefix), sprintf("%06d", jobId), sep="/")) | |
} | |
getAlignmentSetPath <- function(smrtlinkId, jobId) { | |
pattern <- paste0(.toJobDir(.getRootJobsDir(smrtlinkId), jobId), "/tasks/*/final*alignmentset.xml") | |
return(Sys.glob(pattern)) | |
} | |
main <- function() { | |
jobId <- 4367 | |
cat(paste("Running example for job", jobId, "on SMRT Link system", BETA, "\n")) | |
alignmentSetPath <- getAlignmentSetPath(BETA, jobId) | |
cat(paste("Results ", alignmentSetPath, "\n")) | |
# expected output | |
# mkocher@login14-biofx01:~$ ./smrtlinkJobResolver.R | |
# Running example for job 4367 on SMRT Link system beta | |
# Results /pbi/dept/secondary/siv/smrtlink/smrtlink-beta/smrtsuite/userdata/jobs_root/004/004367/tasks/pbalign.tasks.consolidate_bam-0/final.alignmentset.alignmentset.xml | |
return(0) | |
} | |
q(status = main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment