R/get.strand.R

Defines functions get.strand

Documented in get.strand

# get STRAND from INFO or ALT field

get.strand <- function(df) {
  strand <- rep('+', nrow(df));
  if ('STRAND' %in% names(df)) { 
    strand <- df$STRAND;
  } else if (any(grepl('\\]|\\[', df$ALT))) {
    strand[grepl('\\[.*\\[', df$ALT)] <- '-';
  } else {
    catv('STRAND information is not recorded in INFO:STRAND or ALT field. Returning default: + ')
  }
  return(strand);
} 

Try the bedr package in your browser

Any scripts or data that you put into this service are public.

bedr documentation built on April 11, 2025, 5:52 p.m.