dwinter / mmod

Differentiation statistics in R
Other
11 stars 5 forks source link

genind error #11

Closed elewitus closed 4 years ago

elewitus commented 4 years ago

Hi,

I understand that multidna2genind is not part of mmod, but apex is no longer being maintained...so I thought perhaps you could advise me (as mmod relies on this function).

I am reading in fasta files from different genes from the same msa, but cannot for some reason build a genind object with them (see below). These are nucleotide alignments and their names have no "." in them.

Similary, if I try to build a genind object from a DNAbin object, I run into trouble (see below below).

Sorry to bother you with this, but any help would be appreciated.

read alignments

files<-list.files(path='.',pattern='.fasta') als<-read.multiFASTA(files)

remove . from names

(setLocusNames(als) <- gsub(".fasta", "", getLocusNames(als)))

build genind object

als.gid<-multidna2genind(als,mlst=T,gapIsNA=T) Error in .local(.Object, ...) : more than one '.' in column names; please name column as [LOCUS].[ALLELE] In addition: Warning messages: 1: In df2genind(xdfnum, ploidy = 1, ind.names = x@labels) : character '.' detected in names of loci; replacing with '_' 2: In df2genind(xdfnum, ploidy = 1, ind.names = x@labels) : entirely non-type individual(s) deleted

convert DNAbin to genind

al1<-read.FASTA(files[1]) al1

3535 DNA sequences in binary format stored in a list.

All sequences of same length: 225

Labels: X534418 X534419 X049951 X123292 X123293 X226610 ...

Base composition: a c g t 0.209 0.200 0.187 0.404 (Total: 795.38 kb)

wm<-as.genind.DNAbin(al1,rep(c('A','B','C','D','E'),each=707)) Error in 1:dim(x)[1] : argument of length 0