\name{WriteEmblSeq}


\alias{writeEmblLine}
\alias{writeEmbl}
\alias{writeEmblComment}
\alias{writeEmblSeq}
\title{Write to Embl file}
\description{Write a sequence, with description into a EMBL
  file. writeEmblSeq write the sequence; writeEmblLine write a feature
  line, writeEmblComment write a comment line. CompleteStringWithSpace:
  internal function}

\usage{
writeEmblSeq (file, seqno = 0)
writeEmblLine (file, code = "", header = "", text = "",
                           nextfield = TRUE, append=TRUE)
writeEmblComment(file, code = "", text = "",
                           nextfield = TRUE, append=TRUE)

}

\arguments{
  \item{file}{EMBL File name}
  \item{code}{2 letters: to be written at line beginning}
  \item{header}{First part of line}
  \item{text}{a text to be written}
  \item{seqno}{Integer, sequence number (bufno)}
  \item{nextfield}{TRUE: write XX after line, FALSE: don't write XX.}
 \item{append}{Scalar boolean. TRUE -> line(s) is added at the end
   of the file. FALSE -> file is written over.}

}

\author{A. Lucas and Vincent Lefort}


\examples{

s<-"gtcatgcatgctaggtgacagttaaaatgcgtctaggtgacagtctaacaa"
placeString(s)

# Add lines with "CC   bla bla bla" and a line "XX"
writeEmblComment(file="toto.embl",code="CC",text="This is a comment for \
this dummy sequence... I try to be long enough to show that this comment \
will be written on several lines",append=FALSE)

# Add a line with "FT  CDS  bla bla bla"
writeEmblLine(file="toto.embl",code="FT",header="CDS",text="<1..12",
              nextfield = FALSE)
# Add lines with "FT       bla bla bla"
writeEmblLine(file="toto.embl",code="FT",header="",text="/codon_start=2",
              nextfield = FALSE)
writeEmblLine(file="toto.embl",code="FT",header="",text="/gene=\"toto\"",
              nextfield = FALSE)
writeEmblLine(file="toto.embl",code="FT",header="",text="/note=\"Here is \
what I think about this gene\"",nextfield = FALSE)

## Translation
prot <- translate(seqno=0,from=getOrfs()[1,1],to=getOrfs()[1,2])
writeEmblLine (file="toto.embl",code='FT',header='',
text=paste('/translation="',prot ,'\"',sep=''),nextfield =TRUE)

# Add sequence
writeEmblSeq(file="toto.embl")

## Show file
cat(paste(readLines("toto.embl"),collapse='\n'))

}


\keyword{utilities}