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
dd1be418
Commit
dd1be418
authored
10 years ago
by
Laros
Browse files
Options
Downloads
Patches
Plain Diff
Removed old assignment.
parent
59406270
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
make_fastq/example.py
+0
-30
0 additions, 30 deletions
make_fastq/example.py
make_fastq/make_fastq.py
+0
-7
0 additions, 7 deletions
make_fastq/make_fastq.py
make_fastq/sequencer.py
+0
-38
0 additions, 38 deletions
make_fastq/sequencer.py
with
0 additions
and
75 deletions
make_fastq/example.py
deleted
100644 → 0
+
0
−
30
View file @
59406270
#!/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.
make_fastq/make_fastq.py
deleted
100644 → 0
+
0
−
7
View file @
59406270
#!/usr/bin/env python
from
sequencer
import
Sequencer
if
__name__
==
"
__main__
"
:
for
tile
in
Sequencer
(
20
):
print
tile
This diff is collapsed.
Click to expand it.
make_fastq/sequencer.py
deleted
100644 → 0
+
0
−
38
View file @
59406270
#!/usr/bin/env python
import
random
class
Sequencer
(
object
):
"""
Simulate a sequencing run.
For every iteration, return a tile of data points as a list of tuples. The
first element of the tuple contains the nucleotide, the second element
contains the quality score.
"""
bases
=
[
'
A
'
,
'
C
'
,
'
G
'
,
'
T
'
]
def
__init__
(
self
,
spots
,
readlength
=
100
):
self
.
cycle
=
0
self
.
readlength
=
readlength
self
.
spots
=
spots
def
__iter__
(
self
):
return
self
def
__len__
(
self
):
return
self
.
readlength
def
next
(
self
):
self
.
cycle
+=
1
if
self
.
cycle
>
self
.
readlength
:
raise
StopIteration
tile
=
[]
for
_
in
range
(
self
.
spots
):
nucleotide
=
self
.
bases
[
random
.
randrange
(
4
)]
quality
=
40
-
(
self
.
cycle
*
random
.
randrange
(
40
)
/
self
.
readlength
)
tile
.
append
((
nucleotide
,
quality
))
return
tile
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