Skip to content

Commit

Permalink
Prevent files cluttering package check folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lvclark committed May 28, 2021
1 parent 04316df commit 2b13696
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 31 deletions.
5 changes: 3 additions & 2 deletions R/dataimport.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ read.SPAGeDi<-function(infile, allelesep="/", returnspatcoord=FALSE){
}

# read the rest of the file as a table
cat(Lines[3:(3+numind)], sep="\n", file="SpagTemp.txt")
gentable <- read.table("SpagTemp.txt", sep="\t", header=TRUE,
tmp <- tempfile()
cat(Lines[3:(3+numind)], sep="\n", file=tmp)
gentable <- read.table(tmp, sep="\t", header=TRUE,
row.names=1,
colClasses=c("character",rep(NA,catpres+numsc),
rep("character",numloc)))
Expand Down
6 changes: 4 additions & 2 deletions man/read.ATetra.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Lindsay V. Clark
\examples{
# create a file to be read
# (this would normally be done in a text editor or with ATetra's Excel template)
myfile <- tempfile()

cat("TIT,Sample Rubus Data for ATetra", "LOC,1,CBA15",
"POP,1,1,Commonwealth", "IND,1,1,1,CMW1,197,208,211,213",
"IND,1,1,2,CMW2,197,207,211,212", "IND,1,1,3,CMW3,197,208,212,219",
Expand All @@ -62,10 +64,10 @@ cat("TIT,Sample Rubus Data for ATetra", "LOC,1,CBA15",
"IND,2,2,6,FCR4,98,125,,","IND,2,2,7,FCR7,98,106,126,",
"IND,2,2,8,FCR14,98,127,,","IND,2,2,9,FCR15,98,108,117,",
"IND,2,2,10,FCR16,98,125,,","IND,2,2,11,FCR17,98,126,,","END",
file = "atetraexample.txt", sep = "\n")
file = myfile, sep = "\n")

# Read the file and examine the data
exampledata <- read.ATetra("atetraexample.txt")
exampledata <- read.ATetra(myfile)
summary(exampledata)
PopNames(exampledata)
viewGenotypes(exampledata)
Expand Down
5 changes: 3 additions & 2 deletions man/read.GeneMapper.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ gentable <- data.frame(Sample.Name=rep(c("ind1","ind2","ind3"),2),
)
# create a file (inspect this file in a text editor or spreadsheet
# software to see the required format)
write.table(gentable, file="readGMtest.txt", quote=FALSE, sep="\t",
myfile <- tempfile()
write.table(gentable, file=myfile, quote=FALSE, sep="\t",
na="", row.names=FALSE, col.names=TRUE)
# read the file
mygenotypes <- read.GeneMapper("readGMtest.txt")
mygenotypes <- read.GeneMapper(myfile)
# inspect the results
viewGenotypes(mygenotypes)
Expand Down
5 changes: 3 additions & 2 deletions man/read.GenoDive.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ Lindsay V. Clark
}
\examples{
# create data file (normally done in a text editor or spreadsheet software)
myfile <- tempfile()
cat(c("example comment line", "5\t2\t2\t3\t2", "pop1", "pop2",
"pop\tind\tloc1\tloc2", "1\tJohn\t102\t1214",
"1\tPaul\t202\t0", "2\tGeorge\t101\t121213",
"2\tRingo\t10304\t131414","1\tYoko\t10303\t120014"),
file = "genodiveExample.txt", sep = "\n")
file = myfile, sep = "\n")

# import file data
exampledata <- read.GenoDive("genodiveExample.txt")
exampledata <- read.GenoDive(myfile)

# view data
summary(exampledata)
Expand Down
7 changes: 4 additions & 3 deletions man/read.POPDIST.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Lindsay V. Clark
}
\examples{
# Create a file to read (this is typically done in a text editor)
myfile <- tempfile()
cat("An example for the read.POPDIST documentation.",
"abcR",
"abcQ",
Expand All @@ -86,13 +87,13 @@ cat("An example for the read.POPDIST documentation.",
"Great Works\t, 050807 030800",
"Great Works\t, 0000 0408",
"Great Works\t, 0707 0305",
file="testPOPDIST.txt", sep="\n")
file=myfile, sep="\n")

# View the file in the R console (or open it in a text editor)
cat(readLines("testPOPDIST.txt"), sep="\n")
cat(readLines(myfile), sep="\n")

# Read the file into a "genambig" object
fishes <- read.POPDIST("testPOPDIST.txt")
fishes <- read.POPDIST(myfile)

# View the data in the object
summary(fishes)
Expand Down
7 changes: 4 additions & 3 deletions man/read.SPAGeDi.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Lindsay V. Clark
\examples{
# create a file to read (usually done with spreadsheet software or a
# text editor):
myfile <- tempfile()
cat("// here's a comment line at the beginning of the file",
"5\t0\t-2\t2\t2\t4",
"4\t5\t10\t50\t100",
Expand All @@ -112,13 +113,13 @@ cat("// here's a comment line at the beginning of the file",
"ind4\t38.2\t-120.3\t00000000\t41430000",
"ind5\t38.2\t-120.3\t00053137\t00414200",
"END",
sep="\n", file="SpagInputExample.txt")
sep="\n", file=myfile)

# display the file
cat(readLines("SpagInputExample.txt"), sep="\n")
cat(readLines(myfile), sep="\n")

# read the file
mydata <- read.SPAGeDi("SpagInputExample.txt", allelesep = "",
mydata <- read.SPAGeDi(myfile, allelesep = "",
returnspatcoord = TRUE)

# view the data
Expand Down
9 changes: 5 additions & 4 deletions man/read.STRand.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,20 @@ strtemp <- data.frame(Pop=c("P1","P1","P2","P2"),
Ind=c("a","b","a","b"),
LocD=c("0","172/174","170/172/178*","172/176"),
LocG=c("130/136/138/142*","132/136","138","132/140/144*"))
write.table(strtemp, file="strtemp.txt", sep="\t",
myfile <- tempfile()
write.table(strtemp, file=myfile, sep="\t",
row.names=FALSE, quote=FALSE)

# read the file
mydata <- read.STRand("strtemp.txt")
mydata <- read.STRand(myfile)
viewGenotypes(mydata)
PopNames(mydata)

# alternative example with popInSam=FALSE
strtemp$Ind <- c("OH1","OH5","MT4","MT7")
write.table(strtemp, file="strtemp.txt", sep="\t",
write.table(strtemp, file=myfile, sep="\t",
row.names=FALSE, quote=FALSE)
mydata <- read.STRand("strtemp.txt", popInSam=FALSE)
mydata <- read.STRand(myfile, popInSam=FALSE)
Samples(mydata)
PopNames(mydata)
}
Expand Down
7 changes: 4 additions & 3 deletions man/read.Structure.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Lindsay V. Clark
\examples{
# create a file to read (normally done in a text editor or spreadsheet
# software)
myfile <- tempfile()
cat("\t\tRhCBA15\tRhCBA23\tRhCBA28\tRhCBA14\tRUB126\tRUB262\tRhCBA6\tRUB26",
"\t\t-9\t-9\t-9\t-9\t-9\t-9\t-9\t-9",
"WIN1B\t1\t197\t98\t152\t170\t136\t208\t151\t99",
Expand Down Expand Up @@ -168,13 +169,13 @@ cat("\t\tRhCBA15\tRhCBA23\tRhCBA28\tRhCBA14\tRUB126\tRUB262\tRhCBA6\tRUB26",
"MCD3\t2\t-9\t-9\t-9\t-9\t-9\t-9\t-9\t-9",
"MCD3\t2\t-9\t-9\t-9\t-9\t-9\t-9\t-9\t-9",
"MCD3\t2\t-9\t-9\t-9\t-9\t-9\t-9\t-9\t-9",
sep="\n",file="structtest.txt")
sep="\n",file=myfile)

# view the file
cat(readLines("structtest.txt"), sep="\n")
cat(readLines(myfile), sep="\n")

# read the structure file into genotypes and populations
testdata <- read.Structure("structtest.txt", ploidy=8)
testdata <- read.Structure(myfile, ploidy=8)

# examine the results
testdata
Expand Down
12 changes: 3 additions & 9 deletions man/read.Tetrasat.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,8 @@ Lindsay V. Clark
\code{\link{read.STRand}}
}
\examples{
\dontrun{
# example from the Tetrasat website
mydata <- read.Tetrasat("http://markwith.freehomepage.com/sample.txt")
summary(mydata)
viewGenotypes(mydata, loci="A1_Gtype")
}

# example with defined data:
myfile <- tempfile()
cat("Sample Data", "A1_Gtype", "A10_Gtype", "B1_Gtype", "D7_Gtype",
"D9_Gtype", "D12_Gtype", "Pop",
"BCRHE 1 0406 04040404 0208 02020202 03030303 0710",
Expand All @@ -95,8 +89,8 @@ cat("Sample Data", "A1_Gtype", "A10_Gtype", "B1_Gtype", "D7_Gtype",
"BR 7 0304 04040404 0809 02020202 03030303 070910",
"BR 8 030406 04040404 07070707 02020202 03030303 070910",
"BR 9 0406 04040404 07070707 02020202 03030303 07070707",
sep="\n", file="TetrasatExample.txt")
mydata2 <- read.Tetrasat("TetrasatExample.txt")
sep="\n", file=myfile)
mydata2 <- read.Tetrasat(myfile)

summary(mydata2)
viewGenotypes(mydata2, loci="B1_Gtype")
Expand Down
5 changes: 5 additions & 0 deletions man/write.ATetra.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ PopNames(mygendata) <- c("this pop", "that pop")
Ploidies(mygendata) <- 4
Description(mygendata) <- "Example for write.ATetra."

\dontrun{
# write an ATetra file
write.ATetra(mygendata, file="atetratest.txt")

# view the file
cat(readLines("atetratest.txt"),sep="\n")
}
\dontshow{
write.ATetra(mygendata, file=tempfile())
}

}
\keyword{ file }
5 changes: 5 additions & 0 deletions man/write.GeneMapper.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ Genotypes(mygendata, loci="loc2") <- list(c(78,81,84),
c(87), c(-9))
Ploidies(mygendata) <- 6
\dontrun{
# write a GeneMapper file
write.GeneMapper(mygendata, "exampleGMoutput.txt")
# view the file with read.table
read.table("exampleGMoutput.txt", sep="\t", header=TRUE)
}
\dontshow{
write.GeneMapper(mygendata, tempfile())
}
}
\keyword{ file }
6 changes: 6 additions & 0 deletions man/write.GenoDive.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,14 @@ PopInfo(mygendata) <- c(2,1,2,1,1,2,2,2,1)
Ploidies(mygendata) <- c(2,2,2,2,2,2,2,3,2)
Description(mygendata) <- "Serenity crew"

\dontrun{
# write files (use file="" to write to the console instead)
write.GenoDive(mygendata, digits=2, file="testGenoDive2.txt")
write.GenoDive(mygendata, digits=3, file="testGenoDive3.txt")
}
\dontshow{
write.GenoDive(mygendata, digits=2, file=tempfile())
write.GenoDive(mygendata, digits=3, file=tempfile())
}
}
\keyword{file}
5 changes: 5 additions & 0 deletions man/write.POPDIST.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ Genotypes(mygen, loci="loc1") <- list(c(128, 134), c(130),
Genotypes(mygen, loci="loc27") <- list(c(209,211), c(207,217),
c(207,209,215,221), c(211,223))

\dontrun{
# write the file
write.POPDIST(mygen, file="forPOPDIST.txt")

# view the file
cat(readLines("forPOPDIST.txt"), sep="\n")
}
\dontshow{
write.POPDIST(mygen, file=tempfile())
}

}
\keyword{ file }
6 changes: 6 additions & 0 deletions man/write.SPAGeDi.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ PopInfo(mygendata) <- c(1,1,2,2)
myspatcoord <- data.frame(X=c(27,29,24,30), Y=c(44,41,45,46),
row.names=c("ind1","ind2","ind3","ind4"))

\dontrun{
# write a file
write.SPAGeDi(mygendata, spatcoord = myspatcoord,
file="SpagOutExample.txt")
}
\dontshow{
write.SPAGeDi(mygendata, spatcoord = myspatcoord,
file=tempfile())
}
}
\keyword{ file }

5 changes: 5 additions & 0 deletions man/write.Tetrasat.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ PopInfo(mygendata) <- c(1,2,1,2)
Description(mygendata) <- "An example for write.Tetrasat."
Ploidies(mygendata) <- 4

\dontrun{
# write a Tetrasat file
write.Tetrasat(mygendata, file="tetrasattest.txt")

# view the file
cat(readLines("tetrasattest.txt"),sep="\n")
}
\dontshow{
write.Tetrasat(mygendata, file=tempfile())
}
}
\keyword{file}
2 changes: 1 addition & 1 deletion man/write.freq.SPAGeDi.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ myfreq2 <- data.frame(row.names=c("G","R"), Genomes=c(120,200),
abc.134=c(0.53, 0.3))
myusatnts <- as.integer(2)
names(myusatnts) <- "abc"
write.freq.SPAGeDi(myfreq2, usatnts=myusatnts, file="SPAGfreqExample2.txt")
write.freq.SPAGeDi(myfreq2, usatnts=myusatnts, file=tempfile())
}

}
Expand Down

0 comments on commit 2b13696

Please sign in to comment.