[Seqinr-commits] r1957 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 21 14:40:43 CEST 2016
Author: jeanlobry
Date: 2016-06-21 14:40:42 +0200 (Tue, 21 Jun 2016)
New Revision: 1957
Modified:
pkg/R/gb2fasta.R
pkg/man/gb2fasta.Rd
Log:
gb2fasta now uses a local file example
Modified: pkg/R/gb2fasta.R
===================================================================
--- pkg/R/gb2fasta.R 2016-06-21 12:26:42 UTC (rev 1956)
+++ pkg/R/gb2fasta.R 2016-06-21 12:40:42 UTC (rev 1957)
@@ -5,8 +5,7 @@
# single entry genbank to fasta conversion
#
########################################################################
-gb2fasta <- function(source.file = "ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Acinetobacter_ADP1_uid61597/NC_005966.gbk",
- destination.file = "Acinetobacter_ADP1_uid61597.fasta")
+gb2fasta <- function(source.file, destination.file)
{
input <- readLines(source.file)
head <- input[1]
@@ -21,10 +20,10 @@
#
# Look for sequence position:
#
- debut <- which(substring(input,1,6)=="ORIGIN") + 1
+ debut <- which(substring(input,1,6) == "ORIGIN") + 1
if( length( debut ) > 1 )
stop("Multiple entries not yet implemented !")
- fin <- which(substring(input,1,2)=="//") - 1
+ fin <- which(substring(input,1,2) == "//") - 1
if( length( fin ) > 1 )
stop("Multiple entries not yet implemented !")
Modified: pkg/man/gb2fasta.Rd
===================================================================
--- pkg/man/gb2fasta.Rd 2016-06-21 12:26:42 UTC (rev 1956)
+++ pkg/man/gb2fasta.Rd 2016-06-21 12:40:42 UTC (rev 1957)
@@ -1,13 +1,11 @@
\name{gb2fasta}
\alias{gb2fasta}
-\title{ conversion of GenBank file into fasta file }
+\title{Conversion of GenBank file into fasta file}
\description{
Converts a single entry in GenBank format into a fasta file.
}
\usage{
-gb2fasta(source.file =
-"ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Acinetobacter_ADP1_uid61597/NC_005966.gbk",
-destination.file = "Acinetobacter_ADP1_uid61597.fasta")
+gb2fasta(source.file, destination.file)
}
\arguments{
\item{source.file}{ GenBank file }
@@ -25,6 +23,18 @@
\author{J.R. Lobry}
\seealso{ \code{\link{oriloc}} }
\examples{
-\dontrun{gb2fasta()} # need internet connection
+ myGenBankFile <- system.file("sequences/ct.gbk.gz", package = "seqinr")
+ myFastaFileName <- "Acinetobacter_ADP1_uid61597.fasta"
+ gb2fasta(myGenBankFile, myFastaFileName)
+ readLines(myFastaFileName)[1:5]
+ #
+ # Should be :
+ #
+ # [1] ">CHLTCG 1042519 bp"
+ # [2] "gcggccgcccgggaaattgctaaaagatgggagcaaagagttagagatctacaagataaa"
+ # [3] "ggtgctgcacgaaaattattaaatgatcctttaggccgacgaacacctaattatcagagc"
+ # [4] "aaaaatccaggtgagtatactgtagggaattccatgttttacgatggtcctcaggtagcg"
+ # [5] "aatctccagaacgtcgacactggtttttggctggacatgagcaatctctcagacgttgta"
+ #
}
\keyword{utilities}
More information about the Seqinr-commits
mailing list