Skip to content

Genotypes Input file error: "Marker matrix should be numeric (0, 1, 2)." #112

@LivGilpin

Description

@LivGilpin

I get error messages that my input file is not numeric?
I have 346 accessions and 13 105 SNPs in my dataframe.
This is the script I used:

install.packages("corehunter")
library(corehunter)

#Load genotype file
Markers<-read.csv(file="GenotypesCoreHunter.csv",
                  header=TRUE,row.names=1,sep=";",
                  stringsAsFactors=FALSE,check.names=FALSE)

# bi-allelic data (e.g. SNP)
head(Markers,c(5,3))
        AFL2     CONS61   EV_Eve1_R422
35-1     1      1                2
35-10   1      1                2
35-13   0      1                2
35-16   1      1                1
35-22   1      0                2

I ran some test to check that the data frame was loaded into R as numeric:

sapply(Markers[,6000:7000],is.numeric) 
>[1] TRUE TRUE TRUE TRUE TRUE ...

geno.data <- genotypes(Markers, format = "biparental" )
>Error in genotypes(Markers, format = "biparental") : 
>Marker matrix should be numeric (0, 1, 2).

#Since I still had problems with numeric, I tried to convert to matrix:

`MarkersMatrix <-as.matrix(Markers)`

When running genotypes function again, I still got the error message:
geno.data <- genotypes(MarkersMatrix, format = "biparental" )
#>Error in genotypes(Markers, format = "biparental") : 
#>Marker matrix should be numeric (0, 1, 2).

I tried the as.numeric function, but same error came up...

as.numeric(MarkersMatrix)
geno.data <- genotypes(MarkersMatrix, format = "biparental" )
>Error in genotypes(Markers, format = "biparental") : 
>Marker matrix should be numeric (0, 1, 2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions