Giter VIP home page Giter VIP logo

candihap's Introduction

CandiHap

DOI

Install

library(devtools)
install_github("guokai8/CandiHap")

Usage

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

Contact information

For any questions please contact [email protected] or submit the issues to https://github.com/guokai8/CandiHap/issues

candihap's People

Contributors

guokai8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

candihap's Issues

A question for use snboxplot module

hello Dr. Guo
I have a problem when I used snboxplot module in Candihap.
the error message is "Insufficient values in manual scale. 6 needed but only 4 provided". it seems something wrong which ggplot2 packages, but i dont know how to deal with this problem .

Hap_result结果解读

Kai,
您好,最近用了CandiHap做单倍型分析,看了运行出来的结果,对hap_result的结果有一些地方不是很明白。如下截图,截得是CandiHap文章里的。红色框里的Hap信息,为什么都是两个碱基的,比如T/T G/G等,而且文章中有一个类似的表格,甚至两个碱基还不一样。我理解的单倍型是位于同一条染色体的,应该是一连串单碱基的,我觉得是我没有理解这个文件,在您不忙时,能不能帮我解答一下,万分感谢。
image

Error when running snp2hap function

The function snp2hap exit with the following error:
Error in gr[x][, c("REF", "ALT", hapind[[x]])] :
'j' cannot mix between and within metadata column names

The command is as follows:
my.hap <- snp2hap(my.pheno,my.ovl)

The object my.pheno is:

my.pheno

A tibble: 462 × 2

sample test

1 WB-001 1
2 WB-002 2
3 WB-003 3
4 WB-004 4
5 WB-005 5
6 WB-006 6
7 WB-007 7
8 WB-008 8
9 WB-009 9
10 WB-010 10

while the object my.ovl was created with the followinf two functions:

my.hmp <-read_hmp("haplotypes.hmp", comment = "&")
my.ovl <- findover(my.gr,my.hmp)

Plot Gene LDheatmap

want to extract results (For V0.0.15)

Hap_results <- results(hap, gene="Si9g49990")

Plot Gene LDheatmap

if (! require("LDheatmap")) install.packages("LDheatmap")
if (! require("genetics")) install.packages("genetics")
LDsnp <- Hap_results[, !names(Hap_results) %in% c("sample","Info")]
LDsnp = LDsnp[,-ncol(LDsnp)]
NAs <- LDsnp == "N/N"
is.na(LDsnp)[NAs] <- TRUE
LDsnp[NAs] <- NA
LDsnp = LDsnp[-1,]
Dist = as.numeric(LDsnp[1,])
LDsnp = LDsnp[-c(1:6),]
num<-ncol(LDsnp) 
for(i in 1:num){
    LDsnp[,i]<-as.genotype(LDsnp[,i]) 
}
rgb.palette <- colorRampPalette(rev(c("#1F77B4", "#AEC7E8", "#FF7F0E")), space = "rgb")
LDheatmap(LDsnp, genetic.distances = Dist, flip = TRUE, color=rgb.palette(40))

Error when running snp2hap function S4Vectors:::normarg_names(value, class(x), length(x)): attempt to set too many names (242) on GroupedIRanges object of length 241

Error in S4Vectors:::normarg_names(value, class(x), length(x)): attempt to set too many names (242) on GroupedIRanges object of length 241
I try many ways to solve it, such as the trait sample name is consistent with vcf name;and one step by step running the code,when I run ss <- bplapply(sequence, function(x)as.DNAbin(muscle(x, quiet =TRUE)),BPPARAM=BPPARAM), it will happen this error.Can you help me to solve this problem

About Windows_X64 version

Dear CandiHap team:

Is the CandiHap software no longer supported on windows_X64? Thank you very much

Pls Help

I get this error: when using the snp2hap funtion hap <- snp2hap(pheno,ovl, hapname="Hap")
Error in which(unlist(lapply(sequence, function(x) max(width(x)) > 5))) :
argument to 'which' is not logical

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.