Entering edit mode
Enter the body of text here Hi, I need r code or sql command to find the correct haplotype and finally get the correct diplotype. I have the below table, from which I need to get single haplotype for each rsID.
NCBI SNP Reference Wild Variant Haplotype Name Reference Allele Variant Allele
rs7900194 G G CYP2C9*8 G A
rs7900194 G G CYP2C9*27 G T
rs1799853 C T CYP2C9*2 C T
rs1799853 C T CYP2C9*35 C T
rs1799853 C T CYP2C9*61 C T
rs1057910 A A CYP2C9*3 A C
rs1057910 A A CYP2C9*18 A C
Code should be placed in three backticks as shown below
dplyr %>% group_by("NCBI SNP Reference","Wild","Variant") %>% filter(n()>1)
# include your problematic code here with any corresponding output
# please also include the results of running the following in an R session
sessionInfo( )
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=English_India.utf8 LC_CTYPE=English_India.utf8
[3] LC_MONETARY=English_India.utf8 LC_NUMERIC=C
[5] LC_TIME=English_India.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.1.3 ggplot2_3.4.1 tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] fansi_1.0.4 withr_2.5.0 utf8_1.2.3 grid_4.2.2
[5] R6_2.5.1 lifecycle_1.0.3 gtable_0.3.1 magrittr_2.0.3
[9] scales_1.2.1 pillar_1.9.0 rlang_1.1.2 cli_3.6.0
[13] rstudioapi_0.15.0 generics_0.1.3 vctrs_0.6.4 tools_4.2.2
[17] glue_1.6.2 munsell_0.5.0 compiler_4.2.2 pkgconfig_2.0.3
[21] colorspace_2.1-0 tidyselect_1.2.0 tibble_3.2.1