Skip to content

Commit

Permalink
set seqlen limit for muscle5
Browse files Browse the repository at this point in the history
  • Loading branch information
trvinh committed Jun 15, 2023
1 parent b06b3a1 commit a8541f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions fdog/libs/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ def do_align(aligner, fa_file):
# check muscle version
if aligner == 'muscle':
if get_muscle_version(aligner) == 'v3':
if fasta_fn.check_long_seq(fa_file) == 1:
if fasta_fn.check_long_seq(fa_file, 12000) == 1:
aligner = 'mafft-linsi'
else:
aligner = 'muscle_v3'
else:
aligner = 'muscle_v5'
if fasta_fn.check_long_seq(fa_file, 15000) == 1:
aligner = 'mafft-linsi'
else:
aligner = 'muscle_v5'
# create alignment command and run
align_cline = ''
if aligner == 'muscle_v3':
Expand Down
7 changes: 4 additions & 3 deletions fdog/libs/fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ def append_to_fasta_file(fa_file, new_fa_dict):
fa_out.write('>%s\n%s\n' % (id, seq))


def check_long_seq(fa_file):
""" Check if any sequence longer than 12.000 aa/nt"""
def check_long_seq(fa_file, max_len):
""" Check if any sequence longer than max_len
(12.000 aa/nt for muscle v3; 20.000 for muscle v5)"""
fa_seq = SeqIO.parse(open(fa_file),'fasta')
for fa in fa_seq:
if len(fa.seq) > 12000:
if len(fa.seq) > max_len:
return(1)
return(0)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name="fdog",
version="0.1.15",
version="0.1.16",
python_requires='>=3.7.0',
description="Feature-aware Directed OrtholoG search tool",
long_description=long_description,
Expand Down

0 comments on commit a8541f8

Please sign in to comment.