Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
b084fc35
Commit
b084fc35
authored
9 years ago
by
barillac
Browse files
Options
Downloads
Patches
Plain Diff
small fix
SVN: 34458
parent
1363ed04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plasmid/source/core-plugins/weismigration/1/dss/drop-boxes/add_strain_parents/add_strain_parents.py
+57
-30
57 additions, 30 deletions
...1/dss/drop-boxes/add_strain_parents/add_strain_parents.py
with
57 additions
and
30 deletions
plasmid/source/core-plugins/weismigration/1/dss/drop-boxes/add_strain_parents/add_strain_parents.py
+
57
−
30
View file @
b084fc35
...
...
@@ -27,11 +27,12 @@ def update_sample_with_parents(tr, sample_dict):
space_code
=
"
MATERIALS
"
project_code
=
"
YEASTS
"
# The dictionary keys come from the CSV file
sample_id
=
sample_dict
[
'
identifier
'
]
sample_id
=
"
/MATERIALS/
"
+
sample_dict
[
'
Code
'
]
yeast_parent_code
=
sample_dict
[
'
derived from
'
]
yeast_parent_code_split
=
re
.
split
(
"
and|,|\&|\+|x|/|-|\?|\(|\)
"
,
yeast_parent_code
)
print
sample_id
,
yeast_parent_code_split
parents_code_list
=
[]
#e.split("/|-|\?|\(|\)"
# insert=sample_dict['Insert']
# insert_split=re.split("/|-|\?|\(|\|+)", insert)
...
...
@@ -46,35 +47,61 @@ def update_sample_with_parents(tr, sample_dict):
# if
for
name
in
yeast_parent_code_split
:
sample
=
tr
.
getSample
(
sample_id
)
sample_for_update
=
tr
.
makeSampleMutable
(
sample
)
if
re
.
search
(
"
kwy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
kwy
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
pKW
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
pKW
"
,
"
PKW
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
PKW
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
kwy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
kwy
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
KWY
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWY
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
match
(
"
KW\d+
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KW
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
k
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
k
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
KWYY
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWYY
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
elif
re
.
search
(
"
KWy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWy
"
,
"
KWY
"
).
strip
()
sample_for_update
.
setParentSampleIdentifiers
([
yeast_parent_id
])
if
not
sample_id
==
"
/MATERIALS/KWY5055
"
and
not
sample_id
==
"
/MATERIALS/KWY5542
"
and
not
sample_id
==
"
/MATERIALS/KWY4260
"
:
sample
=
tr
.
getSample
(
sample_id
)
sample_for_update
=
tr
.
makeSampleMutable
(
sample
)
if
not
re
.
search
(
"
Roy Parker
"
,
name
)
and
not
re
.
search
(
"
ku
"
,
name
):
if
re
.
search
(
"
kwy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
kwy
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
KWY
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWY
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
pKW
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
pKW
"
,
"
PKW
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
PKW
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
kwy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
kwy
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
match
(
"
KW\d+
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KW
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
# elif re.search ("k", name):
# yeast_parent_id = "/MATERIALS/"+name.replace("k","KWY").strip()
# parents_code_list.append(yeast_parent_id)
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
KWYY
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWYY
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
KWy
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
replace
(
"
KWy
"
,
"
KWY
"
).
strip
()
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
elif
re
.
search
(
"
KWY
"
,
name
):
yeast_parent_id
=
"
/MATERIALS/
"
+
name
.
strip
()
if
not
yeast_parent_id
==
"
/MATERIALS/KWY
"
:
parents_code_list
.
append
(
yeast_parent_id
)
print
"
PARENTS:
"
,
parents_code_list
sample_for_update
.
setParentSampleIdentifiers
(
parents_code_list
)
...
...
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