Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scRNA-seq-simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
zavolan_group
pipelines
scRNA-seq-simulation
Commits
958f7e41
Commit
958f7e41
authored
3 years ago
by
Kathleen Moriarty
Browse files
Options
Downloads
Patches
Plain Diff
replace readline() to use file handle as iterator
parent
68d3e622
Branches
Branches containing commit
No related tags found
1 merge request
!17
Issue 7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/read_sequencing.py
+21
-21
21 additions, 21 deletions
src/read_sequencing.py
with
21 additions
and
21 deletions
src/read_sequencing.py
+
21
−
21
View file @
958f7e41
...
...
@@ -37,27 +37,27 @@ def read_sequencing(
frag_desc
=
[]
# type: List[str]
with
open
(
frag_file_name
,
'
r
'
)
as
f
:
frag_line
=
f
.
readline
()
# Store all fragments as a list to parse later
frag_list
=
[]
# type: List[str]
# Store combined fragment lines
frag_str
=
""
while
frag_line
!=
""
:
# To stop when the end of file is reached
if
frag_line
.
startswith
(
'
>
'
):
# Determine if this is the first fragment in the file
# Ignore the description line (starting with >) of the first fragment
if
not
(
len
(
frag_list
)
==
0
and
frag_str
==
""
):
# Not the first fragment. Append to list.
frag_list
.
append
(
frag_str
)
frag_str
=
""
# Store description line for output file
frag_desc
.
append
(
frag_line
)
else
:
frag_str
=
frag_str
+
frag_line
.
rstrip
(
"
\n
"
)
# Read next line
frag_line
=
f
.
readline
()
frag_list
.
append
(
frag_str
)
for
frag_line
in
f
:
# Store all fragments as a list to parse later
frag_list
=
[]
# type: List[str]
# Store combined fragment lines
frag_str
=
""
while
frag_line
!=
""
:
# To stop when the end of file is reached
if
frag_line
.
startswith
(
'
>
'
):
# Determine if this is the first fragment in the file
# Ignore the description line (starting with >) of the first fragment
if
not
(
len
(
frag_list
)
==
0
and
frag_str
==
""
):
# Not the first fragment. Append to list.
frag_list
.
append
(
frag_str
)
frag_str
=
""
# Store description line for output file
frag_desc
.
append
(
frag_line
)
else
:
frag_str
=
frag_str
+
frag_line
.
rstrip
(
"
\n
"
)
# Read next line
frag_line
=
f
.
readline
()
frag_list
.
append
(
frag_str
)
# Store list of random nucleotides from which to sample when read length is too short
nucleotides
=
[
'
A
'
,
'
C
'
,
'
G
'
,
'
T
'
]
...
...
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