[Seqinr-commits] r2113 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 18 14:29:27 CEST 2021
Author: simonpenel
Date: 2021-05-18 14:29:27 +0200 (Tue, 18 May 2021)
New Revision: 2113
Modified:
pkg/R/gbk2g2.R
Log:
replace ftp by https in gbk2g2.R
Modified: pkg/R/gbk2g2.R
===================================================================
--- pkg/R/gbk2g2.R 2021-03-17 08:49:16 UTC (rev 2112)
+++ pkg/R/gbk2g2.R 2021-05-18 12:29:27 UTC (rev 2113)
@@ -8,17 +8,17 @@
#########################################################################
gbk2g2 <- function(
- gbkfile = "ftp://pbil.univ-lyon1.fr/pub/seqinr/data/ct.gbk",
+ gbkfile = "https://pbil.univ-lyon1.fr/datasets/seqinr/data/ct.gbk",
g2.coord = "g2.coord")
{
input <- readLines(gbkfile)
-
+
outfile = file( description = g2.coord, open ="w")
#
# Keep lines with CDS flag:
#
input <- input[ substring(input,1,8) == " CDS"]
-
+
#
# Extract boudaries strings
#
@@ -30,7 +30,7 @@
}
input <- sapply(input, get.boundaries)
names(input) <- NULL
-
+
#
# Look for 5' partial genes:
#
@@ -37,7 +37,7 @@
idx5p <- grep(">", input)
if( length( idx5p != 0 ) )
warning("5' partial genes encountered (no output):", idx5p)
-
+
#
# Look for 3' partial genes:
#
@@ -44,19 +44,19 @@
idx3p <- grep("<", input)
if( length( idx3p != 0 ) )
warning("3' partial genes encountered (no output):", idx3p)
-
+
#
# Look for join in features:
#
idxjoin <- grep("join", input)
if( length( idxjoin != 0 ) )
- warning("join encountered (no output):", idxjoin)
-
+ warning("join encountered (no output):", idxjoin)
+
#
# Define partials and join:
#
censored <- c(idx5p, idx3p, idxjoin)
-
+
#
# Extract boundaries:
#
@@ -64,23 +64,22 @@
{
if( i %in% censored )
next
-
+
tmp <- unlist( strsplit(input[i], split="\\.\\.") )
if( length( grep("complement", input[i]) ) == 1 )
{
end <- as.integer( substring(tmp[1], first = 12 ) ) + as.integer(3)
start <- as.integer( substring(tmp[2], first = 1, last = nchar(tmp[2]) - 1 ))
- line <- sprintf(fmt = "%d %d %d", as.integer(i), start, end)
+ line <- sprintf(fmt = "%d %d %d", as.integer(i), start, end)
}
else #direct strand
{
start <- as.integer(tmp[1])
end <- as.integer(tmp[2]) + as.integer(-3)
- line <- sprintf(fmt = "%d %d %d", as.integer(i), start, end)
+ line <- sprintf(fmt = "%d %d %d", as.integer(i), start, end)
}
writeLines( line, con = outfile )
}
close(outfile)
- invisible(input)
+ invisible(input)
}
-
More information about the Seqinr-commits
mailing list