get_cumulative_positions: Assign cumulative positions to positions split by scaffolds.

View source: R/reordering_functions.R

get_cumulative_positionsR Documentation

Assign cumulative positions to positions split by scaffolds.

Description

This function will add a new column to your tibble, bp_cum with the cumulative sum of positions in the ps column. This makes it so that the stat in each row in the tibble can be plotted sequentially.

Usage

get_cumulative_positions(
  input,
  scaffold_lengths,
  buffer = 0,
  after = "scaffolds"
)

Arguments

input

A tibble with the columns scaf (scaffold), ps (position), and stat (statistic) at the minimum. This function operates on the ps column.

scaffold_lengths

Path to the two-column tab-delimited file containing scaffold name and length.

buffer

Extra amount to add between consecutive scaffolds or chromosomes.

after

Where to add buffer, either after scaffolds or chromosomes.

Value

The original tibble, containing a new column, bp_cum, with cumulative positions.

Examples

a1 <- system.file("extdata", "test.gemma_gwas.txt.gz",
                  package = "gwplotting" )

a2 <- system.file("extdata", "test.chromSizes.txt.gz",
                  package = "gwplotting" )

b <- load_gemma_gwas( a1, pval = 'p_wald' )
b <- get_cumulative_positions( input = b, scaffold_lengths = a2,
buffer=1000, after = 'scaffolds' )
b

nwvankuren/gwplotting documentation built on July 5, 2024, 4:24 p.m.