Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
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
schwede
ProMod3
Commits
46805eb0
Commit
46805eb0
authored
9 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Simplifying handling fasta
parent
0fe4afca
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/pymod/core/pm3argparse.py
+19
-10
19 additions, 10 deletions
core/pymod/core/pm3argparse.py
core/tests/test_pm3argparse.py
+1
-1
1 addition, 1 deletion
core/tests/test_pm3argparse.py
with
20 additions
and
11 deletions
core/pymod/core/pm3argparse.py
+
19
−
10
View file @
46805eb0
...
@@ -213,6 +213,24 @@ class PM3OptionsNamespace(object):
...
@@ -213,6 +213,24 @@ class PM3OptionsNamespace(object):
if
'
ALIGNMENT
'
in
activated
:
if
'
ALIGNMENT
'
in
activated
:
self
.
_PostProcessAlignment
()
self
.
_PostProcessAlignment
()
def
_FetchAlnFromFastaOpt
(
self
,
argstr
):
"""
Dissasemble an argument to
'
--fasta
'
into an alignment and return.
"""
# get which element of the argument list is the target identifier and
# which one is the filename
if
argstr
[
0
].
startswith
(
'
trg:
'
):
trgname
=
argstr
[
0
][
4
:]
seqfile
=
argstr
[
1
]
elif
argstr
[
1
].
startswith
(
'
trg:
'
):
trgname
=
argstr
[
1
][
4
:]
seqfile
=
argstr
[
0
]
else
:
helper
.
MsgErrorAndExit
(
"'
--fasta %s
'
requires
"
%
'
'
.
join
(
argstr
)
+
"
one argument prefixed with
'
trg:
'
marking
"
+
"
the target sequence name
"
,
11
)
return
trgname
,
seqfile
def
_PostProcessAlignment
(
self
):
def
_PostProcessAlignment
(
self
):
#pylint: disable=no-member
#pylint: disable=no-member
#pylint: disable=attribute-defined-outside-init
#pylint: disable=attribute-defined-outside-init
...
@@ -223,16 +241,7 @@ class PM3OptionsNamespace(object):
...
@@ -223,16 +241,7 @@ class PM3OptionsNamespace(object):
self
.
alignments
=
seq
.
AlignmentList
()
self
.
alignments
=
seq
.
AlignmentList
()
if
self
.
fasta
:
if
self
.
fasta
:
for
src
in
self
.
fasta
:
for
src
in
self
.
fasta
:
if
src
[
0
].
startswith
(
'
trg:
'
):
trgname
,
seqfile
=
self
.
_FetchAlnFromFastaOpt
(
src
)
trgname
=
src
[
0
][
4
:]
seqfile
=
src
[
1
]
elif
src
[
1
].
startswith
(
'
trg:
'
):
trgname
=
src
[
1
][
4
:]
seqfile
=
src
[
0
]
else
:
helper
.
MsgErrorAndExit
(
"'
--fasta
'
requires one argument
"
+
"
prefixed with
'
trg:
'
marking the
"
+
"
target sequence name
"
,
11
)
if
not
len
(
trgname
):
if
not
len
(
trgname
):
helper
.
MsgErrorAndExit
(
"'
--fasta
'
requires argument
"
+
helper
.
MsgErrorAndExit
(
"'
--fasta
'
requires argument
"
+
"'
trg:
'
defining the
"
+
"'
trg:
'
defining the
"
+
...
...
This diff is collapsed.
Click to expand it.
core/tests/test_pm3argparse.py
+
1
−
1
View file @
46805eb0
...
@@ -87,7 +87,7 @@ class PM3ArgParseTests(unittest.TestCase):
...
@@ -87,7 +87,7 @@ class PM3ArgParseTests(unittest.TestCase):
parser
.
Parse
([
'
--fasta
'
,
'
foo
'
,
'
bar
'
])
parser
.
Parse
([
'
--fasta
'
,
'
foo
'
,
'
bar
'
])
self
.
assertEqual
(
ecd
.
exception
.
code
,
11
)
self
.
assertEqual
(
ecd
.
exception
.
code
,
11
)
self
.
assertEqual
(
self
.
log
.
messages
[
'
ERROR
'
][
0
],
self
.
assertEqual
(
self
.
log
.
messages
[
'
ERROR
'
][
0
],
"'
--fasta
'
requires one
"
+
"'
--fasta
foo bar
'
requires one
"
+
"
argument prefixed with
'
trg:
'
marking the target
"
+
"
argument prefixed with
'
trg:
'
marking the target
"
+
"
sequence name
"
)
"
sequence name
"
)
...
...
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