Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
5ac26e1b
Commit
5ac26e1b
authored
Jul 08, 2016
by
Mikaël Salson
Browse files
Clone.js: 'end' keys are changed to 'stop' in the seg field
parent
4ab8f18c
Changes
3
Hide whitespace changes
Inline
Side-by-side
browser/js/model_loader.js
View file @
5ac26e1b
...
...
@@ -602,6 +602,9 @@ Model_loader.prototype = {
}
else
{
newSeg
[
key
]
=
seg
[
key
];
}
if
(
typeof
newSeg
[
key
]
==
'
object
'
)
{
newSeg
[
key
]
=
this
.
getConvertedSegNames
(
newSeg
[
key
])
}
}
return
newSeg
;
},
...
...
@@ -620,6 +623,23 @@ Model_loader.prototype = {
return
newSeg
;
},
/**
* Convert fields from old names to new names.
* For instance some fields were called 'end', they now must be 'stop' (see bc32af9)
* We convert all of them.
*/
getConvertedSegNames
:
function
(
seg
)
{
var
renameFields
=
{
'
end
'
:
'
stop
'
}
for
(
field
in
renameFields
)
{
if
(
typeof
seg
[
field
]
!=
'
undefined
'
&&
typeof
seg
[
renameFields
[
field
]]
==
'
undefined
'
)
{
seg
[
renameFields
[
field
]]
=
seg
[
field
]
delete
seg
[
field
]
}
}
return
seg
},
getConvertedBoundary
:
function
(
seg
,
key
,
bound
)
{
var
newSeg
;
if
(
typeof
seg
[
key
+
bound
]
!=
'
undefined
'
)
{
...
...
browser/test/QUnit/testFiles/clone_test.js
View file @
5ac26e1b
...
...
@@ -11,10 +11,10 @@
"
4
"
:
"
IGHD2*03
"
,
'
_evalue
'
:
1
e
-
2
,
"
3start
"
:
15
,
"
5end
"
:
5
,
"
5
"
:
{
'
start
'
:
1
,
'
end
'
:
5
}
,
"
cdr3
"
:
{
"
start
"
:
10
,
"
stop
"
:
15
,
"
end
"
:
15
,
"
aa
"
:
"
ABCDE
"
},
"
junction
"
:
{
...
...
browser/test/QUnit/testFiles/model_test.js
View file @
5ac26e1b
...
...
@@ -9,10 +9,11 @@ test("model: convert", function () {
"
3
"
:
"
J
"
,
"
4
"
:
"
D
"
,
"
5
"
:
{
"
name
"
:
"
V
"
,
"
stop
"
:
0
},
"
cdr3
"
:
{
"
start
"
:
0
,
"
stop
"
:
3
}
"
cdr3
"
:
{
"
start
"
:
0
,
"
end
"
:
3
}
};
equal
(
m
.
getConvertedBoundary
(
json_clone3
.
seg
,
"
5
"
,
"
end
"
),
5
,
"
getConvertedBoundary existant: Ok
"
);
equal
(
typeof
m
.
getConvertedBoundary
(
json_clone3
.
seg
,
"
5
"
,
"
start
"
),
'
undefined
'
,
"
getConvertedBoundary non existant: Ok
"
);
deepEqual
(
m
.
getConvertedSegNames
(
seg
[
'
cdr3
'
]),
{
"
start
"
:
0
,
"
stop
"
:
3
},
"
getConvertedSegNames: ok
"
)
deepEqual
(
m
.
getConvertedSeg
(
seg
,
"
3
"
),
{
"
name
"
:
"
J
"
,
"
start
"
:
3
},
"
getConvertedSeg: Ok
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment