Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panacota
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Amandine PERRIN
panacota
Commits
45a7d392
Commit
45a7d392
authored
4 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
Try removing first tests of align
parent
5cd2200a
No related branches found
No related tags found
No related merge requests found
Pipeline
#39663
failed
4 years ago
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_functional/test_align.py
+92
-92
92 additions, 92 deletions
test/test_functional/test_align.py
with
92 additions
and
92 deletions
test/test_functional/test_align.py
+
92
−
92
View file @
45a7d392
...
...
@@ -111,98 +111,98 @@ def setup_teardown_module():
# assert "END" in " ".join(log_content)
def
test_main_exist_ok
():
"""
Test main all files exist and are ok, no force -> end without error, with warnings on re-use
"""
corepers
=
os
.
path
.
join
(
TESTPATH
,
"
test_pers0.99FX.lst
"
)
list_genomes
=
os
.
path
.
join
(
"
test
"
,
"
data
"
,
"
pangenome
"
,
"
test_files
"
,
"
list_to_pan.txt
"
)
dname
=
"
TEST4exists
"
dbpath
=
os
.
path
.
join
(
"
test
"
,
"
data
"
,
"
pangenome
"
,
"
test_files
"
,
"
example_db
"
)
outdir
=
os
.
path
.
join
(
GENEPATH
,
"
test_main_exist_ok
"
)
threads
=
1
force
=
False
cmd
=
"
cmd test_main_exist_ok
"
# Create output directories and files
aldir
=
os
.
path
.
join
(
outdir
,
"
Align-
"
+
dname
)
listdir
=
os
.
path
.
join
(
outdir
,
"
List-
"
+
dname
)
treedir
=
os
.
path
.
join
(
outdir
,
"
Phylo-
"
+
dname
)
os
.
makedirs
(
aldir
)
os
.
makedirs
(
listdir
)
os
.
makedirs
(
treedir
)
# Create content of listdir
ex_listdir
=
os
.
path
.
join
(
EXPPATH
,
"
exp_listdir-pers
"
)
genomes
=
[
"
GEN2.1017.00001
"
,
"
GEN4.1111.00001
"
,
"
GENO.1017.00001
"
,
"
GENO.1216.00002
"
]
for
gen
in
genomes
:
outgen
=
os
.
path
.
join
(
listdir
,
f
"
{
dname
}
-getEntry_gen_
{
gen
}
.txt
"
)
refgen
=
os
.
path
.
join
(
ex_listdir
,
f
"
getEntry_gen_
{
gen
}
"
)
shutil
.
copyfile
(
refgen
,
outgen
)
outprt
=
os
.
path
.
join
(
listdir
,
f
"
{
dname
}
-getEntry_prt_
{
gen
}
.txt
"
)
refprt
=
os
.
path
.
join
(
ex_listdir
,
f
"
getEntry_prt_
{
gen
}
"
)
shutil
.
copyfile
(
refprt
,
outprt
)
# Create content of aldir
ex_aldir
=
os
.
path
.
join
(
EXPPATH
,
"
exp_aldir-pers
"
)
fams
=
[
1
,
4
,
6
,
8
,
10
,
11
,
13
,
14
]
for
fam
in
fams
:
outgen
=
os
.
path
.
join
(
aldir
,
f
'
{
dname
}
-current.
{
fam
}
.gen
'
)
refgen
=
os
.
path
.
join
(
ex_aldir
,
f
"
current.
{
fam
}
.gen
"
)
shutil
.
copyfile
(
refgen
,
outgen
)
outprt
=
os
.
path
.
join
(
aldir
,
f
'
{
dname
}
-current.
{
fam
}
.prt
'
)
refprt
=
os
.
path
.
join
(
ex_aldir
,
f
"
current.
{
fam
}
.prt
"
)
shutil
.
copyfile
(
refprt
,
outprt
)
outmiss
=
os
.
path
.
join
(
aldir
,
f
'
{
dname
}
-current.
{
fam
}
.miss.lst
'
)
refmiss
=
os
.
path
.
join
(
ex_aldir
,
f
"
current.
{
fam
}
.miss.lst
"
)
shutil
.
copyfile
(
refmiss
,
outmiss
)
outaln
=
os
.
path
.
join
(
aldir
,
f
'
{
dname
}
-mafft-align.
{
fam
}
.aln
'
)
refaln
=
os
.
path
.
join
(
ex_aldir
,
f
"
mafft-align.
{
fam
}
.aln
"
)
shutil
.
copyfile
(
refaln
,
outaln
)
outbtr
=
os
.
path
.
join
(
aldir
,
f
'
{
dname
}
-mafft-prt2nuc.
{
fam
}
.aln
'
)
refbtr
=
os
.
path
.
join
(
ex_aldir
,
f
"
mafft-prt2nuc.
{
fam
}
.aln
"
)
shutil
.
copyfile
(
refbtr
,
outbtr
)
outcat
=
os
.
path
.
join
(
aldir
,
dname
+
"
-complete.cat.aln
"
)
refcat
=
os
.
path
.
join
(
EXPPATH
,
"
exp_pers4genome-complete.cat.aln
"
)
shutil
.
copyfile
(
refcat
,
outcat
)
# Create content of treedir
outgrp
=
os
.
path
.
join
(
treedir
,
dname
+
"
.grp.aln
"
)
refgrp
=
os
.
path
.
join
(
EXPPATH
,
"
exp_pers4genomes.grp.aln
"
)
shutil
.
copyfile
(
refgrp
,
outgrp
)
# Run align module
al
.
main
(
cmd
,
corepers
,
list_genomes
,
dname
,
dbpath
,
outdir
,
threads
,
force
)
# Check logs
logfile
=
os
.
path
.
join
(
outdir
,
"
PanACoTA-align_TEST4exists.log.details
"
)
with
open
(
logfile
,
"
r
"
)
as
lc
:
log_content
=
lc
.
readlines
()
assert
(
"
Reading PersGenome and constructing lists of missing genomes in
"
"
each family
"
)
in
"
"
.
join
(
log_content
)
for
gen
in
genomes
:
assert
(
f
"
For genome
{
gen
}
, test/data/align/generated_by_func_tests/test_main_exist_ok/
"
f
"
List-TEST4exists/TEST4exists-getEntry_prt_
{
gen
}
.txt and test/data/align/
"
"
generated_by_func_tests/test_main_exist_ok/List-TEST4exists/
"
f
"
TEST4exists-getEntry_gen_
{
gen
}
.txt already exist. The program
"
"
will use them to extract proteins and genes. If you prefer to rewrite
"
"
them, use option -F
"
)
in
"
"
.
join
(
log_content
)
assert
(
"
Starting alignment of all families: protein alignment, back-translation to
"
"
nucleotides, and add missing genomes in the family
"
)
in
"
"
.
join
(
log_content
)
for
fam
in
fams
:
assert
"
Checking extractions for family {}
"
.
format
(
fam
)
in
"
"
.
join
(
log_content
)
assert
(
"
Alignment already done for family {}. The program will use it for next
"
"
steps
"
).
format
(
fam
)
in
"
"
.
join
(
log_content
)
assert
(
"
All extraction files already existing (see detailed log for more
"
"
information)
"
)
in
"
"
.
join
(
log_content
)
assert
(
"
All prt and gene files for all families already exist. The program will use them
"
"
for the next step. If you want to re-extract a given family, remove its prt and
"
"
gen extraction files. If you want to re-extract all families, use option -F
"
"
(or --force).
"
)
in
"
"
.
join
(
log_content
)
assert
(
"
Alignments already concatenated in
"
"
test/data/align/generated_by_func_tests/test_main_exist_ok/Align-TEST4exists/
"
"
TEST4exists-complete.cat.aln. Program will
"
"
use it for next steps. If you want to redo it, remove it before
"
"
running.
"
)
in
"
"
.
join
(
log_content
)
assert
(
"
Alignments already grouped by genome in
"
"
test/data/align/generated_by_func_tests/test_main_exist_ok/Phylo-TEST4exists/
"
"
TEST4exists.grp.aln. Program will
"
"
end.
"
)
in
"
"
.
join
(
log_content
)
assert
"
END
"
in
"
"
.
join
(
log_content
)
#
def test_main_exist_ok():
#
"""
#
Test main all files exist and are ok, no force -> end without error, with warnings on re-use
#
"""
#
corepers = os.path.join(TESTPATH, "test_pers0.99FX.lst")
#
list_genomes = os.path.join("test", "data", "pangenome", "test_files", "list_to_pan.txt")
#
dname = "TEST4exists"
#
dbpath = os.path.join("test", "data", "pangenome", "test_files", "example_db")
#
outdir = os.path.join(GENEPATH, "test_main_exist_ok")
#
threads = 1
#
force = False
#
cmd = "cmd test_main_exist_ok"
#
# Create output directories and files
#
aldir = os.path.join(outdir, "Align-" + dname)
#
listdir = os.path.join(outdir, "List-" + dname)
#
treedir = os.path.join(outdir, "Phylo-" + dname)
#
os.makedirs(aldir)
#
os.makedirs(listdir)
#
os.makedirs(treedir)
#
# Create content of listdir
#
ex_listdir = os.path.join(EXPPATH, "exp_listdir-pers")
#
genomes = ["GEN2.1017.00001", "GEN4.1111.00001", "GENO.1017.00001", "GENO.1216.00002"]
#
for gen in genomes:
#
outgen = os.path.join(listdir, f"{dname}-getEntry_gen_{gen}.txt")
#
refgen = os.path.join(ex_listdir, f"getEntry_gen_{gen}")
#
shutil.copyfile(refgen, outgen)
#
outprt = os.path.join(listdir, f"{dname}-getEntry_prt_{gen}.txt")
#
refprt = os.path.join(ex_listdir, f"getEntry_prt_{gen}")
#
shutil.copyfile(refprt, outprt)
#
# Create content of aldir
#
ex_aldir = os.path.join(EXPPATH, "exp_aldir-pers")
#
fams = [1, 4, 6, 8, 10, 11, 13, 14]
#
for fam in fams:
#
outgen = os.path.join(aldir, f'{dname}-current.{fam}.gen')
#
refgen = os.path.join(ex_aldir, f"current.{fam}.gen")
#
shutil.copyfile(refgen, outgen)
#
outprt = os.path.join(aldir, f'{dname}-current.{fam}.prt')
#
refprt = os.path.join(ex_aldir, f"current.{fam}.prt")
#
shutil.copyfile(refprt, outprt)
#
outmiss = os.path.join(aldir, f'{dname}-current.{fam}.miss.lst')
#
refmiss = os.path.join(ex_aldir, f"current.{fam}.miss.lst")
#
shutil.copyfile(refmiss, outmiss)
#
outaln = os.path.join(aldir, f'{dname}-mafft-align.{fam}.aln')
#
refaln = os.path.join(ex_aldir, f"mafft-align.{fam}.aln")
#
shutil.copyfile(refaln, outaln)
#
outbtr = os.path.join(aldir, f'{dname}-mafft-prt2nuc.{fam}.aln')
#
refbtr = os.path.join(ex_aldir, f"mafft-prt2nuc.{fam}.aln")
#
shutil.copyfile(refbtr, outbtr)
#
outcat = os.path.join(aldir, dname + "-complete.cat.aln")
#
refcat = os.path.join(EXPPATH, "exp_pers4genome-complete.cat.aln")
#
shutil.copyfile(refcat, outcat)
#
# Create content of treedir
#
outgrp = os.path.join(treedir, dname + ".grp.aln")
#
refgrp = os.path.join(EXPPATH, "exp_pers4genomes.grp.aln")
#
shutil.copyfile(refgrp, outgrp)
#
# Run align module
#
al.main(cmd, corepers, list_genomes, dname, dbpath, outdir, threads, force)
#
# Check logs
#
logfile = os.path.join(outdir, "PanACoTA-align_TEST4exists.log.details")
#
with open(logfile, "r") as lc:
#
log_content = lc.readlines()
#
assert ("Reading PersGenome and constructing lists of missing genomes in "
#
"each family") in " ".join(log_content)
#
for gen in genomes:
#
assert (f"For genome {gen}, test/data/align/generated_by_func_tests/test_main_exist_ok/"
#
f"List-TEST4exists/TEST4exists-getEntry_prt_{gen}.txt and test/data/align/"
#
"generated_by_func_tests/test_main_exist_ok/List-TEST4exists/"
#
f"TEST4exists-getEntry_gen_{gen}.txt already exist. The program "
#
"will use them to extract proteins and genes. If you prefer to rewrite "
#
"them, use option -F ") in " ".join(log_content)
#
assert ("Starting alignment of all families: protein alignment, back-translation to "
#
"nucleotides, and add missing genomes in the family") in " ".join(log_content)
#
for fam in fams:
#
assert "Checking extractions for family {}".format(fam) in " ".join(log_content)
#
assert ("Alignment already done for family {}. The program will use it for next "
#
"steps").format(fam) in " ".join(log_content)
#
assert ("All extraction files already existing (see detailed log for more "
#
"information)") in " ".join(log_content)
#
assert ("All prt and gene files for all families already exist. The program will use them "
#
"for the next step. If you want to re-extract a given family, remove its prt and "
#
"gen extraction files. If you want to re-extract all families, use option -F "
#
"(or --force).") in " ".join(log_content)
#
assert ("Alignments already concatenated in "
#
"test/data/align/generated_by_func_tests/test_main_exist_ok/Align-TEST4exists/"
#
"TEST4exists-complete.cat.aln. Program will "
#
"use it for next steps. If you want to redo it, remove it before "
#
"running.") in " ".join(log_content)
#
assert ("Alignments already grouped by genome in "
#
"test/data/align/generated_by_func_tests/test_main_exist_ok/Phylo-TEST4exists/"
#
"TEST4exists.grp.aln. Program will "
#
"end.") in " ".join(log_content)
#
assert "END" in " ".join(log_content)
def
test_main_exist_emptygrp
(
capsys
):
...
...
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