\name{readSeq}
\alias{readSeq}
\alias{readFasta}
\alias{readGbk}
\alias{readEmbl}
\alias{strReadFasta}
\alias{strReadGbk}
\alias{strReadEmbl}

\title{Sequence extraction from a bank}
\description{
  These functions load a sequence from a Fasta, Embl or GeneBank
  sequence bank file into a GeneR sequence buffer or as a character string..

  readSeq is the generic function, readFasta, readGbk and
  readEmbl are aliases.
}
\usage{
readSeq(file,name=NA, type="F", seqno=0, 
        from=1, to=0,upper=TRUE, index="ix")
readFasta(file,name=NA, seqno=0,
        from=1, to=0,upper = TRUE, index="ix")
strReadFasta (file, name = NA, from = 1,
                         to = 0,upper = TRUE) 
readGbk(file,name=NA, seqno=0, from=1, to=0,upper = TRUE,index="ix")
strReadGbk (file, name = NA, from = 1,
                         to = 0,upper = TRUE) 
readEmbl(file,name=NA, seqno=0, from=1, to=0,upper = TRUE,index="ix")
strReadEmbl (file, name = NA, from = 1,
                         to = 0,upper = TRUE, index = "ix") 
}
\arguments{
  \item{file}{String/scalar, File name of the bank}
  \item{name}{String/scalar, Sequence name (default : first sequence)}
  \item{upper}{upper case letters conversion (TRUE: The whole sequence is converted to upper case letters,
   FALSE : no conversion (only implemented for Fasta sequence)).
 }
 \item{type}{String/scalar, Bank format ("F" -> fasta. "E" -> embl, "G" -> GenBank)}
 \item{seqno}{Integer/scalar, Sequence number (buffer number) }
 \item{from, to}{Integer/scalar, Absolute addresses of the begin and the end of the fragment,
 (1 means the first nucleotide and 0 conventionally the last one; 
 from must not be larger than to)}
 \item{index}{String/scalar, type of index ( "ix" -> sequence name is the accession number \cr
    "id" -> sequence name is the identifier) }
}
\value{
  integer: 1 if OK; -1 if error.
  strReadFasta, strReadGbk and strReadEmbl returns the sequence as character string.
}
\author{L.Cottret, A. Lucas.}

\seealso{
  \code{\link{GeneR}},
  \code{\link{globals}},
  \code{\link{readEmblLocation}},
  \code{\link{readGbkLocation}},
  \code{\link{getSeq}}, 
  \code{\link{sizeSeqEmbl}},
  \code{\link{sizeSeqFasta}}
}

\examples{
## Get a sequence from Ncbi
seqNcbi("BY608190",file="BY608190.gbk",type="G")

## Read Gbk file to buffer 0
readGbk("BY608190.gbk")

## Or to a character string
strReadGbk("BY608190.gbk")

## Write to Fasta file
writeFasta(file='toto.fa')

## Make an index to this file
indexFasta('toto.fa')
readFasta (file="toto.fa",seqno=0,from=1,to=159)

## Show seqence on buffer 0
getSeq()

## Make a Fake file
writeEmblLine(file='toto.embl',code='AC',header='tmp',append=FALSE)
writeEmblSeq(file='toto.embl')

## Make index on file toto.embl
indexEmbl('toto.embl')

## Read Embl file to buffer 0
readEmbl('toto.embl')

## Or read "directly"
strReadEmbl('toto.embl')

}
\keyword{utilities}