R package:blupADC- 功能1

knitr::opts_chunk$set(collapse = TRUE)

简介

🙀大家好,通过前一章节的学习,相信大家已经对blupADC 有了一个初步的了解了。从本节开始,我们将对blupADC中的几个重要的函数一一进行讲解。这一节主要给大家讲述的是如何使用blupADCgeno_format函数来进行多种基因型格式数据的转换。

示例

格式转换-提供R中的变量名称

library(blupADC)
format_result=geno_format(
         input_data_hmp=example_data_hmp,  #provided hapmap data object 
         output_data_type=c("Plink","BLUPF90","Numeric","VCF"),# output data format
         return_result = TRUE,      # return result 
         cpu_cores=1                # number of cpu 
         )

格式转换-提供本地文件的路径和名称

#convert phased VCF data to haplotype format and  haplotype-based numeric format
library(blupADC)
data_path=system.file("extdata", package = "blupADC")  #  path of example files 
phased_result=geno_format(
         input_data_path=data_path,      # input data path 
    	 input_data_name="example.vcf",  # input data name,for vcf data 
         input_data_type="VCF",          # input data type
    	 phased_genotype=TRUE,           # whether the vcf data has been phased
         haplotype_window_nSNP=5,        # according to nSNP define block,
    	 output_data_type=c("Haplotype","Numeric"),# output data format
         return_result=TRUE,             #save result as a R environment variable
         cpu_cores=1                     # number of cpu 
                  )

格式转换-通过bigmemory方法

library(blupADC)
data_path=system.file("extdata", package = "blupADC")  #  path of example files 
phased_result=geno_format(
         input_data_path=data_path,      # input data path 
    	 input_data_name="example.vcf",  # input data name,for vcf data 
         input_data_type="VCF",          # input data type
    	 phased_genotype=TRUE,           # whether the vcf data has been phased
         haplotype_window_nSNP=5,        # according to nSNP define block,
    	 bigmemory_cal=TRUE,             # format conversion via bigmemory object
    	 bigmemory_data_path=getwd(),    # path of bigmemory data 
    	 bigmemory_data_name="test_blupADC", #name of bigmemory data 
         output_data_type=c("Haplotype","Numeric"),# output data format
         return_result=TRUE,             #save result in R environment
         cpu_cores=1                     # number of cpu 
                  )

输出

输出结果主要分为6个部分(长度为6的列表),分别为:

  • hmp : Hapmap 格式的基因型数据

第1列为SNP,第3列为染色体,第4列为物理位置,第12列开始为基因型数据

rs#alleleschromposstrandassemblycenterprotLSIDassayLSIDpanelLSIDQCcode3098349832972452
SNP1NA1224488NANANANANANANACCACACCC
SNP2NA1293696NANANANANANANAGGTGTGGG
SNP3NA1333333NANANANANANANAGGTTTTGG
SNP4NA1464830NANANANANANANACCCCCCCC
SNP5NA1722623NANANANANANANAAAGGGGAA
SNP6NA1838596NANANANANANANACCTCTTCC
  • ped : Plink 格式的基因型数据

第1列为家系,第2列为个体号,第7列开始为基因型数据。

309830980000CCGG
349834980000ACTG
329732970000ACTG
245224520000CCGG
425542550000ACGG
294629460000CCTG
  • map: Plink格式的基因型数据

第1列为染色体,第2列为SNP,第3列为遗传距离(cM), 第4列为物理位置。

1SNP10.224488224488
1SNP20.293696293696
1SNP30.333333333333
1SNP40.464830464830
1SNP50.722623722623
1SNP60.838596838596
  • blupf90: BLUPF90 格式的基因型数据

第1列为个体号,第2列为基因型。

3098200000
3498112021
3297112022
2452200000
4255102011
2946212000
  • numeric: Numeric 格式的基因型数据

行名为个体,列名为SNP,0,1,2表示的是个体在某个SNP位点的基因型数据

200000
112021
112022
200000
102011
212000
  • haplotype_hap: Haplotype 格式的基因型数据

    行表示的为SNP,列表式的是个体,每个个体占两列。

    00011000
    00100100
    11000011
    00111100
    00011100
  • haplotype_sample: Haplotype 格式的基因型数据

    基因型数据的个体名称。

    3098
    3498
    3297
    2452
    4255
    2946
  • haplotype_map: Haplotype 格式的基因型数据

    1SNP1224488CA
    1SNP2293696GT
    1SNP3333333TG
    1SNP4464830AG
    1SNP5722623CT
    1SNP6838596CA
  • vcf: VCF 格式的基因型数据

