@staticmethod
def xr_upper_quartile(counts):
    """
        Perform the upper quartile normalization.

        :param counts: An ``xarray.DataArray`` containing the raw count values. The shape is
            assumed to be (samples by genes). Zero counts are expected to be present as zeros.

        :returns: The upper quartile normalized count matrix.
        """
    adjusted_counts = counts + 0.1
    per_sample_quantile = adjusted_counts.quantile(0.75, dim='Gene')
    per_sample_quantile_mean = per_sample_quantile.mean()
    return (adjusted_counts / (per_sample_quantile / per_sample_quantile_mean)
        ).drop('quantile')
