[adegenet-forum] trouble with NAs

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Nov 17 13:28:21 CET 2015


Hi there,

you should be using NA.char="NA", but it does not work in this example. Issue posted there:
https://github.com/thibautjombart/adegenet/issues/108

I'll look into it soon. BTW posting issues on github is the best way to discuss suspected bugs - much easier for the users and developers to keep track of things and solve issues.

Cheers
Thibaut


==============================
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart


________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Doyle, Jacqueline R M [jmdoyle at purdue.edu]
Sent: 16 November 2015 21:24
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] trouble with NAs

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/20151117/88617a5c/attachment.html>


More information about the adegenet-forum mailing list