Skip to content
Snippets Groups Projects
Commit a2a74135 authored by Bienchen's avatar Bienchen
Browse files

Moved out decision for target seq name and seq file

parent af746920
No related branches found
No related tags found
No related merge requests found
...@@ -13,12 +13,13 @@ from ost import io, seq ...@@ -13,12 +13,13 @@ from ost import io, seq
from promod3.core import helper from promod3.core import helper
def _FetchAlnFromFastaOpt(argstr): def _GetTrgNameSeqFile(argstr):
""" """Sort out what is target name and what is the sequence file name.
Dissasemble an argument to '--fasta' into an alignment and return.
With only two items in the argument string to '--fasta' we allow arbitrary
orders. So we have to check for the 'trg:' prefix. With this, sequence files
names may not start with 'trg:'.
""" """
# get which element of the argument list is the target identifier and
# which one is the filename
if argstr[0].startswith('trg:'): if argstr[0].startswith('trg:'):
trgname = argstr[0][4:] trgname = argstr[0][4:]
seqfile = argstr[1] seqfile = argstr[1]
...@@ -35,8 +36,15 @@ def _FetchAlnFromFastaOpt(argstr): ...@@ -35,8 +36,15 @@ def _FetchAlnFromFastaOpt(argstr):
"argument 'trg:' defining the "+ "argument 'trg:' defining the "+
"target sequence name, empty one "+ "target sequence name, empty one "+
"found: '%s'" % ' '.join(argstr), 14) "found: '%s'" % ' '.join(argstr), 14)
# checking that alignment file exists
helper.FileExists("Alignment", 12, seqfile) helper.FileExists("Alignment", 12, seqfile)
return trgname, seqfile
def _FetchAlnFromFastaOpt(argstr):
"""
Dissasemble an argument to '--fasta' into an alignment and return.
"""
trgname, seqfile = _GetTrgNameSeqFile(argstr)
# checking if alignment file has 'gz' extension # checking if alignment file has 'gz' extension
is_gz = helper.FileGzip("Alignment", 13, seqfile) is_gz = helper.FileGzip("Alignment", 13, seqfile)
# loading the alignment, switch for gzip # loading the alignment, switch for gzip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment