Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
msa-limit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Rohmer Coralie
msa-limit
Commits
47a82eb5
Commit
47a82eb5
authored
3 years ago
by
Rohmer Coralie
Browse files
Options
Downloads
Patches
Plain Diff
Choice nbr cores & add meta consensus in total out
parent
8ed197cf
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
msa_limit.py
+29
-7
29 additions, 7 deletions
msa_limit.py
src/snakemake_launcher.sh
+7
-3
7 additions, 3 deletions
src/snakemake_launcher.sh
src/total_data_format.py
+27
-12
27 additions, 12 deletions
src/total_data_format.py
with
63 additions
and
22 deletions
msa_limit.py
+
29
−
7
View file @
47a82eb5
...
...
@@ -16,6 +16,9 @@ def usage():
"
IUPAC consensus sequence in the diploid case
\n
"
,
"
optional:
"
,
"
-c <int>
"
,
"
default: 24
"
,
"
number of cores
"
,
"
-n <string>
"
,
"
default: date and time of execution
"
,
"
name of the experiment
"
,
...
...
@@ -53,6 +56,10 @@ def usage():
"
run_config <string> <string> ...
"
,
"
Launches the pipeline from configuration file(s)
"
,
"
required: path to the configuration file(s).
"
,
"
optional:
"
,
"
-c <int>
"
,
"
default: 24
"
,
"
number of cores
"
,
"
rulegraph
"
,
"
Displays a graph of the snakemake rules
"
,
sep
=
"
\n
"
)
...
...
@@ -104,21 +111,32 @@ def summary():
result
=
subprocess
.
Popen
(
"
ls experiments
"
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
exp_names
=
result
.
communicate
()[
0
].
decode
(
"
utf-8
"
)
exp_names
=
re
.
sub
(
'
\n
'
,
r
'
'
,
exp_names
)
result
=
subprocess
.
run
(
"
./src/total_data_format.py -m -n
"
+
exp_names
,
shell
=
True
)
result
=
subprocess
.
run
(
"
./src/total_data_format.py -n
"
+
exp_names
,
shell
=
True
)
else
:
print
(
"
No experiment has been launched yet
"
)
def
run_config
():
cores
=
""
try
:
index_c
=
sys
.
argv
.
index
(
"
-c
"
)
cores
=
sys
.
argv
[
index_c
+
1
]
del
sys
.
argv
[
index_c
+
1
]
del
sys
.
argv
[
index_c
]
except
:
pass
try
:
path_config
=
sys
.
argv
[
2
]
except
:
print
(
"
ERROR: The configuration file(s) is missing.
"
)
print
(
"
Usage: msa_limit.py run_config <path config file>.
"
)
sys
.
exit
()
cores
=
""
i
=
2
end_files
=
0
while
(
not
end_files
):
result
=
subprocess
.
run
([
"
./src/snakemake_launcher.sh
"
,
path_config
])
result
=
subprocess
.
run
([
"
./src/snakemake_launcher.sh
"
,
path_config
,
cores
])
i
+=
1
try
:
path_config
=
sys
.
argv
[
i
]
...
...
@@ -239,9 +257,13 @@ else:
lines
.
append
(
"
O: [
"
+
nb_region
+
"
]
"
)
except
:
pass
cores
=
""
try
:
cores
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-c
"
)
+
1
]
except
:
pass
print
(
'
\n
'
.
join
(
lines
))
#fichier = open(os.path.join("configuration_files",exp_name + ".yaml"), "w")
#fichier.write('\n'.join(lines))
#fichier.close()
#result = subprocess.run(["./src/snakemake_launcher.sh",os.path.join("configuration_files",exp_name + ".yaml")])
fichier
=
open
(
os
.
path
.
join
(
"
configuration_files
"
,
exp_name
+
"
.yaml
"
),
"
w
"
)
fichier
.
write
(
'
\n
'
.
join
(
lines
))
fichier
.
close
()
result
=
subprocess
.
run
([
"
./src/snakemake_launcher.sh
"
,
os
.
path
.
join
(
"
configuration_files
"
,
exp_name
+
"
.yaml
"
),
cores
])
This diff is collapsed.
Click to expand it.
src/snakemake_launcher.sh
+
7
−
3
View file @
47a82eb5
...
...
@@ -8,6 +8,10 @@ CURRENT_PATH=`pwd`
conda activate
$CURRENT_PATH
/.conda_snakemake
CONFIG_EXPERIMENT
=
$1
echo
"Launche Snakemake with
$1
"
snakemake
--configfile
$1
-c24
--use-conda
--rerun-incomplete
if
[[
$2
==
""
]]
;
then
CORES
=
"24"
else
CORES
=
$2
fi
echo
"Launche Snakemake with
$CONFIG_EXPERIMENT
"
snakemake
--configfile
$CONFIG_EXPERIMENT
-c
$CORES
--use-conda
--rerun-incomplete
This diff is collapsed.
Click to expand it.
src/total_data_format.py
+
27
−
12
View file @
47a82eb5
...
...
@@ -7,6 +7,7 @@ ATTRIBUTES_TO_DISPLAY_THRESHOLD_INDEPENDANT=["time","memory"]
PREFIX
=
"
region_
"
RESULT_FOLDER
=
"
results
"
NAME_DATA_FILE
=
"
data_align_t
"
NAME_META_CONSENSUS
=
"
consensus_consensus_
"
#Script use
def
use
():
print
(
"
\n
Script:
\t
total_data_formating.py
"
,
...
...
@@ -38,6 +39,13 @@ else:
next_name
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-n
"
)
+
i
]
except
:
end_names
=
1
META_CONSENSUS
=
True
try
:
a
=
[
sys
.
argv
[
sys
.
argv
.
index
(
"
-m
"
)]]
except
:
META_CONSENSUS
=
False
files
=
{}
i
=
0
result
=
subprocess
.
run
(
"
if [ ! -d results_mean ]; then mkdir results_mean;fi
"
,
shell
=
True
)
...
...
@@ -56,6 +64,9 @@ for i in range(len(exp_names)):
for
root
,
dirs
,
current_files
in
os
.
walk
(
os
.
path
.
join
(
EXP
,
exp_names
[
i
],
dir
,
RESULT_FOLDER
)):
for
filename
in
current_files
:
if
re
.
search
(
NAME_DATA_FILE
,
filename
):
search_meta_consensus
=
re
.
search
(
NAME_META_CONSENSUS
,
filename
)
if
((
search_meta_consensus
and
META_CONSENSUS
)
or
(
not
search_meta_consensus
and
not
META_CONSENSUS
)):
threshold
=
filename
.
split
(
"
.
"
)[
0
].
split
(
"
_t
"
)[
1
]
if
(
threshold
not
in
files
):
files
[
threshold
]
=
{}
...
...
@@ -123,18 +134,22 @@ for threshold in files :
# Write to output files
#-----------------------------------------------------------------------------
for
threshold
in
files
:
add_name_file_output
=
""
attributes_to_display
=
ATTRIBUTES_TO_DISPLAY
if
(
not
META_CONSENSUS
):
if
(
threshold
==
last_threshold
):
attributes_to_display
+=
ATTRIBUTES_TO_DISPLAY_THRESHOLD_INDEPENDANT
else
:
add_name_file_output
=
NAME_META_CONSENSUS
for
attribute
in
attributes_to_display
:
#Header for files
if
attribute
in
ATTRIBUTES_TO_DISPLAY_THRESHOLD_INDEPENDANT
:
pass
output_mean
=
open
(
"
results_mean/data_mean_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_regions/data_all_region_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
output_mean
=
open
(
"
results_mean/data_
"
+
add_name_file_output
+
"
mean_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_regions/data_
"
+
add_name_file_output
+
"
all_region_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
else
:
output_mean
=
open
(
"
results_mean/data_mean_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_regions/data_all_region_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_mean
=
open
(
"
results_mean/data_
"
+
add_name_file_output
+
"
mean_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_regions/data_
"
+
add_name_file_output
+
"
all_region_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_mean
.
write
(
"
,,
"
)
output_all
.
write
(
"
,,
"
)
for
exp_name
in
data
[
"
order
"
]:
...
...
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