Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Programming course assignments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
courses
Programming course assignments
Commits
0883380b
Commit
0883380b
authored
11 years ago
by
J.F.J. Laros
Browse files
Options
Downloads
Patches
Plain Diff
Added an example solution for the sequencer assignment.
parent
227b8241
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
make_fastq/example.py
+30
-0
30 additions, 0 deletions
make_fastq/example.py
with
30 additions
and
0 deletions
make_fastq/example.py
0 → 100644
+
30
−
0
View file @
0883380b
#!/usr/bin/env python
from
sequencer
import
Sequencer
def
quality
(
quals
):
return
sum
(
quals
)
/
len
(
quals
)
def
trim
(
read
,
quals
,
score
):
for
position
in
range
(
len
(
read
)
-
1
,
-
1
,
-
1
):
if
quals
[
position
]
>=
score
:
return
read
[:
position
+
1
],
quals
[:
position
+
1
]
def
make_fastq
():
spots
=
2
run
=
Sequencer
(
spots
)
reads
=
[
""
for
_
in
range
(
spots
)]
quals
=
[[]
for
_
in
range
(
spots
)]
for
tile
in
run
:
for
read_id
,
base
in
enumerate
(
tile
):
reads
[
read_id
]
+=
base
[
0
]
quals
[
read_id
].
append
(
base
[
1
])
for
read_id
,
read
in
enumerate
(
reads
):
print
read
,
quality
(
quals
[
read_id
])
read
,
quals
[
read_id
]
=
trim
(
read
,
quals
[
read_id
],
39
)
print
read
,
quality
(
quals
[
read_id
])
if
__name__
==
"
__main__
"
:
make_fastq
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment