Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Toby Hodges
software-carpentry-nov2015
Commits
8f7ff052
Commit
8f7ff052
authored
Nov 04, 2015
by
Toby Hodges
Browse files
added Python script
parent
c833ac46
Changes
1
Hide whitespace changes
Inline
Side-by-side
script1.py
0 → 100644
View file @
8f7ff052
filename
=
'exampleSequences1.fasta'
handle
=
open
(
filename
,
'r'
)
for
line
in
handle
.
readlines
():
if
line
[
0
]
==
'>'
:
print
(
line
)
a
=
0
c
=
0
g
=
0
t
=
0
else
:
for
l
in
line
:
if
l
==
'A'
:
a
=
a
+
1
elif
l
==
'C'
:
c
=
c
+
1
elif
l
==
'G'
:
g
=
g
+
1
else
:
t
=
t
+
1
print
(
'nucleotide content:'
)
print
(
'A:'
,
str
(
a
))
print
(
'C:'
,
str
(
c
))
print
(
'G:'
,
str
(
g
))
print
(
'T:'
,
str
(
t
))
x
=
float
(
c
+
g
)
/
(
c
+
g
+
a
+
t
)
print
(
x
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment