Title: | Genome-Wide Identity-by-Descent |
---|---|
Description: | Methods and tools for the analysis of Genome Wide Identity-by-Descent ('gwid') mapping data, focusing on testing whether there is a higher occurrence of Identity-By-Descent (IBD) segments around potential causal variants in cases compared to controls, which is crucial for identifying rare variants. To enhance its analytical power, 'gwid' incorporates a Sliding Window Approach, allowing for the detection and analysis of signals from multiple Single Nucleotide Polymorphisms (SNPs). |
Authors: | Soroush Mahmoudiandehkordi [aut, cre], Steven J Schrodi [aut], Mehdi Maadooliat [aut] |
Maintainer: | Soroush Mahmoudiandehkordi <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2025-02-06 05:27:49 UTC |
Source: | https://github.com/soroushmdg/gwid |
Open a SNP GDS file and extract information.
build_gwas(gds_data = "name.gds", caco = "name.Rda", gwas_generator = TRUE)
build_gwas(gds_data = "name.gds", caco = "name.Rda", gwas_generator = TRUE)
gds_data |
File name |
caco |
An object of class caco. Output of |
gwas_generator |
logical; if |
a list of seven objects; including smp.id, snp.id, snp.pos, smp.indx, smp.snp (a matrix with samples in rows and snp in columns), caco, snps(column sum of smp.snp for each case control)
Open a ibd file and extract information.
build_gwid( ibd_data = "name.ibd", gwas = "object of class gwas", gwid_generator = TRUE )
build_gwid( ibd_data = "name.ibd", gwas = "object of class gwas", gwid_generator = TRUE )
ibd_data |
a file name for output of Refined IBD |
gwas |
object of class gwas |
gwid_generator |
logical; if |
the output will be a object(list) of class gwid contains profile object, IBD object and result_snps object.
Read .vcf structured text format files and reduce the size of file.
build_phase(phased_vcf = "name.vcf", caco)
build_phase(phased_vcf = "name.vcf", caco)
phased_vcf |
A file name for a variant call format (vcf) file. |
caco |
An object of class caco. Output of |
the output will be a a list of class phase contains two sparse matrix for each haplotype.
Reload saved case-control list file
case_control(case_control_rda, ...)
case_control(case_control_rda, ...)
case_control_rda |
A character string giving the name of the case-control file to load. The file is a list of character vectors including subject names in each case-control groups or csv file including subject name for a disease. |
... |
name of a column (disease name) of csv file. |
The output will be a list of character vectors include subject names and groups. The class of returned object is caco.
Extract information from SNP GDS file.
extract(obj, ...)
extract(obj, ...)
obj |
an object of class gwas |
... |
other arguments |
extract object instants
extract component of an object
extract_window(obj, ...)
extract_window(obj, ...)
obj |
obj |
... |
other variables |
the output will be a result_snps (data.table) object including 3 columns including, “snp_pos”, “case_control”, and “value”
Extract information from ibd data in a moving window
## S3 method for class 'gwid' extract_window(obj, w = 10, snp_start, snp_end, ...)
## S3 method for class 'gwid' extract_window(obj, w = 10, snp_start, snp_end, ...)
obj |
object of class gwid(output of function build_gwid) |
w |
window size |
snp_start |
select starting position of snp, which we want to aggregate. |
snp_end |
select ending position of snp, which we want to aggregate. |
... |
other variables |
the output will be a result_snps (data.table) object including 3 columns including, “snp_pos”, “case_control”, and “value”
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Extract information from SNP GDS file.
## S3 method for class 'gwas' extract(obj, type = c("snps", "snp2", "nas"), snp_start, snp_end, ...)
## S3 method for class 'gwas' extract(obj, type = c("snps", "snp2", "nas"), snp_start, snp_end, ...)
obj |
object of class gwas. |
type |
indicate type of aggregation on sample-snp data and must be one of snps, snp2, or nas |
snp_start |
select starting position of snp, which we want to aggregate. |
snp_end |
select ending position of snp, which we want to aggregate. |
... |
other arguments |
the output will be a result_snps (data.table) object including 3 columns including, snp_pos, case_control, and value
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Extract information from ibd data.
## S3 method for class 'gwid' extract(obj = "object of class gwid", snp_start, snp_end, ...)
## S3 method for class 'gwid' extract(obj = "object of class gwid", snp_start, snp_end, ...)
obj |
object of class gwid(output of function build_gwid) |
snp_start |
select starting position of snp, which we want to aggregate. |
snp_end |
select ending position of snp, which we want to aggregate. |
... |
other objects |
the output will be a result_snps (data.table) object including 3 columns including, “snp_pos”, “case_control”, and “value”
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Fisher test
fisher_test(obj, ...)
fisher_test(obj, ...)
obj |
an object |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
Fisher's Exact Test for gwas count data
## S3 method for class 'gwas' fisher_test( obj, reference, snp_start, snp_end, alternative = c("two.sided", "greater", "less"), ... )
## S3 method for class 'gwas' fisher_test( obj, reference, snp_start, snp_end, alternative = c("two.sided", "greater", "less"), ... )
obj |
object of class gwas |
reference |
reference group of subjects in which we want to perform fisher test test |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snp. |
alternative |
indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used in the 2 by 2 case |
... |
optional arguments to fisher.test |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Fisher's Exact Test for gwid count data
## S3 method for class 'gwid' fisher_test( obj, caco, snp_start, snp_end, reference, alternative = c("two.sided", "greater", "less"), ... )
## S3 method for class 'gwid' fisher_test( obj, caco, snp_start, snp_end, reference, alternative = c("two.sided", "greater", "less"), ... )
obj |
An object of class gwid. Output of |
caco |
An object of class caco. Output of |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snp. |
reference |
reference group of subjects in which we want to perform fisher test |
alternative |
indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used in the 2 by 2 case |
... |
optional arguments to fisher.test |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
fisher exact test for result_snps count data
## S3 method for class 'result_snps' fisher_test( obj, caco, reference, alternative = c("two.sided", "greater", "less"), ... )
## S3 method for class 'result_snps' fisher_test( obj, caco, reference, alternative = c("two.sided", "greater", "less"), ... )
obj |
An object of class result_snps |
caco |
An object of class caco. Output of |
reference |
reference group of subjects in which we want to perform fisher test. |
alternative |
indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used in the 2 by 2 case |
... |
optional arguments to fisher.test |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
perform gtest
gtest(haplotype_structure, ...)
gtest(haplotype_structure, ...)
haplotype_structure |
object of a class |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
haplotype_structure
functionPerform G-test on haplotype structures extracted from haplotype_structure
function
## S3 method for class 'haplotype_structure' gtest(haplotype_structure, reference, ...)
## S3 method for class 'haplotype_structure' gtest(haplotype_structure, reference, ...)
haplotype_structure |
An object of class haplotype_structure. Output of
|
reference |
reference group of subjects in which we want to perform G-test |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
haplotype frequency
haplotype_frequency(haplotype_structure, ...)
haplotype_frequency(haplotype_structure, ...)
haplotype_structure |
object of class haplotype structure |
... |
other variables |
An object of class haplotype_frequency contains of two objects. first one is object of haplotype_structure_frequency (data.table) and second one is object of class result_snps(data.table)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
haplotype frequency in sliding windows
## S3 method for class 'haplotype_structure' haplotype_frequency(haplotype_structure, ...)
## S3 method for class 'haplotype_structure' haplotype_frequency(haplotype_structure, ...)
haplotype_structure |
An object of class haplotype_structure. Output of
|
... |
other variables |
An object of class haplotype_frequency contains of two objects. first one is object of haplotype_structure_frequency (data.table) and second one is object of class result_snps(data.table)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
haplotype structures in a window
haplotype_structure(obj, ...)
haplotype_structure(obj, ...)
obj |
object |
... |
other variables |
The output will be an object of class haplotype_structure (data.table) that has information about subjects haplotype structures in a a window.
extract haplotype structures of individuals in a window
## S3 method for class 'gwas' haplotype_structure(obj, phase, w = 10, snp_start, snp_end, ...)
## S3 method for class 'gwas' haplotype_structure(obj, phase, w = 10, snp_start, snp_end, ...)
obj |
object of class gwas |
phase |
An object of class phase. Output of |
w |
window size |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snps. |
... |
other variables |
The output will be an object of class haplotype_structure (data.table) that has information about subjects haplotype structures in a a window.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
extract haplotype structures of pairwise ibd samples in a window
## S3 method for class 'gwid' haplotype_structure(obj, phase, w = 10, snp_start, snp_end, ...)
## S3 method for class 'gwid' haplotype_structure(obj, phase, w = 10, snp_start, snp_end, ...)
obj |
An object of class gwid. Output of |
phase |
An object of class phase. Output of |
w |
window size |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snps. |
... |
other variables |
The output will be an object of class haplotype_structure (data.table) that has information about subjects haplotype structures in a a window.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
laucnh a shiny app
launch_app(data_folder_address, ...)
launch_app(data_folder_address, ...)
data_folder_address |
address of the folder that your data folders are. for example if you have two sets of data such as data1 and data2 and they are in mydata folder then your data_folder_address should be "./mydata" |
... |
other variables |
open a shiny app
mcnemar test
mcnemar_test(roh, ...)
mcnemar_test(roh, ...)
roh |
roh as class result_snp |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
mcnemar permutation
mcnemar_test_permut(mcnemar, ...)
mcnemar_test_permut(mcnemar, ...)
mcnemar |
macnemar test output |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
mcnemar permutation test
## S3 method for class 'result_snps' mcnemar_test_permut( mcnemar = "object of class result_snps (output of function mcnemar_test with fun=sum)", roh_mat = "output of roh function when roh_mat = TRUE", gwas = "object of class gwas", nperm = 1000, reference = "cases", w, ... )
## S3 method for class 'result_snps' mcnemar_test_permut( mcnemar = "object of class result_snps (output of function mcnemar_test with fun=sum)", roh_mat = "output of roh function when roh_mat = TRUE", gwas = "object of class gwas", nperm = 1000, reference = "cases", w, ... )
mcnemar |
macnemar test output |
roh_mat |
roh matrix |
gwas |
gwas |
nperm |
number of permutation |
reference |
reference group |
w |
window |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
mcnemar test
## S3 method for class 'result_snps' mcnemar_test( roh = "object of class result_snps (output of function roh with fun=sum)", reference, w = 10, ... )
## S3 method for class 'result_snps' mcnemar_test( roh = "object of class result_snps (output of function roh with fun=sum)", reference, w = 10, ... )
roh |
An object of class result_snps (output of function roh with fun=sum) |
reference |
reference group of subjects in which we want to perform fisher test. |
w |
window size |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
permutation test
permutation_test(obj, ...)
permutation_test(obj, ...)
obj |
object |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
Permutation test for gwas object
## S3 method for class 'gwas' permutation_test( obj, snp_start, snp_end, nperm = 1000, reference = "cases", ... )
## S3 method for class 'gwas' permutation_test( obj, snp_start, snp_end, nperm = 1000, reference = "cases", ... )
obj |
object of class gwas |
snp_start |
elect starting position of snps. |
snp_end |
select ending position of snp. |
nperm |
Number of permutations. |
reference |
reference group of subjects in which we want to perform fisher test |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
permutation test for gwid count data
## S3 method for class 'gwid' permutation_test( obj, gwas, snp_start, snp_end, nperm = 100, reference = "cases", ... )
## S3 method for class 'gwid' permutation_test( obj, gwas, snp_start, snp_end, nperm = 100, reference = "cases", ... )
obj |
An object of class gwid. Output of |
gwas |
object of class gwas |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snp. |
nperm |
Number of permutations. |
reference |
reference group |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Permutation test for 'haplotype_structure' object
## S3 method for class 'haplotype_structure' permutation_test(obj, nperm, reference, ...)
## S3 method for class 'haplotype_structure' permutation_test(obj, nperm, reference, ...)
obj |
object of class 'haplotype_structure' |
nperm |
Number of permutations. |
reference |
reference group of subjects in which we want to perform 'gtest' |
... |
other variables |
the output will be a test_snps (data.table) object including 3 columns: “snp_pos”, “case_control”, and “value” which is a p-values.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) model_permutation <- permutation_test(ibd_data,snp_data_gds, snp_start = 119026294,snp_end = 120613594,nperm=20,reference = "cases") class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Line plot of gwas objects
## S3 method for class 'gwas' plot(x, y = NA, title = "number of snps", ...)
## S3 method for class 'gwas' plot(x, y = NA, title = "number of snps", ...)
x |
object of class gwas. |
y |
default value is NA, if specified it should be a vector of names of subject groups i.e. y = c("case","control") |
title |
title of the plot. |
... |
optional argument of |
an interactive line plot of gwas objects for each case control subjects.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Line plot of gwid objects
## S3 method for class 'gwid' plot( x, y = NA, title = "number of IBD in each snp", plot_type = c("result_snps", "profile"), reference, ... )
## S3 method for class 'gwid' plot( x, y = NA, title = "number of IBD in each snp", plot_type = c("result_snps", "profile"), reference, ... )
x |
An object of class gwid. Output of |
y |
default value is NA, if specified it should be a vector of names of subject groups i.e. y = c("case","control") |
title |
title of the plot. |
plot_type |
either “result_snps” or “profile”. |
reference |
reference group of subjects in which we want to have profile plot. |
... |
if plot_type is “result_snps” it is optional argument of |
if plot_type is “result_snps” an interactive line plot of result_snps for each case control subjects. if plot_type is “profile” an interactive profile plot of identity by descent subjects in subset of locations.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Line plot of haplotype_frequency object
## S3 method for class 'haplotype_frequency' plot( x, y = NA, plot_type = c("haplotype_structure_frequency", "result_snps"), type = c("version1", "version2"), ly = TRUE, nwin, title, line_size = 0.6, ... )
## S3 method for class 'haplotype_frequency' plot( x, y = NA, plot_type = c("haplotype_structure_frequency", "result_snps"), type = c("version1", "version2"), ly = TRUE, nwin, title, line_size = 0.6, ... )
x |
an object of class haplotype_frequency |
y |
default value is 'NA', if specified it should be a vector of names of subject groups i.e. 'y = c("case","control")' |
plot_type |
either “result_snps” or “"haplotype_structure_frequency"” |
type |
either “version1” or “version2” when plot_type is “"haplotype_structure_frequency"” |
ly |
if TRUE, we have a plotly object and if it is false plot is going to be a ggplot object. |
nwin |
window number |
title |
title of the plot. |
line_size |
geom_line size |
... |
optional argument of |
an interactive line plot of haplotype_frequency objects for each case control subjects.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1", dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1", dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Two type of line plots for haplotype_structure_frequency objects .
## S3 method for class 'haplotype_structure_frequency' plot( x, y = NA, type = c("version1", "version2"), nwin, ly = TRUE, line_size = 0.6, ... )
## S3 method for class 'haplotype_structure_frequency' plot( x, y = NA, type = c("version1", "version2"), nwin, ly = TRUE, line_size = 0.6, ... )
x |
an object of class haplotype_structure_frequency |
y |
default value is NA, if specified it should be a vector of names of subject groups i.e. y = c("case","control") |
type |
either “version1” or “version2” |
nwin |
window number |
ly |
if 'TRUE', we have a 'plotly' object and if it is 'FALSE' plot is going to be a 'ggplot' object. |
line_size |
geom_line size |
... |
other variables |
an interactive line plot of haplotype_structure_frequency objects for each case control subjects.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Line plot of result_snps objects
## S3 method for class 'result_snps' plot(x, y = NA, title, snp_start, snp_end, ly = TRUE, line_size = 0.6, ...)
## S3 method for class 'result_snps' plot(x, y = NA, title, snp_start, snp_end, ly = TRUE, line_size = 0.6, ...)
x |
An object of class result_snps. |
y |
default value is NA, if specified it should be a vector of names of subject groups i.e. y = c("case","control") |
title |
title of the plot. |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snps. |
ly |
if TRUE, we have a plotly object and if it is false plot is going to be a ggplot object. |
line_size |
geom_line size |
... |
other variables |
an interactive line plot of result_snps for each case control subjects.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
Line plot of test_snps objects
## S3 method for class 'test_snps' plot( x, y = NA, title, snp_start, snp_end, ly = TRUE, line_size = 0.6, log_transformation = TRUE, QQplot = FALSE, ... )
## S3 method for class 'test_snps' plot( x, y = NA, title, snp_start, snp_end, ly = TRUE, line_size = 0.6, log_transformation = TRUE, QQplot = FALSE, ... )
x |
an object of class test_snps. |
y |
default value is NA, if specified it should be a vector of names of subject groups i.e. y = c("case","control") |
title |
title of the plot. |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snps. |
ly |
if 'TRUE', we have a 'plotly' object and if it is 'FALSE' plot is going to be a 'ggplot' object. |
line_size |
geom_line size |
log_transformation |
if 'TRUE' plot -log10 transformation of p_values. |
QQplot |
if TRUE, plot QQplot of P-values |
... |
other variables |
an interactive line plot of test_snps objects for each case control subjects.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
print(x, ...)
print(x, ...)
x |
an object |
... |
other objects |
print an object
print gwas instants
## S3 method for class 'gwas' print(x, ...)
## S3 method for class 'gwas' print(x, ...)
x |
object gwas |
... |
other objects |
print number of subjects and number of SNPs of a GWAS object
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) print(snp_data_gds) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) print(snp_data_gds) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
runs of homozygosity
roh(phase, ...)
roh(phase, ...)
phase |
object of phase |
... |
other variables |
runs of homozygosity data table or matrix
runs of homozygosity
## S3 method for class 'phase' roh( phase, gwas, w = 10, fun = c("sum", "mean"), snp_start, snp_end, roh_mat = FALSE, ... )
## S3 method for class 'phase' roh( phase, gwas, w = 10, fun = c("sum", "mean"), snp_start, snp_end, roh_mat = FALSE, ... )
phase |
An object of class phase. Output of |
gwas |
object of class gwas |
w |
window size |
fun |
an aggregate function. either “sum” or “mean” |
snp_start |
select starting position of snps. |
snp_end |
select ending position of snps. |
roh_mat |
return roh as matrix |
... |
other variables |
the output will be a result_snps (data.table) object including 3 columns including, “snp_pos”, “case_control”, and “value”
subset an object
subset(obj, ...)
subset(obj, ...)
obj |
object |
... |
other variables |
the output will be a object(list) of class gwid contains profile object and result_snps object.
subset gwid object based on snp position
## S3 method for class 'gwid' subset(obj, snp_start, snp_end, ...)
## S3 method for class 'gwid' subset(obj, snp_start, snp_end, ...)
obj |
object of class gwid(output of function build_gwid) |
snp_start |
select starting position of snp, which we want to aggregate. |
snp_end |
select ending position of snp, which we want to aggregate. |
... |
other variables |
the output will be a object(list) of class gwid contains profile object and result_snps object.
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)
piggyback::pb_download(repo = "soroushmdg/gwid",tag = "v0.0.1",dest = tempdir()) ibd_data_file <- paste0(tempdir(),"//chr3.ibd") genome_data_file <- paste0(tempdir(),"//chr3.gds") phase_data_file <- paste0(tempdir(),"//chr3.vcf") case_control_data_file <- paste0(tempdir(),"//case-cont-RA.withmap.Rda") # case-control data case_control <- gwid::case_control(case_control_rda = case_control_data_file) names(case_control) #cases and controls group summary(case_control) # in here, we only consider cases,cont1,cont2,cont3 groups in the study case_control$cases[1:3] # first three subject names of cases group # read SNP data (use SNPRelate to convert it to gds) and count number of minor alleles snp_data_gds <- gwid::build_gwas(gds_data = genome_data_file, caco = case_control,gwas_generator = TRUE) class(snp_data_gds) names(snp_data_gds) head(snp_data_gds$snps) # it has information about counts of minor alleles in each location. # read haplotype data (output of beagle) haplotype_data <- gwid::build_phase(phased_vcf = phase_data_file,caco = case_control) class(haplotype_data) names(haplotype_data) dim(haplotype_data$Hap.1) #22302 SNP and 1911 subjects # read IBD data (output of Refined-IBD) ibd_data <- gwid::build_gwid(ibd_data = ibd_data_file,gwas = snp_data_gds) class(ibd_data) ibd_data$ibd # refined IBD output ibd_data$res # count number of IBD for each SNP location # plot count of IBD in chromosome 3 plot(ibd_data,y = c("cases","cont1"),ly = FALSE) # Further investigate location between 117M and 122M # significant number of IBD's in group cases, compare to cont1, cont2 and cont3. plot(ibd_data,y = c("cases","cont1"),snp_start = 119026294,snp_end = 120613594,ly = FALSE) model_fisher <- gwid::fisher_test(ibd_data,case_control,reference = "cases", snp_start = 119026294,snp_end = 120613594) class(model_fisher) plot(model_fisher, y = c("cases","cont1"),ly = FALSE) hap_str <- gwid::haplotype_structure(ibd_data,phase = haplotype_data,w = 10, snp_start = 119026294,snp_end = 120613594) haplo_freq <- gwid::haplotype_frequency(hap_str) plot(haplo_freq,y = c("cases", "cont1"),plot_type = "haplotype_structure_frequency", nwin = 1, type = "version1",ly = FALSE)