[adegenet-forum] trouble with NAs
Doyle, Jacqueline R M
jmdoyle at purdue.edu
Mon Nov 16 22:24:57 CET 2015
Hi!
I am trying to use R to reformat the output from Fluidigm genotyping software into a data frame that can then be used by df2genind. I've attached my starting file, which has 95 individuals + 1 negative control genotyped at 96 loci (biallelic SNPs). I've processed the file as follows:
data <- read.csv("run4_set1.csv", header =T, skip=15)
keeps <- c("Assay","Name","Converted")
data2 <- data[keeps]
data2$Converted <- gsub('No Call','NA',data2$Converted)
data2 <- data2[- grep("NTC",data2$Converted),]
data2$Converted <- gsub('A','1',data2$Converted)
data2$Converted <- gsub('C','2',data2$Converted)
data2$Converted <- gsub('G','3',data2$Converted)
data2$Converted <- gsub('T','4',data2$Converted)
data2$Converted <- gsub('N1','NA:NA',data2$Converted)
library(reshape)
data3 <- cast(data2,Name~Assay)
obj <- df2genind(data3,ploidy=2,sep=":")
When I then call "obj" in R I get:
/// GENIND OBJECT /////////
// 95 individuals; 96 loci; 255 alleles; size: 162.5 Kb
// Basic content
@tab: 95 x 255 matrix of allele counts
@loc.n.all: number of alleles per locus (range: 1-3)
@loc.fac: locus factor for the 255 columns of @tab
@all.names: list of allele names for each locus
@ploidy: ploidy of each individual (range: 2-2)
@type: codom
@call: df2genind(X = data3, sep = ":", ploidy = 2)
// Optional content
- empty -
It looks to me like my "NA" is being read as a third allele (as my loc.n.all range should be 1-2, not 1-3, correct?). I've also tried:
obj <- df2genind(data3,ploidy=2,missing=NA,sep=":")
But I end up with the same results + the following error:
Error in df2genind(data3, ploidy = 2, missing = NA, sep = ":") :
unused argument (missing = NA)
Could anyone give me some feedback regarding whether or not my NA is actually being recognized as missing data? If not, any suggestions as to how to fix the problem?
Many thanks,
Jackie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20151116/facaf227/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run4_set1.csv
Type: application/octet-stream
Size: 885353 bytes
Desc: run4_set1.csv
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20151116/facaf227/attachment-0001.obj>
More information about the adegenet-forum
mailing list