##fileformat=VCFv4.2
##source=“beagle.29May21.d6d.jar”
##INFO<ID=AF,Number=A,Type=Float>
##INFO<ID=IMP,Number=0,Type=Flag">
##FORMAT<ID=GT,Number=1,Type=String>
#CHROMPOSIDREFALTQUALFILTERINFOFORMAT34983297
16260M2TA.PASS.GT1|00|1
115289M17AT.PASS.GT0|00|0

参数

🤡Basic

  • 参数1:input_data_plink_ped

用户提供的 Plink-ped格式的数据,data.frame or matrix 类型。具体格式见结果部分

  • 参数2:input_data_plink_map

用户提供的 Plink-map格式的数据,data.frame or matrix 类型。具体格式见结果部分

  • 参数3:input_data_hmp

用户提供的 Hapmap格式的数据,data.frame or matrix 类型。具体格式见结果部分

  • 参数4:input_data_blupf90

用户提供的 BLUPF90格式数据,data.frame or matrix 类型。具体格式见结果部分

  • 参数5:input_data_numeric

用户提供的 Numeric格式的数据,data.frame or matrix 类型。具体格式见结果部分

  • 参数6:input_data_haplotype_hap

用户提供的 Haplotype格式的数据 ,data.frame or matrix 类型。具体格式见结果部分

  • 参数7:input_data_haplotype_sample

用户提供的 Haplotype格式的数据 ,data.frame or matrix 类型。具体格式见结果部分

  • 参数8:input_data_haplotype_map

用户提供的 Haplotype格式的数据 ,data.frame or matrix 类型。具体格式见结果部分

  • 参数9:input_data_vcf

用户提供的 VCF格式的数据 ,data.frame or matrix 类型。具体格式见结果部分

Note: input_data_numeric 数据应该包含行名和列名。

此外,为了方便用户使用,用户还可以直接通过提供本地数据的路径、名称与数据类型即可完成数据提供这一步骤,而无需将数据读入到R里面。

  • 参数10:input_data_type

    用户提供的本地数据的格式,character 类型。数据格式包括:

    • Hapmap
    • Plink
    • BLUPF90
    • Numeric
    • Haplotype
    • VCF
  • 参数11:input_data_path

用户提供的本地数据的文件路径,character 类型。

  • 参数12:input_data_name

用户提供的本地数据的文件名称,character 类型。

Note: 如果提供的数据类型为Plink ,那么本地文件名称不需要带后缀,eg. 本地文件名为test1.map test1.ped,我们提供文件名称为: input_data_name="test1"。除了Plink格式的数据外,其他数据格式必须提供完整的名称(带后缀)。

  • 参数13:output_data_path

输出的基因型数据保存到本地的路径,character 类型。

  • 参数14:output_data_name

输出的基因型数据保存到本地的文件名称,character 类型。

  • 参数15:output_data_type

    用户提供的本地数据的格式,character 类型。数据格式包括:

    • Hapmap
    • Plink
    • BLUPF90
    • Numeric
    • Haplotype
    • VCF
  • 参数16:return_result

是否在R中返回输出的结果,logical类型。默认为FLASE。

  • 参数17:bigmemory_cal

是否使用bigmemory方式进行计算. logical 类型. 默认为 FALSE.

  • 参数18:bigmemory_data_path

bigmemory数据保存的路径 . character 类型.

  • 参数19:bigmemory_data_name

bigmemory数据保存的文件名称 . character 类型.

  • 参数20:phased_genotype

是否基因型数据已经经过定向. logical 类型.默认为 FALSE.

  • 参数21:haplotype_window_nSNP

根据连续的SNP数目来定义单倍型block. numeric 类型.

  • 参数22:haplotype_window_kb

根据物理位置信息来定义单倍型block. numeric 类型.

  • 参数23:haplotype_window_block

根据用户自定义的信息来定义单倍型block. . data.frame or matrix类型.

第一列是window起始位置,第二列是window结束位置

15
610
1115
1620
2125
2630

💨Advanced

  • 参数24:cpu_cores

函数调用的cpu个数,numeric 类型。默认调用1个

  • 参数25:miss_base

缺失值在原基因型数据中所表示的的字符,character 类型。默认为"NN"。

  • 参数26:miss_base_num

数字化格式转换中缺失值转换成的数字,numeric 类型。默认为 5。

梅全顺
梅全顺
博士后

My research interests include genomic selection and machine learning in animal breeding.