# #——设置 -------------------------------------------------------------------- 库(MungeSumstats ) ## ---- eval = FALSE,消息= TRUE ------------------------------------------------ # eduAttainOkbayPth < -执行(“extdata”、“eduAttainOkbay.txt”,#包=“MungeSumstats”)#重新格式化< - # MungeSumstats:: format_sumstats (= eduAttainOkbayPth道路,# ref_genome="GRCh37") ## ----echo=FALSE--------------------------------------------------------------- #不运行时间集中检查eduAttainOkbayPth <- system.file("extdata","eduAttainOkbay.txt", package="MungeSumstats") re格式化<- MungeSumstats::format_sumstats(path=eduAttainOkbayPth, on_ref_genome =FALSE, strand_ambig_filter =FALSE, bi_allelic_filter =FALSE, allele_flip_check =FALSE,ref_genome = " GRCh37 ") ## ---- 消息= TRUE ------------------------------------------------------------ # 从内外加厚ALS GWAS开放GWAS项目保存到一个临时目录ALSvcfPth < -执行(“extdata”、“ALSvcf。vcf”,包= " MungeSumstats ") ## ---- eval = FALSE --------------------------------------------------------------- # reformatted_vcf < - # MungeSumstats:: format_sumstats(路径= ALSvcfPth # ref_genome = " GRCh37 ") ## ---- eval = FALSE,消息= FALSE ----------------------------------------------- # # 组# reformatted_vcf_2 < - # MungeSumstats:: format_sumstats(路径= ALSvcfPth # ref_genome =“GRCh37”,# log_folder_ind = TRUE, # imputation_ind = TRUE,## ----echo=FALSE,message=FALSE------------------------------------------------- #不运行时间集中检查reformatted_vcf_2 <- MungeSumstats::format_sumstats(path=ALSvcfPth, ref_genome="GRCh37", log_folder_ind=TRUE, imputation_ind=TRUE, log_mungesumstats_msgs=TRUE, on_ref_genome =FALSE, strand_ambig_filter =FALSE, bi_allelic_filter =FALSE,allele_flip_check = FALSE ) ## ---- 消息= TRUE ------------------------------------------------------------ 名称(reformatted_vcf_2 ) ## ---- 消息= TRUE ------------------------------------------------------------ print (reformatted_vcf_2 log_files info_filter美元 ) ## ---- 消息= FALSE, eval = FALSE ------------------------------------------------ # # 组# reformatted_vcf_2 < - # MungeSumstats:: format_sumstats(路径= ALSvcfPth # ref_genome =“GRCh37”,# log_folder_ind = TRUE, # imputation_ind = TRUE,# log_mungesumstats_msgs = TRUE, # return_format = "农庄 ") ## ---- 消息= FALSE, eval = FALSE ------------------------------------------------ # # 组# reformatted_vcf_2 < - # MungeSumstats:: format_sumstats(路径= ALSvcfPth # ref_genome =“GRCh37”,# write_vcf = TRUE, # save_format = " openGWAS ") ## ---- 消息= FALSE, eval = FALSE ------------------------------------------------ # # 通过路径受教育程度Okbay sumstat文件到一个临时目录# eduAttainOkbayPth < -系统。文件(“extdata”、“eduAttainOkbay.txt”,#包=“MungeSumstats”)# sumstats_list < -列表(魔法石,第1章= eduAttainOkbayPth ss2 = eduAttainOkbayPth) # # ref_genomes < - MungeSumstats:: get_genome_builds (sumstats_list = sumstats_list ) # ## ----------------------------------------------------------------------------- sumstats_dt < - MungeSumstats: formatted_example () sumstats_dt_hg38 < - MungeSumstats:: liftover (sumstats_dt = sumstats_dt ref_genome =“hg19”,convert_ref_genome = " hg38”)knitr: kable(头(sumstats_dt_hg38 )) ## ----------------------------------------------------------------------------- eduAttainOkbayPth < -系统。file("extdata", "eduAttainOkbay_standardised.tsv.gz", package = "MungeSumstats") formatted_path <- tempfile(fileext = "eduAttainOkbay_standardised.tsv.gz") ####读入数据并标准化头名称#### dat <- MungeSumstats::read_sumstats(path = eduAttainOkbayPth, standardise_headers = TRUE) knitr::kable(head(dat)) #### 2。写入磁盘压缩,一样,tabix-indexed文件# # # # formatted_path < - MungeSumstats:: write_sumstats (sumstats_dt = dat save_path = formatted_path tabix_index = TRUE, write_vcf = FALSE, return_path = TRUE ) ## ----------------------------------------------------------------------------- #### 搞砸一些列名称# # # # dat_raw < - data.table::复制(dat)数据。table::setnames(dat_raw, c("SNP","CHR"), c("rsID","Seqnames")) #### Add a non-standard column that I want to keep the casing for #### dat_raw$Support <- runif(nrow(dat_raw)) dat2 <- MungeSumstats::standardise_header(sumstats_dt = dat_raw, uppercase_unmapped = FALSE, return_list = FALSE ) knitr::kable(head(dat2)) ## ---- message=TRUE, echo=FALSE------------------------------------------------ utils::sessionInfo()