structure绘图(Rscript)

pophelper(R 包)

#!/usr/bin/env Rscript
# parse parameter ---------------------------------------------------------
library(argparser, quietly=TRUE)
# Create a parser
p <- arg_parser("draw sturcture figure for admixture result")

# Add command line arguments
p <- add_argument(p, "dir", help="input: Q matirx dir", type="character")
p <- add_argument(p, "sample", help="input: samplefile, ie  .nosex", type="character")
p <- add_argument(p, "sample_order", help="input: sample order file, define order in output figure ", type="character")
p <- add_argument(p, "output", help="output prefix", type="character")

# Parse the command line arguments
argv <- parse_args(p)

dir <- argv$dir
samp <- argv$sample
ord  <- argv$sample_order
outpre <- argv$output


#dir <- "result/"
#samp <- "./all.fam"
#ord  <- "./all.fam"
#outpre <- "test"


library(pophelper)
library(ggplot2)

Qfiles <- list.files( dir, pattern = "Q", full.names = T )
qlist <- readQ(Qfiles,  indlabfromfile=F)
sorted排序

ordered排序

你可能感兴趣的:(structure绘图(Rscript))