/// <summary> /// Gets the link score from the given data. /// </summary> /// <returns>The link scores.</returns> /// <param name="corrVectors">Link data.</param> /// <param name="count">Total number of links.</param> protected override LinkCorrelation[] GetCorrelations(IEnumerable <HistoneExpressionLinkData> corrVectors, int count) { LinkCorrelation[] data = new LinkCorrelation[count]; var zscores = corrVectors.Select(x => x.ZScore); double[] logpvalues = Calculations.ZscoreToLogPvalue(zscores); int i = 0; foreach (var corr in corrVectors) { var corrData = (HistoneExpressionLinkData)corr; double lp = logpvalues[i]; data[i] = new LinkCorrelation { Tss = corrData.Tss, Locus = corrData.Locus, Correlation = corrData.Correlation, Pvalue = Math.Exp(lp), LogPvalue = lp }; i++; } return(data); }
/// <summary> /// Formats the score into a bed file line. /// </summary> /// <returns>The score bed file line.</returns> /// <param name="scoreData">Score data.</param> /// <param name="location">Location of the target gene.</param> /// <param name="distance">Locus-TSS distance.</param> protected override string FormatScoreTsvLine(LinkCorrelation scoreData, Location location, int distance) { return(string.Format( "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7:F15}\t{8:" + (scoreData.Pvalue == 0 ? "" : "0.000e+000") + "}\t{9}\t{10}\t{11}", location.Chromosome, location.DirectionalStart, location.DirectionalStart, scoreData.Tss, "NA", ////scoreData.CorrectedPvalue, location.Strand, scoreData.Locus, scoreData.Correlation, //scoreData.Pvalue == 0 ? 2e-322 : scoreData.Pvalue, scoreData.Pvalue, distance, this.HistoneName, location.AlternateName)); }