library(devtools)
install_github("guokai8/CandiHap")
library(CandiHap)
data(snp)
gff <- snp$gff
# gff <- importGFF("test.gff3",format="gff3")
gr<-preGranges(gff,gene="Si9g49910",cds = T)
##or use region
# gr <- preGranges(gff,chr=9,region=c(54510843,54520843),cds=T)
hmp <- snp$hmp
ovl <- findover(gr,hmp)
# hmp <- read_hmp("haplotypes.hmp")
# or if you use vcf file
# hmp <- read_vcf('test.vcf')
pheno <- snp$pheno
# pheno <- read_pheno("Phenotype.txt",sep="\t")
##support parallel now (cpus=4)
hap <- snp2hap(pheno,ovl)
## want to extract results
results(hap, gene="Si9g49910")
# make figures
snplot(hap,gene="Si9g49910",side=T)
snplot(hap,gene="Si9g49910",side=T,random = F,hapname="haplotype3")
snplot(hap,gene="Si9g49910",side=T,random = F,hapname="haplotype15",mutateOnly=TRUE)
## want to know more
?snplot
snboxplot(hap,gene="Si9g49910",feature = "test")
hapnet(hap,gene="Si9g49910",feature = "test")
# plot gene track with snp
dat=snp$dat
# or read your data
# notice that the dat should have the chromosome name in the first column, position in the second column and the values in the following columns
# dat <- read_data(file,sep="\t")
snptrack(gff,dat=dat,id="Parent")
# don't show the genes
#snptrack(gff,dat=dat,id="Parent",allchr=TRUE)
## id is the gene name you want to display, in gff3 file should be 'Parent'
#show snp locate in gene only
snptrack(gff,dat=dat,id="Parent",geneOnly=T)
# exon only
snptrack(gff,dat=dat,id="Parent",exonOnly=T)
#define different color
snptrack(gff,dat=dat,id="Parent",low='green',high='pink')
#use r^2 stand for color
snptrack(gff,dat=dat,id="Parent",color='r2')
## show some genes
snptrack(gff,dat=dat,id="Parent",gene='Si9g49910')
#change name, etc ...
?snptrack
For any questions please contact [email protected] or submit the issues to https://github.com/guokai8/CandiHap/issues