def load_pairs_fixture(self, fixture_name): pairs = [] with open( u.get_fixture_path(fixture_name), 'r' ) as f: for line in f: if not re.match("\s*#", line): # if line doesn't start with # pairs.append(line.rstrip("\n\r").split("\t")) return pairs
def load_pairs_fixture(self, fixture_name): pairs = [] with open(u.get_fixture_path(fixture_name), 'r') as f: for line in f: if not re.match("\s*#", line): # if line doesn't start with # pairs.append(line.rstrip("\n\r").split("\t")) return pairs
def setUp(self): utils.build_ref_index() self.aligner = BwaAligner510() self.aligner.reference = utils.reference self.aligner.hit_visitor = type(self).SimpleVisitor() self.pairs = [] with open(utils.get_fixture_path("pairs.txt")) as f: for line in f: if not line.startswith("#"): # leave #-lines for comments self.pairs.append(line.rstrip("\r\n").split("\t"))
def setUp(self): self.gap_opts = FakeOpts() self.reference = FakeReference() # To fake having a reference, we have to overwrite the bwa.get_seq_id function # called by BwaMapping so that it'll use our FakeReference instead of the real one. bwa.get_seq_id = lambda bns, pos, len: self.reference.get_seq_id(bns, pos, len) # now create the hits # With have a file with 10 serialized dictionaries containing values most fields of # the bwa_seq_t struct. The items are in the order read1, mate1, read2, mate2, ... with open(utils.get_fixture_path("hit_wrapper_hits.pickle")) as f: hits_data = pickle.load(f) # load an array of dictionaries self.bwa_seqs = map(utils.build_bwa_seq_t, hits_data) # finally, create the BwaMapping objects for each bwa_seq_t self.hits = [] for s1, s2 in izip( self.bwa_seqs[0::2], self.bwa_seqs[1::2] ): self.hits.append( BwaMapping(self.gap_opts, self.reference, s1, s2) ) self.hits.append( BwaMapping(self.gap_opts, self.reference, s2, s1) )