get_zscore: Calculate Z-Scores for Allele Intensities or Counts

View source: R/standardization.R

get_zscoreR Documentation

Calculate Z-Scores for Allele Intensities or Counts

Description

This function computes per-marker Z-scores based on the total signal intensity (R), which typically represents the sum of reference (X) and alternative (Y) allele signals. The Z-score measures how much each sample deviates from the mean intensity of that marker.

Usage

get_zscore(data = NULL, geno.pos = NULL)

Arguments

data

A data.frame containing signal intensity and ratio values with the following columns:

MarkerName

Marker identifiers.

SampleName

Sample identifiers.

X

Reference allele intensity or count.

Y

Alternative allele intensity or count.

R

Total signal or depth (i.e., X + Y).

ratio

Allelic ratio, typically Y / (X + Y).

geno.pos

A data.frame with marker genomic positions, containing the following columns:

MarkerName

Marker identifiers.

Chromosome

Chromosome identifier where the marker is located.

Position

Genomic position (base-pair coordinate) of the marker.

Details

The function also merges positional metadata from the 'geno.pos' input, adding chromosome and physical position for each marker.

Value

A data.frame containing the following columns:

MarkerName

Marker ID.

Chr

Chromosome corresponding to the marker.

Position

Genomic position (bp).

SampleName

Sample ID.

z

Z-score computed per marker across all samples.

Markers with missing chromosome or position information are excluded from the final output.

Examples

data <- data.frame(
  MarkerName = rep("m1", 5),
  SampleName = paste0("S", 1:5),
  X = c(100, 110, 90, 95, 85),
  Y = c(200, 190, 210, 205, 215),
  R = c(300, 300, 300, 300, 300),
  ratio = c(0.67, 0.63, 0.70, 0.68, 0.72)
)
geno.pos <- data.frame(MarkerName = "m1", Chromosome = "1", Position = 123456)
get_zscore(data, geno.pos)


Qploidy documentation built on June 8, 2025, 10 a.m.