Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jass
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Léo HENCHES
jass
Commits
42746925
Commit
42746925
authored
3 years ago
by
Cyril NERIN
Browse files
Options
Downloads
Patches
Plain Diff
FIX #92 FEAT #93 FEAT #94
parent
492654cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jass/models/project.py
+80
-0
80 additions, 0 deletions
jass/models/project.py
with
80 additions
and
0 deletions
jass/models/project.py
+
80
−
0
View file @
42746925
...
@@ -5,6 +5,8 @@ compute joint statistics and generate plots for a given set of phenotypes
...
@@ -5,6 +5,8 @@ compute joint statistics and generate plots for a given set of phenotypes
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
typing
import
List
from
typing
import
List
import
os
import
os
import
sys
import
shutil
import
hashlib
import
hashlib
from
jass.models.base_model_
import
Model
from
jass.models.base_model_
import
Model
...
@@ -15,6 +17,7 @@ from jass.models.worktable import (
...
@@ -15,6 +17,7 @@ from jass.models.worktable import (
get_worktable_genomedata
,
get_worktable_genomedata
,
get_worktable_local_manhattan_data
,
get_worktable_local_manhattan_data
,
get_worktable_local_heatmap_data
,
get_worktable_local_heatmap_data
,
get_annotation_gene_exon_data
,
)
)
from
jass.config
import
config
from
jass.config
import
config
...
@@ -150,6 +153,13 @@ class Project(Model):
...
@@ -150,6 +153,13 @@ class Project(Model):
"""
"""
return
os
.
path
.
join
(
self
.
get_folder_path
(),
"
workTable.hdf5
"
)
return
os
.
path
.
join
(
self
.
get_folder_path
(),
"
workTable.hdf5
"
)
def
get_inittable_path
(
self
):
"""
get_inittable_path
Gets the path of the file initTable.hdf5
"""
return
os
.
path
.
join
(
config
[
"
DATA_DIR
"
],
"
initTable.hdf5
"
)
def
get_csv_path
(
self
):
def
get_csv_path
(
self
):
"""
"""
get_csv_path
get_csv_path
...
@@ -193,6 +203,15 @@ class Project(Model):
...
@@ -193,6 +203,15 @@ class Project(Model):
self
.
get_worktable_path
(),
chromosome
,
region
self
.
get_worktable_path
(),
chromosome
,
region
)
)
def
get_project_gene_exon_data
(
self
,
chromosome
:
str
=
None
,
start
:
str
=
None
,
end
:
str
=
None
):
return
get_annotation_gene_exon_data
(
self
.
get_worktable_path
(),
self
.
get_inittable_path
(),
chromosome
,
start
,
end
)
def
get_id
(
self
,
chromosome
=
None
,
start
=
None
,
end
=
None
):
def
get_id
(
self
,
chromosome
=
None
,
start
=
None
,
end
=
None
):
m
=
hashlib
.
md5
()
m
=
hashlib
.
md5
()
for
phenotype_id
in
[
phenotype
.
id
for
phenotype
in
self
.
_phenotypes
]:
for
phenotype_id
in
[
phenotype
.
id
for
phenotype
in
self
.
_phenotypes
]:
...
@@ -275,6 +294,64 @@ class Project(Model):
...
@@ -275,6 +294,64 @@ class Project(Model):
print
(
"
csv_file_generation:csv_file_status={}
"
.
format
(
csv_file_status
))
print
(
"
csv_file_generation:csv_file_status={}
"
.
format
(
csv_file_status
))
return
csv_file_status
return
csv_file_status
def
get_error_msg
(
self
):
fileExt
=
r
"
_MSG.log
"
the_folder
=
self
.
get_folder_path
()
list_file
=
[
os
.
path
.
join
(
the_folder
,
fichier
)
\
for
fichier
in
os
.
listdir
(
the_folder
)
if
fichier
.
endswith
(
fileExt
)]
if
(
len
(
list_file
)
==
0
):
the_message
=
"
"
else
:
for
fichier
in
list_file
:
the_message
=
"
\n
"
with
open
(
fichier
,
'
r
'
)
as
filin
:
lignes
=
filin
.
readlines
()
for
ligne
in
lignes
:
the_message
+=
"
{}
"
.
format
(
ligne
)
return
the_message
def
get_dispo_gene_exon
(
self
):
return
self
.
get_project_functional_state
(
"
ERROR_GENE_EXON_MSG.log
"
)
def
get_project_functional_state
(
self
,
detail
=
None
):
the_folder
=
self
.
get_folder_path
()
if
(
detail
==
None
):
fileExt
=
r
"
_MSG.log
"
list_file
=
[
os
.
path
.
join
(
the_folder
,
fichier
)
\
for
fichier
in
os
.
listdir
(
the_folder
)
if
fichier
.
endswith
(
fileExt
)]
if
(
len
(
list_file
)
==
0
):
the_state
=
Project
.
READY
else
:
the_state
=
Project
.
ERROR
else
:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
the_folder
,
detail
)):
the_state
=
Project
.
ERROR
else
:
the_state
=
Project
.
READY
return
the_state
def
get_initialized
(
self
,
to_init
=
"
0
"
):
print
(
"
project::get_initialized({})
"
.
format
(
to_init
))
P_state
=
self
.
status
if
((
P_state
!=
Project
.
DOES_NOT_EXIST
)
and
(
to_init
!=
"
0
"
)):
print
(
"
suppression si erreur
"
)
#
F_state
=
self
.
get_project_functional_state
()
# if an error occurred during a previous execution,
# the project files are deleted to force the creation
# of a new project
if
((
F_state
==
Project
.
ERROR
)
or
(
P_state
==
Project
.
ERROR
)):
try
:
shutil
.
rmtree
(
self
.
get_folder_path
())
except
OSError
as
e
:
print
(
e
,
file
=
sys
.
stderr
)
return
self
.
status
def
get_file_building_tb_path
(
file_path
):
def
get_file_building_tb_path
(
file_path
):
return
file_path
+
"
.log
"
return
file_path
+
"
.log
"
...
@@ -287,3 +364,6 @@ def get_file_status(file_path):
...
@@ -287,3 +364,6 @@ def get_file_status(file_path):
return
Project
.
ERROR
return
Project
.
ERROR
else
:
else
:
return
Project
.
CREATING
return
Project
.
CREATING
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