Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Read sequencer
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
tools
Read sequencer
Commits
a8955c54
Commit
a8955c54
authored
2 years ago
by
Michael Sandholzer
Browse files
Options
Downloads
Patches
Plain Diff
new file: read_sequencer_package/read_in_FASTA.py
parent
425a8d43
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Function to read in FASTA files and returns a dictionary new file: read_sequencer_package/read_in_FASTA.py
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
read_sequencer_package/read_in_FASTA.py
+26
-0
26 additions, 0 deletions
read_sequencer_package/read_in_FASTA.py
with
26 additions
and
0 deletions
read_sequencer_package/read_in_FASTA.py
0 → 100644
+
26
−
0
View file @
a8955c54
'''
This function reads in FASTA files
argument is file_path
it returns a dictionary with the sequences
'''
import
sys
def
read_in_fasta
(
file_path
):
sequences
=
{}
f
=
open
(
file_path
)
for
line
in
f
:
if
line
[
0
]
==
'
>
'
:
defline
=
line
.
srtip
()
defline
=
defline
.
replace
(
'
>
'
,
''
)
else
:
if
defline
not
in
sequences
:
sequences
[
defline
]
=
''
sequences
[
defline
]
+=
line
.
strip
()
return
sequences
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