-
Notifications
You must be signed in to change notification settings - Fork 0
/
Python_03_problemset
337 lines (185 loc) · 14.6 KB
/
Python_03_problemset
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
Python_03_problemset
1. Write a script that calculates the AT content of the DNA string found below. AT content is the
proportion of bases that are either A or T. You will need to use some mathmatical functions as well
as a python function. It is ALWAYS a good idea to test your code with test data. For example, the
below sequence is long and you don't know for sure how many As and Ts are present. Test your codee
with a DNA string that you KNOW the correct answer. In AATTGGCCA you know you have 3 As and 2 Ts.
GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG
#!/usr/bin/env python3
dna = GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG
length=len(dna)
#!/usr/bin/env python3
#GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGG$
dna =
'ATGCTGAAA'
length=len(dna)
string= "this sequence: {} is {} nucleotides long"
string.format(dna, length)
print(string.format(dna, length))
pfb14:files admin$ nano myscript_6.py
pfb14:files admin$ python3 myscript_6.py
File "myscript_6.py", line 6
dna =
^
SyntaxError: invalid syntax
#!/usr/bin/env python3
dna = 'ATGCTGAAA'
length=len(dna)
string= "this sequence: {} is {} nucleotides long"
string.format(dna, length)
print(string.format(dna, length))
pfb14:files admin$ python3 myscript_6.py
this sequence: ATGCTGAAA is 9 nucleotides long
pfb14:files admin$ nano myscript_6.py
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCT$
length = len(dna)
string1 = "this sequence: {} is {} nucleotides long"
string1.format(dna, length)
print(string1.format (dna, length) )
Tcount = dna.count('T')
Acount = dna.count('A')
ATcontent = ((Tcount + Acount)/length *100 )
string2 = "the AT content is {} %"
string2.format(ATcontent)
print(string2.format (ATcontent) )
pfb14:files admin$ python3 myscript_6.py
this sequence: GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG is 842 nucleotides long
the AT content is 42.042755344418055 %
2.
Now add in lines of code to calculate GC content of the above DNA string. Run with test data first!!
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCC$
length = len(dna)
string1 = "this sequence: {} is {} nucleotides long"
string1.format(dna, length)
print(string1.format (dna, length) )
Tcount = dna.count('T')
Acount = dna.count('A')
ATcontent = ((Tcount + Acount)/length *100 )
string2 = "the AT content is {} %"
string2.format(ATcontent)
print(string2.format (ATcontent) )
Gcount = dna.count('G')
Ccount = dna.count('C')
GCcontent = ((Gcount + Ccount)/length *100 )
string3 = "the GC content is {} %"
string3.format(GCcontent)
print(string3.format (GCcontent) )
pfb14:files admin$ python3 myscript_6.py
this sequence: GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG is 842 nucleotides long
the AT content is 42.042755344418055 %
the GC content is 57.95724465558195 %
3.
Write a new script that prints out the reverse complement of the above DNA string.
pfb14:files admin$ nano myscript_7.py
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCC$
dnaT= dna.replace('T', 'a')
dnaTA=dnaT.replace('A', 't')
dnaTAG=dnaTA.replace('G', 'c')
dnaTAGC=dnaTAG.replace('C', 'g')
print(dnaTAGC)
pfb14:files admin$ python3 myscript_7.py
ctaccctaaccccaaaaggggagggtacacgagttctgaccgcgattttcaaaactcgaagagttttcagatctcggtggcaggtccctcgtccatcgacgacccgaggcccctgtgaaacgcaagcccgaccctcgcacgaaaggtgctgccactgtgcgaagggacctaaccgtcggtctgacggaaggcccagtgacggtacctcctcggcgtcagtctaggatcgcagctcgggggagactcagtcctttgtaaaagtctggatacctttgatgaaggacttttgttgcaagacagggggaacggcagggttcgttacctactaaactacgacaggggcctgctataacttgttaccaagtgacttctgggtccaggtctacttcgagggtcttaagcggtctccgacgaggggggcaccggggacgtggtcgtcgaggatgtggccgccggggacgtggtcgggggaggaccggggacagtagaagacagggaagggtcttttggatggtcccgtcgatgccaaaggcagacccgaagaacgtaagaccctgtcggttcagacactgaacgtgcatgaggggacgggagttgttctacaaaacggttgaccggttctggacgggacacgtcgacacccaactaaggtgtgggggcgggccgtgggcgcaggcgcggtaccggtagatgttcgtcagtgtcgtgtactgcctccaacactccgcgacgggggtggtactcgcgacgagtctatcgctaccagaccggggaggagtcgtagaataggctcaccttcctttaaacgcacacctcataaacctactgtctttgtgaaaagc
**** this only did the reverse. question asked for the reverse complement!!
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCC$
dnaT= dna.replace('T', 'a')
dnaTA=dnaT.replace('A', 't')
dnaTAG=dnaTA.replace('G', 'c')
dnaTAGC=dnaTAG.replace('C', 'g')
print(dnaTAGC[::-1])
pfb14:files admin$ python3 myscript_7.py
cgaaaagtgtttctgtcatccaaatactccacacgcaaatttccttccactcggataagatgctgaggaggggccagaccatcgctatctgagcagcgctcatggtgggggcagcgcctcacaacctccgtcatgtgctgtgactgcttgtagatggccatggcgcggacgcgggtgccgggcgggggtgtggaatcaacccacagctgcacagggcaggtcttggccagttggcaaaacatcttgttgagggcaggggagtacgtgcaagtcacagacttggctgtcccagaatgcaagaagcccagacggaaaccgtagctgccctggtaggttttctgggaagggacagaagatgacaggggccaggagggggctggtgcaggggccgccggtgtaggagctgctggtgcaggggccacggggggagcagcctctggcgaattctgggagcttcatctggacctgggtcttcagtgaaccattgttcaatatcgtccggggacagcatcaaatcatccattgcttgggacggcaagggggacagaacgttgttttcaggaagtagtttccataggtctgaaaatgtttcctgactcagagggggctcgacgctaggatctgactgcggctcctccatggcagtgacccggaaggcagtctggctgccaatccagggaagcgtgtcaccgtcgtggaaagcacgctcccagcccgaacgcaaagtgtccccggagcccagcagctacctgctccctggacggtggctctagacttttgagaagctcaaaacttttagcgccagtcttgagcacatgggaggggaaaaccccaatcccatc
5.
Write a script to find the start position of an EcoRI in the above sequence. Remember DNA sequences start with a 1 and a python string starts with a 0. Run with test data first.
pfb14:files admin$ nano myscript_8.py
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCC$
print( dna.find('GAATTC') + 1)
pfb14:files admin$ python3 myscript_8.py
396
6. What is the location in the DNA string of the EcoR1 cut site? Calculate the first and last nucleotides of each restriction fragment.
location of the EcoR1 cut site is one base pair over
based on python numbering, it should cut at position 396
based on DNA bp counting, it should cut at position 397
EcoRI will generate 2 restriction fragments (sequence GAATTC)
Fragment 1:
start nucleotide = G
end nucleotide = G
Fragment 2:
start nucleotide = A
end nucleotide = G
7.
Extract the the restricion fragments. Print each fragment along with its postion in the whole DNA sequence and its length. Use string formating to format your print statemnt.
#!/usr/bin/env python3
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGAC$
print('fragment 1')
fragment1= dna[0:396]
position1= dna.find(fragment1)
length1= len(dna[0:396])
print("{}\t{}\t{}".format(fragment1, position1 +1, length1) )
print ('fragment 2')
fragment2= dna[396:]
position2= dna.find(fragment2)
length2= len(dna[396:])
print("{}\t{}\t{}".format(fragment2, position2 +1, length2) )
pfb14:files admin$ python3 myscript_8.py
fragment 1
GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAG 1 396
fragment 2
AATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG 397 446
8, 9, and 10
Create a list and add each fragment to it.
Sort the list.
Sort the list by fragment length. Check out documentation of the key argument.
#!/usr/bin/env python3
#Python_03_question9
dna = 'GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGAC$
#fragment 1
fragment1= dna[0:396]
position1= dna.find(fragment1)
length1= len(dna[0:396])
#fragment 2
fragment2= dna[396:]
position2= dna.find(fragment2)
length2= len(dna[396:])
ecoRI_frags = [fragment1, fragment2]
print(ecoRI_frags)
print(length1, length2)
print(sorted (ecoRI_frags, key=len) )
pfb14:files admin$ python3 myscript_9.py
['GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAG', 'AATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG']
396 446
['GATGGGATTGGGGTTTTCCCCTCCCATGTGCTCAAGACTGGCGCTAAAAGTTTTGAGCTTCTCAAAAGTCTAGAGCCACCGTCCAGGGAGCAGGTAGCTGCTGGGCTCCGGGGACACTTTGCGTTCGGGCTGGGAGCGTGCTTTCCACGACGGTGACACGCTTCCCTGGATTGGCAGCCAGACTGCCTTCCGGGTCACTGCCATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAG', 'AATTCGCCAGAGGCTGCTCCCCCCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCG']
>>> help(sorted)
Help on built-in function sorted in module builtins:
sorted(iterable, /, *, key=None, reverse=False)
Return a new list containing all items from the iterable in ascending order.
A custom key function can be supplied to customize the sort order, and the
reverse flag can be set to request the result in descending order.
11.
Interogate the difference between these two ways to copy a list. Both are not correct.
alter the lists after the "copy" by adding a new element to the list
print the lists before and after you alter the "copy"
>>> my_list = ['a', 'bb', 'ccc']
>>> list_copy = my_list
>>> list_copy.append('blah')
>>> list_copy()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>> print(list_copy)
['a', 'bb', 'ccc', 'blah']
>>> print (my_list)
['a', 'bb', 'ccc', 'blah'
****this way created another name for the original list - didn't actually copy
>>> my_list = ['a', 'bb', 'ccc']
>>> list_copy = my_list.copy()
>>> list_copy.append('blah')
>>> print(list_copy)
['a', 'bb', 'ccc', 'blah']
>>> print(my_list)
['a', 'bb', 'ccc']
****this way created a copy of my_list and made additions to the copy.