Closed Zheng19w closed 10 months ago
Your my_associations
object contains the tables. This is explain in the documentation: https://rmagno.eu/gwasrapidd/reference/associations-class.html.
Each of these gives you an individual data frame:
my_associations@associations
my_associations@loci
my_associations@risk_alleles
my_associations@genes
my_associations@ensembl_ids
my_associations@entrez_ids
For example, you can do:
write.table(my_associations@risk_alleles,"muscle measurement.txt",quote = FALSE)
I have a problem. The exported location information is different from the GWAS catalog page
I want to get the specific chromosome number and the corresponding position information
The column locus_id
is not the genomic location as indicated in Location
in the web app. Again, see the documentation that clarifies the meaning of each column: https://rmagno.eu/gwasrapidd/reference/associations-class.html.
To actually get genomic coordinates for your variants, see this similar question: https://github.com/ramiromagno/gwasrapidd/issues/31.
Dear ramiromagno,
Thank you very much for developing this excellent tool, my R language is not very good, I am not sure how to modify the code, to get the coordinate information I want, can you help me, thank you
library(gwasrapidd)
study_id <- "GCST004132" associations <- get_associations(study_id = study_id) variants <- get_variants(study_id = study_id)
genes <- associations@genes %>% dplyr::group_by(association_id, locus_id) %>% dplyr::summarise(gene_name = paste(gene_name, collapse = ' '), .groups = 'drop')
association_results <- associations@associations %>% dplyr::select(association_id, pvalue, beta_number, or_per_copy_number) %>% dplyr::left_join(associations@risk_alleles, by = 'association_id') %>% dplyr::left_join(genes, by = c('association_id', 'locus_id')) %>% dplyr::left_join(variants@variants, by = c('variant_id')) %>% dplyr::transmute( study_id = study_id, association_id = association_id, ID = variant_id, CHROM = chromosome_name, POS = chromosome_position, risk_allele = risk_allele, gene_name = gene_name, P = pvalue, beta = beta_number, OR = or_per_copy_number )
Dear ramiromagno,
Thank you very much for developing this excellent tool, my R language is not very good, I am not sure how to modify the code, to get the coordinate information I want, can you help me, thank you
I have tried to solve this problem, thank you very much for your answer, wish you a happy life!
child_traits <- gwasrapidd::get_child_efo("EFO_0004515")$EFO_0004515 child_traits_in_gwas_cat <- all_traits[child_traits] associations <- get_associations(efo_id = c("EFO_0004515", child_traits_in_gwas_cat@traits$efo_id)) variants <- get_variants(efo_id = c("EFO_0004515", child_traits_in_gwas_cat@traits$efo_id))
genes <- associations@genes %>% dplyr::group_by(association_id, locus_id) %>% dplyr::summarise(gene_name = paste(gene_name, collapse = ' '), .groups = 'drop')
association_results <- associations@associations %>% dplyr::select(association_id, pvalue, beta_number, or_per_copy_number) %>% dplyr::left_join(associations@risk_alleles, by = 'association_id') %>% dplyr::left_join(genes, by = c('association_id', 'locus_id')) %>% dplyr::left_join(variants@variants, by = c('variant_id')) %>% dplyr::transmute(
association_id = association_id,
ID = variant_id,
CHROM = chromosome_name,
POS = chromosome_position,
risk_allele = risk_allele,
gene_name = gene_name,
P = pvalue,
beta = beta_number,
OR = or_per_copy_number
)
write.table(association_results,"muscle measurement.txt",quote = FALSE,,row.names = FALSE, col.names = FALSE,sep = "\t")
Hi @Zheng19w:
I am not sure if you managed to solve your problem, or whether you still need help. If the latter, just let me know. Otherwise I will close this issue.
I would like to obtain information on the location of snp loci