def directStringSeq(): my_string = "GCTGTTATGGGTCGTTGGAAGGGTGGTCGTGCTGCTGGTTAG" Compl = complement(my_string) reCompl = reverse_complement(my_string) transc = transcribe(my_string) bTransc = back_transcribe(my_string) transl = translate(my_string) print('my_string = ', my_string) print('Compl = ', Compl) print('reCompl = ', reCompl) print('transc = ', transc) print('bTransc = ', bTransc) print('transl = ', transl)
def BackTransPageView(request): if request.method == "POST": xseq = request.POST.get('sequence') my_rna = validaterna(xseq) if my_rna == "error": messages.info(request, 'Invalid RNA sequence') return render(request, "backtranscription.html") else: transseq = back_transcribe(my_rna) return render(request, "backtranscription.html",{ 'seq':my_rna , 'transseq':transseq , }) else: return render(request,"backtranscription.html")
def apply_operation(): """Do the selected operation.""" codon_table = codon_list.get(codon_list.curselection()) print(f"Code: {codon_table}") seq = "".join(input_text.get(1.0, tk.END).split()) print(f"Input sequence: {seq}") operation = transform_var.get() print(f"Operation: {operation}") if operation == "transcribe": result = transcribe(seq) elif operation == "translate": result = translate(seq, table=codon_table, to_stop=True) elif operation == "back transcribe": result = back_transcribe(seq) else: result = "" output_text.delete(1.0, tk.END) output_text.insert(tk.END, result) print(f"Result: {result}")
def apply_operation(): """Do the selected operation.""" codon_table = codon_list.get(codon_list.curselection()) print('Code: {}'.format(codon_table)) seq = ''.join(input_text.get(1.0, tk.END).split()) print('Input sequence: {}'.format(seq)) operation = transform_var.get() print('Operation: {}'.format(operation)) if operation == 'transcribe': result = transcribe(seq) elif operation == 'translate': result = translate(seq, table=codon_table, to_stop=True) elif operation == 'back transcribe': result = back_transcribe(seq) else: result = '' output_text.delete(1.0, tk.END) output_text.insert(tk.END, result) print('Result: {}'.format(result)) return
def back_transcribe(self): seq = "".join(self.src_text.GetValue().split()) # remove whitespace print seq self.dest_text.Clear() self.dest_text.SetValue(back_transcribe(seq))
def back_transcribe(self): seq = "".join(self.src_text.GetValue().split()) #remove whitespace print seq self.dest_text.Clear() self.dest_text.SetValue(back_transcribe(seq))
coding_dna.transcribe()#T→U coding_dna.reverse_complement().transcribe()#true_transcribe coding_dna.translate(to_stop=True,cds=True)#RNA和DNA都可以直接翻译,table参数可以选择密码子表 from Bio.Data import CodonTable standard_table=CodonTable.unambiguous_dna_by_id[1] mito_table = CodonTable.unambiguous_dna_by_name["Vertebrate Mitochondrial"] standard_table = CodonTable.unambiguous_dna_by_name["Standard"] mito_table = CodonTable.unambiguous_dna_by_id[2] from Bio.Seq import MutableSeq mutable_seq = MutableSeq("GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA", IUPAC.unambiguous_dna) ##或者 mutable_seq = my_seq.tomutable() mutable_seq[5] = "C" mutable_seq.remove("T") mutable_seq.reverse() new_seq=mutable_seq.toseq() from Bio.Seq import UnknownSeq unk_dna=UnknownSeq(20,alphabet=IUPAC.ambiguous_dna) from Bio.Seq import reverse_complement,transcribe,back_transcribe,translate my_string = "GCTGTTATGGGTCGTTGGAAGGGTGGTCGTGCTGCTGGTTAG" reverse_complement(my_string) transcribe(my_string) back_transcribe(my_string) translate(my_string)
#The actual biological transcription process works from the template strand, doing a reverse complement #(TCAG → CUGA) to give the mRNA. However, in Biopython and bioinformatics in general, we typically #work directly with the coding strand because this means we can get the mRNA sequence just by switching #T → U. from Bio.Seq import transcribe # just changes T with U from the coding strand (5' -> 3') messenger_rna = transcribe(coding_dna) # if we want to transcribe from the template strand (3' -> 5'): transcribe(template_dna.reverse_complement()) # transcribing back to DNA: from Bio.Seq import Seq, back_transcribe back_transcribe(messenger_rna) # just changes U -> T and gives the coding strand # 3.8 Translation (mRNA -> Protein) # Uses standard genetic code from Bio.Seq import Seq, translate from Bio.Alphabet import IUPAC messenger_rna = Seq("AUGGCCAUUGUAAUGGGCCGCUGAAAGGGUGCCCGAUAG", IUPAC.unambiguous_rna) translate(messenger_rna) # Direct translation (DNA -> Protein from Bio.Seq import Seq, translate from Bio.Alphabet import IUPAC coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG", IUPAC.unambiguous_dna) translate(coding_dna)
# Set any relevant command line arguments seqs_in = args.file_name max_CDS_overlap = args.CDS_overlap maximum_fold_energy = args.stem_dG # Spawn RNAfold rnafold = subprocess.Popen(["RNAfold", "-noPS"], bufsize=10000, stdin=subprocess.PIPE, stdout=subprocess.PIPE) # Read in and process seqs seqs_input = open(seqs_in,"r") for seq in SeqIO.parse(seqs_input, "genbank"): # Create a dictionary of the sequence and the reverse complement ss = {} ss['+'] = str(back_transcribe(str(seq.seq))) # Uncomment to search both strands #ss['-'] = str(reverse_complement(ss['+'])) # Extract CDS regions from annotations ss_cds = [0 for x in range(len(ss['+']))] for f in seq.features : if f.type == 'CDS': if f.sub_features != []: # Subfeatures of the CDS -> Splicing for g in f.sub_features: for x in range(g.location.start.position,g.location.end.position): ss_cds[x] = 1 else: # No subfeatures of the CDS -> Unspliced in the coding region
# transcribe RNA (DNA -> mRNA) #The actual biological transcription process works from the template strand, doing a reverse complement #(TCAG → CUGA) to give the mRNA. However, in Biopython and bioinformatics in general, we typically #work directly with the coding strand because this means we can get the mRNA sequence just by switching #T → U. from Bio.Seq import transcribe # just changes T with U from the coding strand (5' -> 3') messenger_rna = transcribe(coding_dna) # if we want to transcribe from the template strand (3' -> 5'): transcribe(template_dna.reverse_complement()) # transcribing back to DNA: from Bio.Seq import Seq, back_transcribe back_transcribe( messenger_rna) # just changes U -> T and gives the coding strand # 3.8 Translation (mRNA -> Protein) # Uses standard genetic code from Bio.Seq import Seq, translate from Bio.Alphabet import IUPAC messenger_rna = Seq("AUGGCCAUUGUAAUGGGCCGCUGAAAGGGUGCCCGAUAG", IUPAC.unambiguous_rna) translate(messenger_rna) # Direct translation (DNA -> Protein from Bio.Seq import Seq, translate from Bio.Alphabet import IUPAC coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG", IUPAC.unambiguous_dna) translate(coding_dna)
from Bio.Seq import reverse_complement, transcribe, back_transcribe, translate my_string = "GCTGTTATGGGTCGTTGGAAGGGTGGTCGTGCTGCTGGTTAG" print(reverse_complement(my_string)) print(transcribe(my_string)) print(back_transcribe(my_string)) print(translate(my_string))
# ACHTUNG BEIM ARBEITEN von unterschiedlichen Seqs Typ check dna_seq = Seq("ACGTA") protein_seq = Seq("EVRNAK") print ("Sum: ", protein_seq + dna_seq) print(dna_seq) print(dna_seq.complement()) print(dna_seq.reverse_complement()) # Transcription and Tanslation coding_dna = Seq("ATGGCCATTGTAATG") template_dna = coding_dna.reverse_complement() messenger_rna = transcribe(coding_dna) print(messenger_rna) print(back_transcribe(messenger_rna)) print(translate(messenger_rna)) myThirdSequence = Seq("GATCGATGGGGGCTATCC") print(GC(myThirdSequence)) # MutableSeq objects print(dna_seq) #dna_seq[0]="T" --> Nicht veränderbar! mutable_seq = dna_seq.tomutable() mutable_seq[0] = "T" print(mutable_seq) mutableSeq = MutableSeq("GCCCATC") mutableSeq[1] = "A" print(mutableSeq)
unkDNA = UnknownSeq(20, alphabet=IUPAC.ambiguous_dna) print unkDNA # N = any base unkProt = UnknownSeq(10, alphabet=IUPAC.protein) print unkProt # X = any aminoacid print unkDNA.complement(), unkDNA.reverse_complement() print unkDNA.transcribe(), unkDNA.translate() unkProt = unkDNA.translate() print unkProt, len(unkProt) #Directly on strings from Bio.Seq import reverse_complement, transcribe, back_transcribe, translate noseq = 'GCTGTTATGGGTCGTTGGAAGGGTGGTCGTGCTGCTGGTTAG' print reverse_complement(noseq) # these functions print transcribe(noseq) # receive either strings print back_transcribe(noseq) # Seq, MutableSeq, UnknownSeq print translate(noseq) #SeqRecord object #.seq A Seq object #.id a string ID identifier of the sequence #.name a string common name for the sequence #.description a string readable description or complete name #.letter_annotations a dictionary of adittional info about the letters in the sequence. # The values for the keys are (list, tuple, string) with the same length of the sequence. #.annotations a dictionary of additional info about the sequence #.features a list of SeqFeature objects #.dbxrefs a list of string DB cross-references from Bio.SeqRecord import SeqRecord seq = Seq('GATC') seqRec = SeqRecord(seq)