get_cumulative_positions: Assign cumulative positions to postions split by scaffolds.

Description Usage Arguments Value Examples

View source: R/reordering_functions.R

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

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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/genomics-plotting documentation built on April 14, 2021, 1:18 a.m.