def run(self):
     ##########################################
     #Setup a file tree.
     ##########################################
         
     tempFileTree = TempFileTree(os.path.join(self.getGlobalTempDir(), getRandomAlphaNumericString()))   
     
     fileTreeRootFile = tempFileTree.getTempFile()
 
     makeFileTree(fileTreeRootFile, \
                  self.depth, tempFileTree)
     
     treePointer = tempFileTree.getTempFile()
     
     makeTreePointer(fileTreeRootFile, treePointer)
     
     logger.info("We've set up the file tree")
     
     ##########################################
     #Issue the child and follow on jobs
     ##########################################
     
     self.addChildTarget(ChildTarget(treePointer))
     
     self.setFollowOnTarget(DestructFileTree(tempFileTree))
     
     logger.info("We've added the child target and finished SetupFileTree.run()")
def run_single_star(target, genome, institute, tissue, reference, out_dir, experiment, fastq_path, num_threads, ref_genome):
    tmp_dir = os.path.join(target.getLocalTempDir(), "tmp_" + getRandomAlphaNumericString())
    out_path = build_out_dirs(out_dir, genome, institute, tissue, experiment) + "/"
    star_cmd = ['STAR', '--genomeDir', reference, '--readFilesIn', fastq_path,
                '--outFileNamePrefix', out_path, '--outTmpDir', tmp_dir, '--runThreadN', num_threads]
    runProc(star_cmd + star_flags)
    os.remove(fastq_path)
    target.setFollowOnTargetFn(run_feature_counts, args=(genome, out_path, reference, ref_genome, num_threads, False))
def run_paired_star(target, genome, institute, tissue, reference, out_dir, experiment, fwd_fastq_path, rev_fastq_path,
                    num_threads, ref_genome):
    # STAR wants a temp dir that doesn't exist, so we have to give it a fresh path because jobTree makes localTempDir()
    tmp_dir = os.path.join(target.getLocalTempDir(), "tmp_" + getRandomAlphaNumericString())
    out_path = build_out_dirs(out_dir, genome, institute, tissue, experiment) + "/"
    star_cmd = ['STAR', '--genomeDir', reference, '--readFilesIn', fwd_fastq_path, rev_fastq_path,
                '--outFileNamePrefix', out_path, '--outTmpDir', tmp_dir, '--runThreadN', num_threads]
    runProc(star_cmd + star_flags)
    os.remove(fwd_fastq_path)
    os.remove(rev_fastq_path)
    target.setFollowOnTargetFn(run_feature_counts, args=(genome, out_path, reference, ref_genome, num_threads, True))
def run_single_star(target, genome, institute, tissue, reference, out_dir, experiment, fastq_path, num_threads, rsem,
                    htseq):
    tmp_dir = os.path.join(target.getLocalTempDir(), "tmp_" + getRandomAlphaNumericString())
    out_path = build_out_dirs(out_dir, genome, institute, tissue, experiment) + "/"
    star_cmd = ['STAR', '--genomeDir', reference, '--readFilesIn', fastq_path,
                '--outFileNamePrefix', out_path, '--outTmpDir', tmp_dir, '--runThreadN', num_threads]
    runProc(star_cmd + star_flags)
    if rsem is True:
        target.setFollowOnTargetFn(run_rsem, args=(genome, out_path, reference, False), cpu=1)
    if htseq is True:
        target.setFollowOnTargetFn(run_htseq, args=(genome, out_path, reference), cpu=1)
 def __init__(self, depth=0):
     Target.__init__(self, time=random.random() * 10)
     self.tempFileName = getRandomAlphaNumericString()
     self.depth = depth