1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
\name{BcfInput}
\Rdversion{1.1}
\alias{scanBcfHeader}
\alias{scanBcfHeader,character-method}
\alias{scanBcf}
\alias{scanBcf,character-method}
\alias{asBcf}
\alias{asBcf,character-method}
\alias{indexBcf}
\alias{indexBcf,character-method}
\title{
Operations on `BCF' files.
}
\description{
Import, coerce, or index variant call files in text or binary format.
}
\usage{
scanBcfHeader(file, ...)
\S4method{scanBcfHeader}{character}(file, ...)
scanBcf(file, ...)
\S4method{scanBcf}{character}(file, index = file, ..., param=ScanBcfParam())
asBcf(file, dictionary, destination, ...,
overwrite=FALSE, indexDestination=TRUE)
\S4method{asBcf}{character}(file, dictionary, destination, ...,
overwrite=FALSE, indexDestination=TRUE)
indexBcf(file, ...)
\S4method{indexBcf}{character}(file, ...)
}
\arguments{
\item{file}{For \code{scanBcf} and \code{scanBcfHeader}, the
character() file name of the \sQuote{BCF} file to
be processed, or an instance of class \code{\link{BcfFile}}.}
\item{index}{The character() file name(s) of the `BCF' index to be
processed.}
\item{dictionary}{a character vector of the unique \dQuote{CHROM}
names in the VCF file.}
\item{destination}{The character(1) file name of the location where
the BCF output file will be created. For \code{asBcf} this is
without the \dQuote{.bcf} file suffix.}
\item{param}{A instance of \code{\linkS4class{ScanBcfParam}}
influencing which records are parsed and the \sQuote{INFO} and
\sQuote{GENO} information returned.}
\item{...}{Additional arguments, e.g., for
\code{scanBcfHeader,character-method}, \code{mode} of
\code{\link{BcfFile}}.}
\item{overwrite}{A logical(1) indicating whether the destination
can be over-written if it already exists.}
\item{indexDestination}{A logical(1) indicating whether the created
destination file should also be indexed.}
}
\details{
\code{bcf*} functions are restricted to the GENO fields supported by
\sQuote{bcftools} (see documentation at the url below). The argument
\code{param} allows portions of the file to be input, but requires
that the file be BCF or bgzip'd and indexed as a
\code{\linkS4class{TabixFile}}. For similar functions operating on VCF
files see ?\code{scanVcf} in the \code{VariantAnnotation} package.
}
\value{
\code{scanBcfHeader} returns a list, with one element for each file
named in \code{file}. Each element of the list is itself a list containing
three elements. The \code{reference} element is a character() vector with
names of reference sequences. The \code{sample} element is a character()
vector of names of samples. The \code{header} element is a character()
vector of the header lines (preceeded by \dQuote{##}) present in the VCF
file.
\code{scanBcf} returns a list, with one element per file. Each list has 9
elements, corresponding to the columns of the VCF specification: \code{CHROM},
\code{POS}, \code{ID}, \code{REF}, \code{ALT}\code{QUAL}, \code{FILTER},
\code{INFO}, \code{FORMAT}, \code{GENO}.
The \code{GENO} element is itself a list, with elements corresponding
to fields supported by \sQuote{bcftools} (see documentation at the url below).
\code{asBcf} creates a binary BCF file from a text VCF file.
\code{indexBcf} creates an index into the BCF file.
}
\references{
\url{http://vcftools.sourceforge.net/specs.html} outlines the VCF
specification.
\url{http://samtools.sourceforge.net/mpileup.shtml} contains
information on the portion of the specification implemented by
\code{bcftools}.
\url{http://samtools.sourceforge.net/} provides information on
\code{samtools}.
}
\seealso{
\code{\link{BcfFile}}, \code{\link{TabixFile}}
}
\author{
Martin Morgan <mtmorgan@fhcrc.org>.
}
\examples{
fl <- system.file("extdata", "ex1.bcf", package="Rsamtools",
mustWork=TRUE)
scanBcfHeader(fl)
bcf <- scanBcf(fl)
## value: list-of-lists
str(bcf[1:8])
names(bcf[["GENO"]])
str(head(bcf[["GENO"]][["PL"]]))
example(BcfFile)
}
\keyword{ manip }
|