def get_fasta(self, chr_pos, strand): """finds the sequence of a genomic interval '1:387941-388099', '+' """ assert self._has_fasta() samtools_cmm = ['samtools', 'faidx', self.fasta_file, chr_pos] samtools_out = sp.check_output(samtools_cmm).decode() seq = self.fasta2seq(samtools_out) if strand == '-': seq = fn.comp_rev(seq) return seq.upper()
def test_trans_seq_strand(self): if os.path.isdir('/Users/martin'): seq_out = self.parser.get_trans_seqs(self.trans_exons_strand) self.assertEquals(fn.comp_rev(self.seq_exp), seq_out['trans123'])
def test_get_fasta_strand(self): self.assertEquals(fn.comp_rev(self.seq1), self.parser.get_fasta(self.pos1, '-'))
def test_comp_rev_low(self): self.assertEquals('CAGTCAGT', fn.comp_rev('actgactg'))
def test_comp_rev(self): self.assertEquals('CCAAGGTT', fn.comp_rev('AACCTTGG'))
def _rev_comp(self, genome_align): for llave, seq in genome_align.items(): genome_align[llave] = fn.comp_rev(seq) return genome_align