Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
psot
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOaAS
psot
Merge requests
!7
Fix loss of last fasta entry. Solves #31
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Fix loss of last fasta entry. Solves #31
fix-include-sequence
into
develop
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Fix loss of last fasta entry. Solves #31
hmueller
requested to merge
fix-include-sequence
into
develop
Dec 8, 2017
Overview
0
Commits
1
Pipelines
0
Changes
1
Bugfix for loss of last fasta entry when converting fasta file to json in module include_sequence.
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
171d47d8
1 commit,
Dec 8, 2017
1 file
+
7
−
11
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
scripts/convert_fasta.py
+
7
−
11
View file @ 171d47d8
Edit in single-file editor
Open in Web IDE
Show full file
#!/usr/bin/python3
import
sys
import
json
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'
Convert a fasta file into a json document
'
)
parser
.
add_argument
(
'
--result
'
,
'
-r
'
,
required
=
True
,
help
=
'
The fasta file
result directory
'
)
parser
.
add_argument
(
'
--result
'
,
'
-r
'
,
required
=
True
,
help
=
'
The fasta file
'
)
parser
.
add_argument
(
'
--output
'
,
'
-o
'
,
required
=
True
,
help
=
'
The json file
'
)
args
=
parser
.
parse_args
()
documents
=
{}
with
open
(
args
.
result
)
as
f
:
# second scan for data
entry
=
None
id
=
None
for
line
in
f
:
if
line
.
startswith
(
"
>
"
):
id
=
line
.
split
()[
0
][
1
:]
if
entry
is
not
None
:
documents
[
entry
[
'
id
'
]]
=
entry
entry
=
{
'
id
'
:
id
,
'
sequence
'
:
''
}
else
:
entry
[
'
sequence
'
]
=
entry
[
'
sequence
'
]
+
line
.
strip
()
id
=
line
.
split
()[
0
][
1
:]
documents
[
id
]
=
{
'
id
'
:
id
,
'
sequence
'
:
''
}
elif
id
is
not
None
:
documents
[
id
][
'
sequence
'
]
+=
line
.
strip
()
output_filename
=
args
.
output
with
open
(
output_filename
,
'
w
'
)
as
o
:
Loading