adimitromanolakis / sim1000G

Simulation of rare and common variants based on 1000 genomes data
17 stars 1 forks source link

writePed generate fam file #14

Open williambrandler opened 2 years ago

williambrandler commented 2 years ago

I would like to write simulated individuals (not families) out to ped, how do I generate the fam file?

I tried this

vcf = readVCF( vcf_file, maxNumberOfVariants = 600 , min_maf = 0.01, max_maf = 1)

startSimulation(vcf, totalNumberOfIndividuals = 1000)
ids = generateUnrelatedIndividuals(1000)

fam <- as.data.frame(ids, col.names = c("id"))
fam[["fid"]] <- fam[["ids"]]
fam[["id"]] <- fam[["ids"]]
fam[["father"]] <- 0
fam[["mother"]] <- 0
fam$sex <- sample(0:1, size = nrow(fam), replace = TRUE)
fam[["gtindex"]] <- fam[["ids"]]
fam = subset(fam, select = -c(1))

but when I write to ped I get: writePED(genotype, fam, filename = "/path/to/ped/out")

Error : $ operator is invalid for atomic vectors Some( Error: $ operator is invalid for atomic vectors )

Please point me in the right direction to write out simulated genotypes for individuals!