Mercurial > repos > greg > multilocus_genotype
comparison multilocus_genotype.R @ 2:86aaadf36a4f draft
Uploaded
| author | greg |
|---|---|
| date | Thu, 25 Oct 2018 11:10:17 -0400 |
| parents | 725b160c91f0 |
| children | 1bc815d9c8c5 |
comparison
equal
deleted
inserted
replaced
| 1:ba2df0561b12 | 2:86aaadf36a4f |
|---|---|
| 7 suppressPackageStartupMessages(library("ape")) | 7 suppressPackageStartupMessages(library("ape")) |
| 8 suppressPackageStartupMessages(library("ggplot2")) | 8 suppressPackageStartupMessages(library("ggplot2")) |
| 9 suppressPackageStartupMessages(library("knitr")) | 9 suppressPackageStartupMessages(library("knitr")) |
| 10 | 10 |
| 11 option_list <- list( | 11 option_list <- list( |
| 12 make_option(c("--input_vcf"), action="store", dest="input_vcf", help="VCF input file") | 12 make_option(c("--input_vcf"), action="store", dest="input_vcf", help="VCF input file"), |
| 13 make_option(c("--input_pop_info"), action="store", dest="input_pop_info", help="Population information input file") | 13 make_option(c("--input_pop_info"), action="store", dest="input_pop_info", help="Population information input file") |
| 14 ) | 14 ) |
| 15 | 15 |
| 16 parser <- OptionParser(usage="%prog [options] file", option_list=option_list); | 16 parser <- OptionParser(usage="%prog [options] file", option_list=option_list); |
| 17 args <- parse_args(parser, positional_arguments=TRUE); | 17 args <- parse_args(parser, positional_arguments=TRUE); |
| 26 provesti_distance <- function(distance, selection) { | 26 provesti_distance <- function(distance, selection) { |
| 27 eval(parse(text=paste("as.matrix(distance)[", selection, "]"))); | 27 eval(parse(text=paste("as.matrix(distance)[", selection, "]"))); |
| 28 } | 28 } |
| 29 | 29 |
| 30 #Read in VCF input file. | 30 #Read in VCF input file. |
| 31 vcf <- read.vcfR(opts$input_vcf); | 31 vcf <- read.vcfR(opt$input_vcf); |
| 32 | 32 |
| 33 # Convert VCF file into formats compatiable with the Poppr package. | 33 # Convert VCF file into formats compatiable with the Poppr package. |
| 34 gind <- vcfR2genind(vcf); | 34 gind <- vcfR2genind(vcf); |
| 35 # Add population information to the genind object. | 35 # Add population information to the genind object. |
| 36 poptab <- read.table(opt$input_pop_info, check.names=FALSE, header=T, na.strings = c("", "NA")); | 36 poptab <- read.table(opt$input_pop_info, check.names=FALSE, header=T, na.strings = c("", "NA")); |
