def d5s_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/" #from spats_shape_seq.db import PairDB #pair_db = PairDB(bp + "dev_out/pairs.db") #if False: # pair_db.add_targets_table(bp + "5s/5S.fa") # pair_db.parse(bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", # bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq") from spats_shape_seq import Spats from spats_shape_seq.partial import PartialFindProcessor s = Spats() #s.run._processor_class = PartialFindProcessor s.run.skip_database = True #s.run.writeback_results = True #s.run.resume_processing = True #s.run.result_set_name = "lookup" s.addTargets(bp + "5s/5S.fa") #s.process_pair_db(pair_db) s.process_pair_data( bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq" ) s.compute_profiles() s.write_reactivities(bp + "dev_out/rx2.out")
def spats(target, r1, r2, out, show_sites = True): from spats_shape_seq import Spats, spats_config s = Spats() s.addTargets(target) s.addMasks("RRRY", "YYYR") if show_sites: spats_config.show_id_to_site = True s.process_pair_data(r1, r2) if not show_sites: s.compute_profiles() s.write_reactivities(out + "/rx.out")
def spats(target, r1, r2, out, show_sites=True): from spats_shape_seq import Spats, spats_config s = Spats() s.addTargets(target) s.addMasks("RRRY", "YYYR") if show_sites: spats_config.show_id_to_site = True s.process_pair_data(r1, r2) if not show_sites: s.compute_profiles() s.write_reactivities(out + "/rx.out")
def ligation_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/Shape_Seq_ligation/" from spats_shape_seq import Spats s = Spats() #s.config.debug = True #s.run.minimum_target_match_length = 10 #s.run.num_workers = 1 #from spats_shape_seq.partial import PartialFindProcessor #s.run._processor_class = PartialFindProcessor s.run.skip_database = True s.addTargets(bp + "panel_RNAs_complete.fa") s.process_pair_data(bp + "data/KEW1_S1_L001_R1_001.fastq", bp + "data/KEW1_S1_L001_R2_001.fastq")
def test_refactor(): from spats_clean import Spats bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/5sq_dev/" out = bp + "t3/" s = Spats(bp + "5S.fa", out) s.setup() s.process_pair_data(bp + "data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", bp + "data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq") s.compute_profiles() s.write_reactivities() import subprocess subprocess.check_call(["diff", bp + "t2/rx.out", out + "/rx.out"]) print "Diff OK"
def ligation_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/Shape_Seq_ligation/" from spats_shape_seq import Spats s = Spats() #s.config.debug = True #s.run.minimum_target_match_length = 10 #s.run.num_workers = 1 #from spats_shape_seq.partial import PartialFindProcessor #s.run._processor_class = PartialFindProcessor s.run.skip_database = True s.addTargets(bp + "panel_RNAs_complete.fa") s.process_pair_data(bp + "data/KEW1_S1_L001_R1_001.fastq", bp + "data/KEW1_S1_L001_R2_001.fastq")
def cotrans_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/cotrans/" from spats_shape_seq import Spats s = Spats() #from spats_shape_seq.partial import PartialFindProcessor #s.run._processor_class = PartialFindProcessor s.run.skip_database = True #s.run.writeback_results = True #s.run.resume_processing = True #s.run.result_set_name = "lookup" s.addTargets(bp + "F_wt.fa") s.process_pair_data(bp + "data/EJS_6_F_10mM_NaF_Rep1_GCCAAT_R1.fastq", bp + "data/EJS_6_F_10mM_NaF_Rep1_GCCAAT_R2.fastq") s.compute_profiles() s.write_reactivities(bp + "dev_out/rx.out")
def cotrans_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/cotrans/" from spats_shape_seq import Spats s = Spats() #from spats_shape_seq.partial import PartialFindProcessor #s.run._processor_class = PartialFindProcessor s.run.skip_database = True #s.run.writeback_results = True #s.run.resume_processing = True #s.run.result_set_name = "lookup" s.addTargets(bp + "F_wt.fa") s.process_pair_data(bp + "data/EJS_6_F_10mM_NaF_Rep1_GCCAAT_R1.fastq", bp + "data/EJS_6_F_10mM_NaF_Rep1_GCCAAT_R2.fastq") s.compute_profiles() s.write_reactivities(bp + "dev_out/rx.out")
def prof_run(): from spats_shape_seq import Spats spats = Spats() #spats.run.cotrans = True #spats.run.cotrans_linker = 'CTGACTCGGGCACCAAGGAC' #spats.run.writeback_results = False spats.run._process_all_pairs = True spats.run.skip_database = True spats.run.algorithm = "lookup" spats.run.count_mutations = True spats.run.num_workers = 1 bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/pdc_muts/PDC_tweaked/PDC_09_001_6/" spats.addTargets(bp + "target.fa") spats.process_pair_data(bp + "2k_R1.fastq", bp + "2k_R2.fastq") exit(0)
def indels_run(): from spats_shape_seq import Spats s = Spats() s.run.algorithm = True s.run.count_indels = True s.run.count_mutations = True s.run.allowed_target_errors = 8 s.collapse_left_prefixes = True s.run.ignore_stops_with_mismatched_overlap = True s.run.allow_negative_values = True s.mutations_require_quality_score = 30 bp = "/Users/steve/mos/tasks/oughxX/code" s.addTargets(bp + "/test/hairpin/hairpinA_circ.fa") rp = bp + "/TESTING/cmp_muts_favored/steve_test" s.process_pair_data(rp + "/R1_match_failures.fastq", rp + "/R2_match_failures.fastq") exit(0)
def prof_run(): from spats_shape_seq import Spats spats = Spats() #spats.run.cotrans = True #spats.run.cotrans_linker = 'CTGACTCGGGCACCAAGGAC' #spats.run.writeback_results = False spats.run._process_all_pairs = True spats.run.skip_database = True spats.run.algorithm = "lookup" spats.run.count_mutations = True spats.run.num_workers = 1 bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/datasets/pdc_muts/PDC_tweaked/PDC_09_001_6/" spats.addTargets(bp + "target.fa") spats.process_pair_data(bp + "2k_R1.fastq", bp + "2k_R2.fastq") exit(0)
def indels_run(): from spats_shape_seq import Spats s = Spats() s.run.algorithm = True s.run.count_indels = True s.run.count_mutations = True s.run.allowed_target_errors = 8 s.collapse_left_prefixes = True s.run.ignore_stops_with_mismatched_overlap = True s.run.allow_negative_values = True s.mutations_require_quality_score = 30 bp = "/Users/steve/mos/tasks/oughxX/code" s.addTargets(bp + "/test/hairpin/hairpinA_circ.fa") rp = bp + "/TESTING/cmp_muts_favored/steve_test" s.process_pair_data(rp + "/R1_match_failures.fastq", rp + "/R2_match_failures.fastq") exit(0)
def test_refactor(): from spats_clean import Spats bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/5sq_dev/" out = bp + "t3/" s = Spats(bp + "5S.fa", out) s.setup() s.process_pair_data( bp + "data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", bp + "data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq" ) s.compute_profiles() s.write_reactivities() import subprocess subprocess.check_call(["diff", bp + "t2/rx.out", out + "/rx.out"]) print "Diff OK"
def run(self): """Process the SPATS data for the configured target(s) and r1/r2 fragment pairs. """ run_name = self._run_file() if os.path.exists(run_name): self._add_note("** removing previous run file") os.remove(run_name) native_tool = self._native_tool('cotrans') if native_tool and not self.cotrans: self._add_note("skipping native tool due to non-cotrans run") native_tool = None spats = Spats(cotrans = self.cotrans) if self._update_run_config(spats.run) and native_tool: self._add_note("skipping native tool due to custom config") native_tool = None if native_tool: self._add_note("using native cotrans processor") subprocess.check_call([native_tool, self.config['target'], self.r1, self.r2, run_name], cwd = self.path) else: self._add_note("using python processor") spats.addTargets(self.config['target']) if self.using_separate_channel_files: spats.process_pair_data(self.r1_plus, self.r2_plus, force_mask = spats.run.masks[0]) spats.process_pair_data(self.r1_minus, self.r2_minus, force_mask = spats.run.masks[1]) else: spats.process_pair_data(self.r1, self.r2) spats.store(run_name) self._add_note("wrote output to {}".format(os.path.basename(run_name))) nb = self._notebook() if nb: nb.add_spats_run(self.cotrans, spats.run.count_mutations).save()
def d5s_run(): bp = "/Users/jbrink/mos/tasks/1RwIBa/tmp/" #from spats_shape_seq.db import PairDB #pair_db = PairDB(bp + "dev_out/pairs.db") #if False: # pair_db.add_targets_table(bp + "5s/5S.fa") # pair_db.parse(bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", # bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq") from spats_shape_seq import Spats from spats_shape_seq.partial import PartialFindProcessor s = Spats() #s.run._processor_class = PartialFindProcessor s.run.skip_database = True #s.run.writeback_results = True #s.run.resume_processing = True #s.run.result_set_name = "lookup" s.addTargets(bp + "5s/5S.fa") #s.process_pair_db(pair_db) s.process_pair_data(bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R1_001.fastq", bp + "5s/data/17571-AD1AW-KEW11-5S-2p1-18x-23FEB15-GGCTAC_S10_L001_R2_001.fastq") s.compute_profiles() s.write_reactivities(bp + "dev_out/rx2.out")