-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsequence.py
More file actions
executable file
·94 lines (44 loc) · 1.58 KB
/
Copy pathsequence.py
File metadata and controls
executable file
·94 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
import Bio
from Bio.Seq import Seq
###get some help
print(help(Seq))
my_seq = Seq("AGTACACTGGT")
print(my_seq)
from Bio.Alphabet import IUPAC
my_seq = Seq('GATCGATGGGCCTATATAGGATCGAAAATCGC', IUPAC.unambiguous_dna)
print(len(my_seq))
print(my_seq.count("G"))
print(100 * float(my_seq.count('G') + my_seq.count('C')) / len(my_seq))
from Bio.SeqUtils import GC
print(GC(my_seq))
####SLicing a sequence
print(my_seq[:5])
###get reverse complement
print(my_seq)
print(my_seq[::-1])
#####write fasta files
fasta_format_string = ">Name\n%s\n" % my_seq
print(fasta_format_string)
####concatenate sequences
protein_seq = Seq("EVRNAK", IUPAC.protein)
dna_seq = Seq("ACGT", IUPAC.unambiguous_dna)
#print(protein_seq# + dna_seq)
####get complement sequence and reverse complement
print("sequence {s}".format(s=my_seq))
print("sequence complement {s}".format(s=my_seq.complement()))
print("sequence reverse_complement {s}".format(s=my_seq.reverse_complement()))
####transcribe sequence
coding_dna = Seq("ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG", IUPAC.unambiguous_dna)
template_dna = coding_dna.reverse_complement()
messenger_rna = coding_dna.transcribe()
print("messenger rna {m}".format(m=messenger_rna))
##another way to do it
messenger_rna=template_dna.reverse_complement().transcribe()
print("messenger rna {m}".format(m=messenger_rna))
protein_aa=messenger_rna.translate()
print("protein aa {p}".format(p=protein_aa))
######
from Bio.Data import CodonTable
standard_table = CodonTable.unambiguous_dna_by_name["Standard"]
print(standard_table)