回答編集履歴
2
投稿者様の結果?に近くなるように直しました
test
CHANGED
@@ -12,8 +12,6 @@
|
|
12
12
|
|
13
13
|
seq = ""
|
14
14
|
|
15
|
-
|
16
|
-
|
17
15
|
for line in f.readlines():
|
18
16
|
|
19
17
|
if line.startswith(">"):
|
@@ -26,20 +24,48 @@
|
|
26
24
|
|
27
25
|
count.append(len(seq))
|
28
26
|
|
29
|
-
print(len(seq)
|
27
|
+
print(len(seq))
|
30
28
|
|
31
29
|
|
32
30
|
|
31
|
+
|
32
|
+
|
33
|
-
>実行結果
|
33
|
+
>> 実行結果
|
34
34
|
|
35
35
|
>YP_009518834.1 putative uncharacterized protein YjiT [Escherichia coli str. K-1
|
36
36
|
|
37
37
|
2 substr. MG1655]
|
38
38
|
|
39
|
-
0
|
39
|
+
0
|
40
40
|
|
41
|
-
|
41
|
+
70
|
42
42
|
|
43
|
+
140
|
44
|
+
|
45
|
+
210
|
46
|
+
|
47
|
+
280
|
48
|
+
|
49
|
+
350
|
50
|
+
|
51
|
+
420
|
52
|
+
|
53
|
+
490
|
54
|
+
|
55
|
+
505
|
56
|
+
|
57
|
+
505
|
58
|
+
|
59
|
+
505
|
60
|
+
|
61
|
+
>YP_009518833.1 uncharacterized protein YtiA [Escherichia coli str. K-12 substr.
|
62
|
+
|
43
|
-
5
|
63
|
+
MG1655]
|
64
|
+
|
65
|
+
505
|
66
|
+
|
67
|
+
575
|
68
|
+
|
69
|
+
590
|
44
70
|
|
45
71
|
```
|
1
仕様がよくわからないのであれですが、とりあえず質問者さんの動かしたいと思われるコードに直しました
test
CHANGED
@@ -1,87 +1,45 @@
|
|
1
|
-
|
1
|
+
あまり良くわかっていませんが...
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
こういう動作であっていますか?
|
6
4
|
|
7
5
|
|
8
6
|
|
9
7
|
```python
|
10
8
|
|
11
|
-
|
9
|
+
with open("short.sequ.txt", 'rt', encoding='utf-8') as f:
|
12
10
|
|
13
|
-
|
11
|
+
count = []
|
14
12
|
|
15
|
-
|
13
|
+
seq = ""
|
16
14
|
|
17
|
-
|
15
|
+
|
18
16
|
|
19
|
-
|
17
|
+
for line in f.readlines():
|
20
18
|
|
21
|
-
.
|
19
|
+
if line.startswith(">"):
|
22
20
|
|
23
|
-
|
21
|
+
print(line, end='')
|
24
22
|
|
25
|
-
|
23
|
+
else:
|
26
24
|
|
27
|
-
|
25
|
+
seq += "".join(line.split())
|
28
26
|
|
29
|
-
|
27
|
+
count.append(len(seq))
|
30
28
|
|
31
|
-
[1, 2, 3, 4, 5]
|
32
|
-
|
33
|
-
[1, 2, 3, 4, 5, 6]
|
34
|
-
|
35
|
-
[1, 2, 3, 4, 5, 6, 7]
|
36
|
-
|
37
|
-
[1, 2, 3, 4, 5, 6, 7, 8]
|
38
|
-
|
39
|
-
|
29
|
+
print(len(seq), end='')
|
40
30
|
|
41
31
|
|
42
32
|
|
43
|
-
|
33
|
+
>実行結果
|
44
34
|
|
35
|
+
>YP_009518834.1 putative uncharacterized protein YjiT [Escherichia coli str. K-1
|
45
36
|
|
37
|
+
2 substr. MG1655]
|
46
38
|
|
47
|
-
|
39
|
+
070140210280350420490505505505>YP_009518833.1 uncharacterized protein YtiA [Esch
|
48
40
|
|
41
|
+
erichia coli str. K-12 substr. MG1655]
|
49
42
|
|
50
|
-
|
51
|
-
|
43
|
+
505575590
|
52
|
-
|
53
|
-
>>> count = []
|
54
|
-
|
55
|
-
>>> f = (1,2,3,4,5,6,7,8,9)
|
56
|
-
|
57
|
-
>>> for line in f:
|
58
|
-
|
59
|
-
... count = 0
|
60
|
-
|
61
|
-
... count += line
|
62
|
-
|
63
|
-
... count
|
64
|
-
|
65
|
-
...
|
66
|
-
|
67
|
-
1
|
68
|
-
|
69
|
-
2
|
70
|
-
|
71
|
-
3
|
72
|
-
|
73
|
-
4
|
74
|
-
|
75
|
-
5
|
76
|
-
|
77
|
-
6
|
78
|
-
|
79
|
-
7
|
80
|
-
|
81
|
-
8
|
82
|
-
|
83
|
-
9
|
84
|
-
|
85
|
-
>>>
|
86
44
|
|
87
45
|
```
|