Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Comparative Study of HGT Inference Methods
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
general
ccb
Comparative Study of HGT Inference Methods
Commits
654897c2
Commit
654897c2
authored
1 month ago
by
Swastik Mishra
Browse files
Options
Downloads
Patches
Plain Diff
correct paths and add error handling for py2 requirement
parent
388b938c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
02-run_programs/src/run_angst.py
+23
-4
23 additions, 4 deletions
02-run_programs/src/run_angst.py
with
23 additions
and
4 deletions
02-run_programs/src/run_angst.py
+
23
−
4
View file @
654897c2
...
@@ -7,6 +7,7 @@ import logging
...
@@ -7,6 +7,7 @@ import logging
import
shutil
import
shutil
from
datetime
import
timedelta
from
datetime
import
timedelta
from
ete3
import
Tree
from
ete3
import
Tree
import
traceback
# Create or get the logger
# Create or get the logger
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -56,11 +57,29 @@ def run_ANGST_on_NOG(pool_args):
...
@@ -56,11 +57,29 @@ def run_ANGST_on_NOG(pool_args):
# Run AnGST
# Run AnGST
try
:
try
:
logger
.
info
(
"
Running AnGST for NOG_ID {}
"
.
format
(
nog_id
))
logger
.
info
(
"
Running AnGST for NOG_ID {}
"
.
format
(
nog_id
))
logger
.
info
(
"
Command: python2 {} {}
"
.
format
(
angst_script
,
input_path
))
# make sure python2 is available
py2_available
=
False
for
path
in
os
.
environ
[
"
PATH
"
].
split
(
os
.
pathsep
):
full_path
=
os
.
path
.
join
(
path
,
"
python2
"
)
if
os
.
path
.
isfile
(
full_path
)
and
os
.
access
(
full_path
,
os
.
X_OK
):
py2_available
=
True
break
if
not
py2_available
:
logger
.
error
(
"
python2 is not available in PATH
"
)
raise
EnvironmentError
(
"
python2 is not available in PATH. Make sure you are in the correct conda environment.
"
)
subprocess
.
check_call
([
"
python2
"
,
angst_script
,
input_path
])
subprocess
.
check_call
([
"
python2
"
,
angst_script
,
input_path
])
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
logger
.
error
(
logger
.
error
(
"
AnGST failed for NOG_ID {} with error
\n
{}
"
.
format
(
nog_id
,
e
))
"
AnGST failed for NOG_ID {} with error
\n
{}
"
.
format
(
nog_id
,
e
))
return
None
return
None
except
Exception
as
e
:
logger
.
error
(
"
AnGST failed for NOG_ID {} with error
\n
{}
"
.
format
(
nog_id
,
e
))
logger
.
error
(
traceback
.
format_exc
())
return
None
return
nog_id
return
nog_id
...
@@ -93,10 +112,10 @@ if __name__ == '__main__':
...
@@ -93,10 +112,10 @@ if __name__ == '__main__':
# use argparse for reading in the number of threads and the input trees file
# use argparse for reading in the number of threads and the input trees file
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
description
=
"
Run AnGST on a set of gene trees
"
)
description
=
"
Run AnGST on a set of gene trees
"
)
parser
.
add_argument
(
"
--species
"
,
"
-s
"
,
type
=
str
,
default
=
"
../../
data/
1236_wol_tree_pruned_angst.nwk
"
,
parser
.
add_argument
(
"
--species
"
,
"
-s
"
,
type
=
str
,
default
=
"
../../1236_wol_tree_pruned_angst.nwk
"
,
help
=
"
Path to species tree file (default: ../../
data/
1236_wol_tree_pruned_angst.nwk)
"
)
help
=
"
Path to species tree file (default: ../../1236_wol_tree_pruned_angst.nwk)
"
)
parser
.
add_argument
(
"
--gene
"
,
"
-g
"
,
type
=
str
,
default
=
"
../../
data/
1236_pruned_gene_trees.tsv
"
,
parser
.
add_argument
(
"
--gene
"
,
"
-g
"
,
type
=
str
,
default
=
"
../../1236_pruned_gene_trees.tsv
"
,
help
=
"
Path to gene trees file (default: ../../
data/
1236_pruned_gene_trees.tsv)
"
)
help
=
"
Path to gene trees file (default: ../../1236_pruned_gene_trees.tsv)
"
)
parser
.
add_argument
(
"
--threads
"
,
"
-t
"
,
type
=
int
,
default
=
50
,
parser
.
add_argument
(
"
--threads
"
,
"
-t
"
,
type
=
int
,
default
=
50
,
help
=
"
Number of threads to use for parallelization (default: 50)
"
)
help
=
"
Number of threads to use for parallelization (default: 50)
"
)
parser
.
add_argument
(
"
--output
"
,
"
-o
"
,
type
=
str
,
default
=
"
./Results
"
,
parser
.
add_argument
(
"
--output
"
,
"
-o
"
,
type
=
str
,
default
=
"
./Results
"
,
...
...
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