% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shift_footprints.R
\name{shiftFootprints}
\alias{shiftFootprints}
\title{Shift footprints by selected offsets}
\usage{
shiftFootprints(footprints, shifts)
}
\arguments{
\item{footprints}{(GAlignments) object of RiboSeq reads}

\item{shifts}{a data.frame / data.table with minimum 2 columns,
selected_lengths and selected_shifts.
Output from \code{\link{detectRibosomeShifts}}}
}
\value{
A GRanges object of shifted footprints, sorted and resized to 1bp of
p-site, with metacolumn "size" indicating footprint size before shifting and
resizing, sorted in increasing order.
}
\description{
Function shifts footprints (GRanges) using specified offsets for every of
the specified lengths. Reads that do not conform to the specified lengths
are filtered out and rejected. Reads are resized to single base in 5' end
fashion, treated as p site.
This function takes account for junctions in cigars of the reads. Length of
the footprint is saved in size' parameter of GRanges output. Footprints are
also sorted according to their genomic position, ready to be saved as a
bed file.
}
\details{
The two columns in shift are:
- fraction Numeric vector of lengths of footprints you select
for shifting.
- offsets_start Numeric vector of shifts for coresponding
selected_lengths. eg. c(10, -10) with selected_lengths of c(31, 32) means
length of 31 will be shifted left by 10. Footprints of length 32 will be
shifted right by 10.

NOTE: It will remove softclips from valid width, the CIGAR 3S30M is qwidth
33, but will remove 3S so final read width is 30 in ORFik.
}
\examples{
\dontrun{
# input path to gtf, or load it as TxDb.
gtf_file <- system.file("extdata", "annotations.gtf", package = "ORFik")
# load reads
riboSeq_file <- system.file("extdata", "ribo-seq.bam", package = "ORFik")
footprints <- GenomicAlignments::readGAlignments(
  riboSeq_file, param = ScanBamParam(flag = scanBamFlag(
    isDuplicate = FALSE, isSecondaryAlignment = FALSE)))
# detect the shifts automagically
shifts <- detectRibosomeShifts(footprints, gtf_file)
# shift the RiboSeq footprints
shiftedReads <- shiftFootprints(footprints, shifts)
}
}
\seealso{
Other pshifting: \code{\link{changePointAnalysis}},
  \code{\link{detectRibosomeShifts}}
}
\concept{pshifting}
