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
f6e776c1
Commit
f6e776c1
authored
1 year ago
by
Bryan BRANCOTTE
Browse files
Options
Downloads
Patches
Plain Diff
move valideInitTableNamePattern into initTable sources
parent
f4d32385
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jass/models/inittable.py
+2
-1
2 additions, 1 deletion
jass/models/inittable.py
jass/models/phenotype.py
+3
-6
3 additions, 6 deletions
jass/models/phenotype.py
with
5 additions
and
7 deletions
jass/models/inittable.py
+
2
−
1
View file @
f6e776c1
...
@@ -5,6 +5,7 @@ Created on Tue Mar 28 09:57:33 2017
...
@@ -5,6 +5,7 @@ Created on Tue Mar 28 09:57:33 2017
@author: vguillem, hjulienne, hmenager
@author: vguillem, hjulienne, hmenager
"""
"""
import
os
import
os
import
re
import
glob
import
glob
import
logging
import
logging
from
pandas
import
HDFStore
,
DataFrame
,
read_csv
,
concat
,
options
,
read_hdf
from
pandas
import
HDFStore
,
DataFrame
,
read_csv
,
concat
,
options
,
read_hdf
...
@@ -18,7 +19,7 @@ from functools import reduce
...
@@ -18,7 +19,7 @@ from functools import reduce
options
.
mode
.
chained_assignment
=
None
options
.
mode
.
chained_assignment
=
None
warnings
.
filterwarnings
(
"
ignore
"
,
category
=
tables
.
NaturalNameWarning
)
warnings
.
filterwarnings
(
"
ignore
"
,
category
=
tables
.
NaturalNameWarning
)
from
pydantic
import
BaseModel
valideInitTableNamePattern
=
re
.
compile
(
"
^([A-Z]*[a-z]*-*\.?[0-9]*)+$
"
)
class
InitMeta
(
object
):
class
InitMeta
(
object
):
def
__init__
(
self
,
nb_snps
,
nb_phenotypes
):
def
__init__
(
self
,
nb_snps
,
nb_phenotypes
):
...
...
This diff is collapsed.
Click to expand it.
jass/models/phenotype.py
+
3
−
6
View file @
f6e776c1
...
@@ -3,10 +3,10 @@ from typing import List, Optional
...
@@ -3,10 +3,10 @@ from typing import List, Optional
import
os
import
os
import
pandas
import
pandas
import
re
from
pydantic
import
BaseModel
,
validator
from
pydantic
import
BaseModel
,
validator
from
jass.config
import
config
from
jass.config
import
config
from
jass.models.inittable
import
valideInitTableNamePattern
class
Phenotype
(
BaseModel
):
class
Phenotype
(
BaseModel
):
...
@@ -76,16 +76,13 @@ def get_available_phenotypes(init_file_path: str):
...
@@ -76,16 +76,13 @@ def get_available_phenotypes(init_file_path: str):
return
phenotypes
return
phenotypes
_initTableNamePattern
=
re
.
compile
(
"
^([A-Z]*[a-z]*-*\.?[0-9]*)+$
"
)
class
InitTableNameModel
(
BaseModel
):
class
InitTableNameModel
(
BaseModel
):
initTableName
:
Optional
[
str
]
=
"
initTable.hdf5
"
initTableName
:
Optional
[
str
]
=
"
initTable.hdf5
"
@validator
(
"
initTableName
"
)
@validator
(
"
initTableName
"
)
def
validate_path_injection
(
cls
,
value
):
def
validate_path_injection
(
cls
,
value
):
if
not
_i
nitTableNamePattern
.
match
(
value
):
if
not
valideI
nitTableNamePattern
.
match
(
value
):
raise
ValueError
(
f
"
Prohibited char, only
\"
{
_i
nitTableNamePattern
.
pattern
}
\"
allowed.
"
)
raise
ValueError
(
f
"
Prohibited char, only
\"
{
valideI
nitTableNamePattern
.
pattern
}
\"
allowed.
"
)
return
value
return
value
def
get_init_table_path
(
self
):
def
get_init_table_path
(
self
):
...
...
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