function transformData (data) {
                    return data.map(function (d) {
                        // d3 requires for the array of values to be sorted before using median and quantile
                        d.data.sort(function (a, b) { return (a - b); });
                        var median = d3.median(d.data);
                        var q1 = d3.quantile(d.data, 0.25);
                        var q3 = d3.quantile(d.data, 0.75);
                        var outliers = [];
                        var notoutliers = [];
                        var iqr = q3 - q1; // interquartile range

                        // find the outliers and not outliers
                        d.data.forEach(function (d) {
                            if (d < q1 - 1.5 * iqr || d > q3 + 1.5 * iqr) {
                                outliers.push(d);
                            } else {
                                notoutliers.push(d);
                            }
                        });

                        return {
                            tissueSiteDetailId: d.tissueSiteDetailId,
                            median: median,
                            q1: q1,
                            q3: q3,
                            lowerLimit: notoutliers[0],
                            upperLimit: notoutliers[notoutliers.length - 1],
                            outliers: outliers
                        };
                    });
                }
// map data to old gtex format
map data to old gtex format
map data to old gtex format
function transformData (data) {
                    return data.map(function (d) {
                        d.data.sort(function (a, b) { return (a - b); });
                        var median = d3.median(d.data);
                        var q1 = d3.quantile(d.data, 0.25);
                        var q3 = d3.quantile(d.data, 0.75);
                        var outliers = [];
                        var notoutliers = [];
                        var iqr = q3 - q1; 
                        d.data.forEach(function (d) {
                            if (d < q1 - 1.5 * iqr || d > q3 + 1.5 * iqr) {
                                outliers.push(d);
                            } else {
                                notoutliers.push(d);
                            }
                        });
                        return {
                            tissueSiteDetailId: d.tissueSiteDetailId,
                            median: median,
                            q1: q1,
                            q3: q3,
                            lowerLimit: notoutliers[0],
                            upperLimit: notoutliers[notoutliers.length - 1],
                            outliers: outliers
                        };
                    });
                }
function transformData ( data ) { return data . map ( function ( d ) { d . data . sort ( function ( a , b ) { return ( a - b ) ; } ) ; var median = d3 . median ( d . data ) ; var q1 = d3 . quantile ( d . data , 0.25 ) ; var q3 = d3 . quantile ( d . data , 0.75 ) ; var outliers = [ ] ; var notoutliers = [ ] ; var iqr = q3 - q1 ; d . data . forEach ( function ( d ) { if ( d < q1 - 1.5 * iqr || d > q3 + 1.5 * iqr ) { outliers . push ( d ) ; } else { notoutliers . push ( d ) ; } } ) ; return { tissueSiteDetailId : d . tissueSiteDetailId , median : median , q1 : q1 , q3 : q3 , lowerLimit : notoutliers [ 0 ] , upperLimit : notoutliers [ notoutliers . length - 1 ] , outliers : outliers } ; } ) ; }
map data to old gtex format
map data to old gtex format
// d3 requires for the array of values to be sorted before using median and quantile // interquartile range // find the outliers and not outliers