# out_file = get_r2_prepped_outfile(sample, args.alignment_dir) # print ("barcode-prepping %s and %s to %s." % (fq1, fq2, out_file)) # prepped.append(view.apply_async(barcode.prep_r2_with_barcode, # sample["r1_path"], # sample["r2_path"], # get_r2_prepped_outfile(sample, args.alignment_dir))) # prepped = cluster.wait_until_complete(prepped) # print "Finshed barcode preparation." print "Beginning alignment." aligned = [] for sample in samples: print ("aligning %s to %s with star." % (sample['sample_id'], args.aligner_index)) aligned.append(view.apply_async(align.star_align, sample['r1_path'], args.aligner_index, get_star_prefix(sample['r1_path']), args.cores_per_job)) aligned = cluster.wait_until_complete(aligned) print "Finished alignment." print "Beginning QC." qc = [] for sam_file in aligned: print ("QC for file %s" % sam_file) qc.append(view.apply_async(align.qc, sam_file)) qc = cluster.wait_until_complete(qc) print "Finished QC." print "Begin cleaning of poorly mapped reads." cleaned = [] for sam_file in aligned: print ("Cleaning %s, removing poorly mapped reads." % sam_file) cleaned.append(view.apply_async(align.clean_align, sam_file, get_cleaned_outfile(sam_file))) cleaned = cluster.wait_until_complete(cleaned) print "Finished cleaning."
from tailseq import cluster from argparse import ArgumentParser if __name__ == "__main__": parser = ArgumentParser(description="Run a single cell analysis.") parser.add_argument("--num-jobs", type=int, default=1, help="Number of concurrent jobs to process.") parser.add_argument("--cores-per-job", type=int, default=1, help="Number of cores to use.") parser.add_argument("--memory-per-job", default=2, help="Memory in GB to reserve per job.") parser.add_argument("--timeout", default=15, help="Time to wait before giving up starting.") parser.add_argument("--scheduler", default=None, help="Type of scheduler to use.", choices=["lsf", "slurm", "torque", "sge"]) parser.add_argument("--resources", default=None, help="Extra scheduler resource flags.") parser.add_argument("--queue", default=None, help="Queue to submit jobs to.") parser.add_argument("--parallel", choices = ["local", "ipython"], default="ipython", help="Run in parallel on a local machine.") parser.add_argument("--local", action="store_true", default=True, help="Run parallel locally") args = parser.parse_args() res = [] with cluster.get_cluster_view(args) as view: for sample in [1, 2, 3]: res.append(view.apply_async(sum, [1, 2, 3])) res = cluster.wait_until_complete(res) print res
parser.add_argument("--timeout", default=15, help="Time to wait before giving up starting.") parser.add_argument("--scheduler", default=None, help="Type of scheduler to use.", choices=["lsf", "slurm", "torque", "sge"]) parser.add_argument("--resources", default=None, help="Extra scheduler resource flags.") parser.add_argument("--queue", default=None, help="Queue to submit jobs to.") parser.add_argument("--parallel", choices=["local", "ipython"], default="ipython", help="Run in parallel on a local machine.") parser.add_argument("--local", action="store_true", default=True, help="Run parallel locally") args = parser.parse_args() res = [] with cluster.get_cluster_view(args) as view: for sample in [1, 2, 3]: res.append(view.apply_async(sum, [1, 2, 3])) res = cluster.wait_until_complete(res) print res