def sequence(self): temp = self.strand5p() if not temp: return None if temp.sequence(): return ''.join([Strand.sequence(strand) \ for strand in self.strand5p().generator3pStrand()]) else: return None
def sequence(self): """Get the sequence applied to this `Oligo` Returns: str or None """ temp = self.strand5p() if not temp: return None if temp.sequence(): return ''.join([Strand.sequence(strand) for strand in self.strand5p().generator3pStrand()]) else: return None
def sequenceExport(self, output): """ Iterative appending to argument `output` which is a dictionary of lists Args: output (dict): dictionary with keys given in `NucleicAcidPart.getSequences` Returns: dict: output with this oligo's values appended for each key """ part = self.part() vh_num5p = self.strand5p().idNum() strand5p = self.strand5p() idx5p = strand5p.idx5Prime() seq = [] a_seq = [] if self.isCircular(): # print("A loop exists") raise CircularOligoException("Cannot export circular oligo " + self.getName()) for strand in strand5p.generator3pStrand(): seq.append(Strand.sequence(strand, for_export=True)) a_seq.append(Strand.abstractSeq(strand)) if strand.connection3p() is None: # last strand in the oligo vh_num3p = strand.idNum() idx3p = strand.idx3Prime() a_seq = ','.join(a_seq) a_seq = "(%s)" % (a_seq) modseq5p, modseq5p_name = part.getStrandModSequence( strand5p, idx5p, ModType.END_5PRIME) modseq3p, modseq3p_name = part.getStrandModSequence( strand, idx3p, ModType.END_3PRIME) seq = ''.join(seq) seq = modseq5p + seq + modseq3p # output = "%d[%d]\t%d[%d]\t%s\t%s\t%s\t%s\t(%s)\n" % \ # (vh_num5p, idx5p, vh_num3p, idx3p, self.getColor(), # modseq5p_name, seq, modseq3p_name, a_seq) # these are the keys # keys = ['Start','End','Color', 'Mod5', # 'Sequence','Mod3','AbstractSequence'] output['Start'].append("%d[%d]" % (vh_num5p, idx5p)) output['End'].append("%d[%d]" % (vh_num3p, idx3p)) output['Color'].append(self.getColor()) output['Mod5'].append(modseq5p_name) output['Sequence'].append(seq) output['Mod3'].append(modseq3p_name) output['AbstractSequence'].append(a_seq) return output
def sequenceExport(self, output): """ Iterative appending to argument `output` which is a dictionary of lists Args: output (dict): dictionary with keys given in `NucleicAcidPart.getSequences` Returns: dict: """ part = self.part() vh_num5p = self.strand5p().idNum() strand5p = self.strand5p() idx5p = strand5p.idx5Prime() seq = [] a_seq = [] if self.isLoop(): # print("A loop exists") raise Exception for strand in strand5p.generator3pStrand(): seq.append(Strand.sequence(strand, for_export=True)) a_seq.append(Strand.abstractSeq(strand)) if strand.connection3p() is None: # last strand in the oligo vh_num3p = strand.idNum() idx3p = strand.idx3Prime() a_seq = ','.join(a_seq) a_seq = "(%s)" % (a_seq) modseq5p, modseq5p_name = part.getStrandModSequence(strand5p, idx5p, ModType.END_5PRIME) modseq3p, modseq3p_name = part.getStrandModSequence(strand, idx3p, ModType.END_3PRIME) seq = ''.join(seq) seq = modseq5p + seq + modseq3p # output = "%d[%d]\t%d[%d]\t%s\t%s\t%s\t%s\t(%s)\n" % \ # (vh_num5p, idx5p, vh_num3p, idx3p, self.getColor(), # modseq5p_name, seq, modseq3p_name, a_seq) # these are the keys # keys = ['Start','End','Color', 'Mod5', # 'Sequence','Mod3','AbstractSequence'] output['Start'].append("%d[%d]" % (vh_num5p, idx5p)) output['End'].append("%d[%d]" % (vh_num3p, idx3p)) output['Color'].append(self.getColor()) output['Mod5'].append(modseq5p_name) output['Sequence'].append(seq) output['Mod3'].append(modseq3p_name) output['AbstractSequence'].append(a_seq) return output
def sequenceExport(self): part = self.part() vh_num5p = self.strand5p().virtualHelix().number() strand5p = self.strand5p() idx5p = strand5p.idx5Prime() seq = '' if self.isLoop(): # print("A loop exists") raise Exception for strand in strand5p.generator3pStrand(): seq = seq + Strand.sequence(strand, for_export=True) if strand.connection3p() == None: # last strand in the oligo vhNum3p = strand.virtualHelix().number() idx3p = strand.idx3Prime() modseq5p, modseq5p_name = part.getModSequence(strand5p, idx5p, 0) modseq3p, modseq3p_name = part.getModSequence(strand, idx3p, 1) seq = modseq5p + seq + modseq3p output = "%d[%d],%d[%d],%s,%s,%s,%s,%s\n" % \ (vhNum5p, idx5p, vhNum3p, idx3p, seq, len(seq), self._color, modseq5p_name, modseq3p_name) return output
def sequenceExport(self): part = self.part() vh_num5p = self.strand5p().virtualHelix().number() strand5p = self.strand5p() idx5p = strand5p.idx5Prime() seq = '' if self.isLoop(): # print("A loop exists") raise Exception for strand in strand5p.generator3pStrand(): seq = seq + Strand.sequence(strand, for_export=True) if strand.connection3p() == None: # last strand in the oligo vh_num3p = strand.virtualHelix().number() idx3p = strand.idx3Prime() modseq5p, modseq5p_name = part.getModSequence(strand5p, idx5p, 0) modseq3p, modseq3p_name = part.getModSequence(strand, idx3p, 1) seq = modseq5p + seq + modseq3p output = "%d[%d],%d[%d],%s,%s,%s,%s,%s\n" % \ (vh_num5p, idx5p, vh_num3p, idx3p, seq, len(seq), self._color, modseq5p_name, modseq3p_name) return output