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
4c03088a
Commit
4c03088a
authored
Nov 20, 2020
by
marc duez
Committed by
flothoni
Nov 30, 2020
Browse files
screen_mrd.js : regroup screen_mrd functions in an object and extend clone prototype with it
parent
5b372f16
Pipeline
#191796
passed with stages
in 28 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
browser/js/app.js
View file @
4c03088a
...
...
@@ -84,7 +84,6 @@ function loadAfterConf() {
"
../tips
"
,
"
../tokeniser
"
,
"
../indexedDom
"
,
"
../screen_MRD
"
,
// Speed test
"
../speed_test
"
,
"
../form_builder
"
,
...
...
@@ -92,6 +91,7 @@ function loadAfterConf() {
"
../vidjil_vmi
"
,
"
../../test/QUnit/testFiles/data_test
"
,
],
function
(){
if
(
typeof
main
==
"
undefined
"
){
require
([
"
../main
"
]);
}
else
{
...
...
@@ -100,6 +100,8 @@ function loadAfterConf() {
if
(
typeof
config
.
addons
!==
"
undefined
"
)
{
require
(
config
.
addons
);
}
require
([
"
../screen_MRD
"
]);
})
})
},
...
...
browser/js/screen_MRD.js
View file @
4c03088a
...
...
@@ -36,124 +36,133 @@ UNIVERSAL_FAMILY = "UNI"
UNIVERSAL_COEFF
=
'
UNI_COEFF
'
UNIVERSAL_R2
=
'
UNI_R2
'
/**
* @return {string} the family used for fiting at the given time
*/
Clone
.
prototype
.
getFittingFamily
=
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
family
'
in
this
.
mrd
)
{
return
this
.
mrd
.
family
[
time
];
}
else
{
// negative clone: report UNI
return
UNIVERSAL_FAMILY
;
}
};
function
ScreenMRD
()
{}
/**
* @return {string} the normalization coefficient at the given time
*/
Clone
.
prototype
.
getNormCoeff
=
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
norm_coeff
'
in
this
.
mrd
)
{
return
this
.
mrd
.
norm_coeff
[
time
];
}
else
if
(
UNIVERSAL_COEFF
in
this
.
m
.
mrd
)
{
// negative clone:report UNI
return
this
.
m
.
mrd
.
UNI_COEFF
[
time
];
}
else
{
return
""
;
}
};
ScreenMRD
.
prototype
=
{
/**
* @return {string} the Pearson R2 value for the spike-in fitting at the given time
*/
Clone
.
prototype
.
getR2
=
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
R2
'
in
this
.
mrd
)
{
return
this
.
mrd
.
R2
[
time
]
//.toString();
}
else
if
(
UNIVERSAL_R2
in
this
.
m
.
mrd
)
{
// negative clone: report UNI R2
return
this
.
m
.
mrd
.
UNI_R2
[
time
];
}
else
{
return
""
;
}
};
/**
* @return {string} the prevalent germline at the given time
*/
Clone
.
prototype
.
getPrevalent
=
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
{
return
this
.
m
.
mrd
.
prevalent
[
time
];
}
};
/**
* @return {string} the family used for fiting at the given time
*/
getFittingFamily
:
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
family
'
in
this
.
mrd
)
{
return
this
.
mrd
.
family
[
time
];
}
else
{
// negative clone: report UNI
return
UNIVERSAL_FAMILY
;
}
},
/**
* @return {string} the amplification coefficient at the given time
* (ampl. coeff. = total prevalent / total spike)
*/
Clone
.
prototype
.
getAmplCoeff
=
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
/**
* @return {string} the normalization coefficient at the given time
*/
getNormCoeff
:
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
norm_coeff
'
in
this
.
mrd
)
{
return
this
.
mrd
.
norm_coeff
[
time
];
}
else
if
(
UNIVERSAL_COEFF
in
this
.
m
.
mrd
)
{
// negative clone:report UNI
return
this
.
m
.
mrd
.
UNI_COEFF
[
time
];
}
else
{
return
""
;
}
},
/**
* @return {string} the Pearson R2 value for the spike-in fitting at the given time
*/
getR2
:
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
this
.
mrd
!=
undefined
&&
'
R2
'
in
this
.
mrd
)
{
return
this
.
mrd
.
R2
[
time
]
//.toString();
}
else
if
(
UNIVERSAL_R2
in
this
.
m
.
mrd
)
{
// negative clone: report UNI R2
return
this
.
m
.
mrd
.
UNI_R2
[
time
];
}
else
{
return
""
;
}
else
if
(
'
ampl_coeff
'
in
this
.
m
.
mrd
)
{
return
this
.
m
.
mrd
.
ampl_coeff
[
time
]
//.toString();
}
else
{
return
"
Please use version 6 or later of spike-normalization
"
;
}
};
}
},
/**
* @return {string} the prevalent germline at the given time
*/
getPrevalent
:
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
{
return
this
.
m
.
mrd
.
prevalent
[
time
];
}
},
/**
* Return info about a sequence/clone in html
*/
Clone
.
prototype
.
getHtmlInfo_prevalent
=
function
()
{
values
=
[]
if
(
'
mrd
'
in
this
)
{
// this .vidjil file is not all-diagnostic:
// show R2, etc, fields for follow-up samples
content_fitting_family
=
[]
content_norm_coeff
=
[]
content_getR2
=
[]
content_getPrevalent
=
[]
content_getAmplCoeff
=
[]
for
(
k
=
0
;
k
<
this
.
m
.
samples
.
order
.
length
;
k
++
)
{
var
sample
=
this
.
m
.
samples
.
order
[
k
]
// Get prevalent value
var
prevalent
=
this
.
getPrevalent
(
sample
)
if
(
prevalent
!=
""
){
prevalent
=
this
.
m
.
systemBox
(
prevalent
).
outerHTML
+
prevalent
}
content_getPrevalent
.
push
(
prevalent
)
/**
* @return {string} the amplification coefficient at the given time
* (ampl. coeff. = total prevalent / total spike)
*/
getAmplCoeff
:
function
(
time
)
{
if
(
this
.
m
.
mrd
.
prevalent
[
time
]
==
0
)
{
// diagnostic sample
return
""
;
}
else
if
(
'
ampl_coeff
'
in
this
.
m
.
mrd
)
{
return
this
.
m
.
mrd
.
ampl_coeff
[
time
]
//.toString();
}
else
{
return
"
Please use version 6 or later of spike-normalization
"
;
}
},
/**
* Return info about a sequence/clone in html
*/
getHtmlInfo_prevalent
:
function
()
{
values
=
[]
if
(
'
mrd
'
in
this
)
{
// this .vidjil file is not all-diagnostic:
// show R2, etc, fields for follow-up samples
content_fitting_family
=
[]
content_norm_coeff
=
[]
content_getR2
=
[]
content_getPrevalent
=
[]
content_getAmplCoeff
=
[]
for
(
k
=
0
;
k
<
this
.
m
.
samples
.
order
.
length
;
k
++
)
{
var
sample
=
this
.
m
.
samples
.
order
[
k
]
// Computed values
content_fitting_family
.
push
(
this
.
getFittingFamily
(
sample
)
)
content_norm_coeff
.
push
(
this
.
getNormCoeff
(
sample
))
content_getR2
.
push
(
this
.
getR2
(
sample
)
)
content_getAmplCoeff
.
push
(
this
.
getAmplCoeff
(
sample
)
)
// Get prevalent value
var
prevalent
=
this
.
getPrevalent
(
sample
)
if
(
prevalent
!=
""
){
prevalent
=
this
.
m
.
systemBox
(
prevalent
).
outerHTML
+
prevalent
}
content_getPrevalent
.
push
(
prevalent
)
// Computed values
content_fitting_family
.
push
(
this
.
getFittingFamily
(
sample
)
)
content_norm_coeff
.
push
(
this
.
getNormCoeff
(
sample
))
content_getR2
.
push
(
this
.
getR2
(
sample
)
)
content_getAmplCoeff
.
push
(
this
.
getAmplCoeff
(
sample
)
)
}
// include values into html
// name of col, values to show, and DOM id for cells
values
.
push
([
"
prevalent germline
"
,
content_getPrevalent
,
"
mrd_prevalent
"
])
values
.
push
([
"
family used for fitting
"
,
content_fitting_family
,
"
mrd_family
"
])
values
.
push
([
"
normalization coefficient
"
,
content_norm_coeff
,
"
mrd_norm_coeff
"
])
values
.
push
([
"
Pearson R2
"
,
content_getR2
,
"
mrd_pearson
"
])
values
.
push
([
"
total prevalent / total spikes
"
,
content_getAmplCoeff
,
"
mrd_prevalent_on_spike
"
])
}
// include values into html
// name of col, values to show, and DOM id for cells
values
.
push
([
"
prevalent germline
"
,
content_getPrevalent
,
"
mrd_prevalent
"
])
values
.
push
([
"
family used for fitting
"
,
content_fitting_family
,
"
mrd_family
"
])
values
.
push
([
"
normalization coefficient
"
,
content_norm_coeff
,
"
mrd_norm_coeff
"
])
values
.
push
([
"
Pearson R2
"
,
content_getR2
,
"
mrd_pearson
"
])
values
.
push
([
"
total prevalent / total spikes
"
,
content_getAmplCoeff
,
"
mrd_prevalent_on_spike
"
])
return
values
}
return
values
};
}
Clone
.
prototype
=
$
.
extend
(
Object
.
create
(
ScreenMRD
.
prototype
),
Clone
.
prototype
);
\ No newline at end of file
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