comparison coral_multilocus_genotype.R @ 6:0488ca4a8c4e draft

Uploaded
author greg
date Wed, 11 Nov 2020 18:09:01 +0000
parents 34e02e8b4232
children bcb28b49b0cc
comparison
equal deleted inserted replaced
5:457cbc5ca604 6:0488ca4a8c4e
416 i <- ifelse(is.na(stag_db_report[3]), "", stag_db_report[[3]]); 416 i <- ifelse(is.na(stag_db_report[3]), "", stag_db_report[[3]]);
417 i <- i[!apply(i== "", 1, all), ]; 417 i <- i[!apply(i== "", 1, all), ];
418 418
419 # Subset VCF to the user samples. 419 # Subset VCF to the user samples.
420 start_time <- time_start("Subsetting vcf to the user samples"); 420 start_time <- time_start("Subsetting vcf to the user samples");
421 l <- length(i) + 1; 421 affy_list <- append(stag_db_report$affy_id,"FORMAT");
422 svcf <- vcf[, 1:l]; 422 svcf <- vcf[,colnames(vcf@gt) %in% affy_list];
423 write.vcf(svcf, "subset.vcf.gz"); 423 write.vcf(svcf, "subset.vcf.gz");
424 vcf.fn <- "subset.vcf.gz"; 424 vcf.fn <- "subset.vcf.gz";
425 snpgdsVCF2GDS(vcf.fn, "test3.gds", method="biallelic.only"); 425 snpgdsVCF2GDS(vcf.fn, "test3.gds", method="biallelic.only");
426 genofile <- snpgdsOpen(filename="test3.gds", readonly=FALSE); 426 genofile <- snpgdsOpen(filename="test3.gds", readonly=FALSE);
427 gds_array <- read.gdsn(index.gdsn(genofile, "sample.id")); 427 gds_array <- read.gdsn(index.gdsn(genofile, "sample.id"));