Hello, I have two files (each has 300 lines)like this:
head 1g.txt rs6792369 rs1414517 rs16857712 rs16857703 rs12239392 ... head 1n.txt rs1042779 rs2360630 rs10753597 rs7549096 rs2343491 ... For each pair of rs# from those two files I can run this command in R library(httr) library(jsonlite) library(xml2) server <- "http://rest.ensembl.org" ext <- "/ld/human/pairwise/rs6792369/rs1042779?population_name=1000GENOMES:phase_3:KHV" r <- GET(paste(server, ext, sep = ""), content_type("application/json")) stop_for_status(r) head(fromJSON(toJSON(content(r)))) d_prime r2 variation1 variation2 population_name 1 0.975513 0.951626 rs6792369 rs1042779 1000GENOMES:phase_3:KHV What I would like to do is to do is to run this command for every SNP in one list (1g.txt) to each SNP in another list (1n.txt). Where SNP# is rs# and output every line of result in list.txt The process is illustrated in the attachment. Please help, Ana
lists.pdf
Description: Adobe PDF document
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.