def main(sequencing_directory, library_prefix, num_libraries, raw_data_dir): lpad = LaunchPad(**yaml.load(open("my_launchpad.yaml"))) workflow_fireworks = [] workflow_dependencies = collections.defaultdict(list) library_dirs = [ os.path.join(sequencing_directory, library_prefix + str(i + 1)) for i in xrange(num_libraries) ] subdirs = [ 'unzipped', 'trimmed', 'aligned_kallisto', 'bammed', 'sorted', 'counted', 'pythonized' ] for library_dir in library_dirs: seq_functions.make_directories(library_dir, subdirs) name = "Count_%s" % os.path.basename(library_dir) fw_count = Firework( [ CountTask(library_path=library_dir, aligned_name="aligned_kallisto", bammed_name="bammed", counted_name="counted", spikeids=['Spike1', 'Spike4', 'Spike7']) ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_count) lpad.add_wf(Workflow(workflow_fireworks, links_dict=workflow_dependencies))
def main(sequencing_directory, library_prefix, num_libraries, raw_data_dir): lpad = LaunchPad(**yaml.load(open("my_launchpad.yaml"))) workflow_fireworks = [] workflow_dependencies = collections.defaultdict(list) library_dirs = [ os.path.join(sequencing_directory, library_prefix + str(i + 1)) for i in xrange(num_libraries) ] subdirs = ["aligned_star", "quant_rsem", "counted_rsem"] for library_dir in library_dirs: seq_functions.make_directories(library_dir, subdirs) for library_dir in library_dirs: seq_functions.make_directories(library_dir, subdirs) name = "AlignSTAR_%s" % os.path.basename(library_dir) fw_align = Firework( [ Align_star_Task(library_path=library_dir, trimmed_name="trimmed", aligned_name="aligned_star/", quant_name="quant_rsem/") ], name=name, spec={ "_queueadapter": { "job_name": name, "ntasks_per_node": 8, "walltime": '24:00:00' } }, ) workflow_fireworks.append(fw_align) name = "Count_%s" % os.path.basename(library_dir) fw_count = Firework( [ Count_rsem_Task(library_path=library_dir, aligned_name="aligned_star", quant_name="quant_rsem", counted_name="counted_rsem", spikeids=[ 'AM1780SpikeIn1', 'AM1780SpikeIn4', 'AM1780SpikeIn7' ]) ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_count) workflow_dependencies[fw_align].append(fw_count) lpad.add_wf(Workflow(workflow_fireworks, links_dict=workflow_dependencies))
def main(sequencing_directory, library_prefix, num_libraries, raw_data_dir): lpad = LaunchPad(**yaml.load(open("my_launchpad.yaml"))) workflow_fireworks = [] workflow_dependencies = collections.defaultdict(list) library_dirs = [os.path.join(sequencing_directory, library_prefix + str(i + 1)) for i in xrange(num_libraries)] subdirs = ['unzipped', 'trimmed', 'aligned', 'aligned_star', 'quant_rsem','bammed', 'sorted', 'counted'] for library_dir in library_dirs: seq_functions.make_directories(library_dir, subdirs) name = "AlignSTAR_%s" % os.path.basename(library_dir) fw_count = Firework( [ AlignSTARTask(library_path = library_dir, trimmed_name = "trimmed", aligned_name = "aligned_star/", quant_name = "quant_rsem/") ], name = name, spec = {"_queueadapter": {"job_name": name, "ntasks_per_node": 8}}, ) workflow_fireworks.append(fw_count) lpad.add_wf( Workflow(workflow_fireworks, links_dict = workflow_dependencies) )
""" Test scripts to align data with STAR """ import seq_functions direc = "/scratch/PI/mcovert/dvanva/sequencing/library1" seq_functions.make_directories( direc, subdirecs_to_make=["aligned_star", "quant_rsem"]) seq_functions.run_star_rsem(direc, "1-10_S14")
def main(sequencing_directory, library_prefix, num_libraries, raw_data_dir): lpad = LaunchPad(**yaml.load(open("my_launchpad.yaml"))) workflow_fireworks = [] workflow_dependencies = collections.defaultdict(list) library_dirs = [ os.path.join(sequencing_directory, library_prefix + str(i + 1)) for i in xrange(num_libraries) ] subdirs = ['unzipped', 'trimmed', 'aligned', 'pythonized', 'sorted'] for library_dir in library_dirs: seq_functions.make_directories(library_dir, subdirs) name = "Gunzip_%s" % os.path.basename(library_dir) fw_gunzip = Firework( [ ScriptTask(script="find " + os.path.join(library_dir, raw_data_dir) + " -name '*.gz' -print0 | xargs -0 gunzip"), ScriptTask( script="mv " + os.path.join(library_dir, raw_data_dir) + "/*.fastq " + os.path.join(library_dir, "unzipped")), ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_gunzip) name = "Trim_%s" % os.path.basename(library_dir) fw_trim = Firework( [ TrimTask(library_path=library_dir, unzipped_name="unzipped", trimmed_name="trimmed") ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_trim) workflow_dependencies[fw_gunzip].append(fw_trim) name = "Align_%s" % os.path.basename(library_dir) fw_align = Firework( [ AlignTask(library_path=library_dir, trimmed_name="trimmed", aligned_name="aligned") ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_align) workflow_dependencies[fw_trim].append(fw_align) name = "Sort_%s" % os.path.basename(library_dir) fw_sort = Firework( [ SortTask(library_path=library_dir, aligned_name="aligned", bammed_name="bammed", sorted_name="sorted") ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_sort) workflow_dependencies[fw_align].append(fw_sort) name = "Count_%s" % os.path.basename(library_dir) fw_count = Firework( [ CountTask(library_path=library_dir, aligned_name="aligned", bammed_name="bammed", counted_name="counted") ], name=name, spec={"_queueadapter": { "job_name": name }}, ) workflow_fireworks.append(fw_count) workflow_dependencies[fw_sort].append(fw_count) lpad.add_wf(Workflow(workflow_fireworks, links_dict=workflow_dependencies))