Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heuermh/personal-genome-client
Java client for the 23andMe Personal Genome API.
https://github.com/heuermh/personal-genome-client
Last synced: 9 days ago
JSON representation
Java client for the 23andMe Personal Genome API.
- Host: GitHub
- URL: https://github.com/heuermh/personal-genome-client
- Owner: heuermh
- License: lgpl-3.0
- Created: 2012-10-10T18:03:50.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-03-14T15:44:58.000Z (over 7 years ago)
- Last Synced: 2024-05-02T00:31:10.822Z (6 months ago)
- Language: Java
- Size: 17 MB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
personal-genome-client
======================Java client for the 23andMe Personal Genome API.
[![Build Status](https://travis-ci.org/heuermh/personal-genome-client.png)](https://travis-ci.org/heuermh/personal-genome-client)
### Hacking personal-genome-client
Install
* JDK 1.6 or later, http://openjdk.java.net/
* Apache Maven 3.0.5 or later, http://maven.apache.org/To build
$ mvn install
To build demo webapp
$ cd webapp
$ mvn assembly:assemblyTo run demo webapp, your 23andMe Personal Genome API client details must be provided as command line system properties
$ java -DapiKey=apiKey \
-DapiSecret=apiSecret \
-Dcallback=http://localhost:8080/after-auth-landing/ \
-Dscope=scope \
-jar target/personal-genome-webapp-1.0-SNAPSHOT-jar-with-dependencies.jarOpen
http://localhost:8080/
in a browser.
### Using personal-genome-client
OAuthService service = ...;
Token accessToken = ...;
PersonalGenomeConverter converter = ...;
PersonalGenomeClient client = new ScribePersonalGenomeClient(accessToken, service, converter);
User user = client.user();
System.out.println("user id: " + user.getId());
for (Profile profile : user.getProfiles()) {
System.out.println("profile id: " + profile.getId());
UserName userName = client.names(profile.getId());
System.out.println("user name: " + userName.getFirstName() + " " + userName.getLastName());
for (ProfileName profileName : userName.getProfilesNames()) {
System.out.println("profile name: " + profileName.getFirstName() + " " + profileName.getLastName());
}
List haplogroups = client.haplogroups(profile.getId());
System.out.println(haplogroups.size() + " haplogroups:");
for (Haplogroup haplogroup : haplogroups) {
System.out.println(" paternal: " + haplogroup.getPaternal());
System.out.println(" maternal: " + haplogroup.getMaternal());
List paternalTerminalSnps = haplogroup.getPaternalTerminalSnps();
if (paternalTerminalSnps != null) {
System.out.println(" " + paternalTerminalSnps.size() + " paternal terminal SNPs:");
for (PaternalTerminalSnp paternalTerminalSnp : paternalTerminalSnps) {
System.out.println(" rsid: " + paternalTerminalSnp.getRsid());
System.out.println(" ISOGG SNP: " + paternalTerminalSnp.getSnp());
}
}
List maternalTerminalSnps = haplogroup.getMaternalTerminalSnps();
System.out.println(" " + maternalTerminalSnps.size() + " maternal terminal SNPs:");
for (MaternalTerminalSnp maternalTerminalSnp : maternalTerminalSnps) {
System.out.println(" rsid: " + maternalTerminalSnp.getRsid());
System.out.println(" rCRS position: " + maternalTerminalSnp.getRcrsPosition());
}
}
List genotypes = client.genotypes(profile.getId(), "rs1234", "rs2345");
System.out.println(genotypes.size() + " genotypes:");
for (Genotype genotype : genotypes) {
System.out.println(" " + genotype.getValues().size() + " locations:");
for (Map.Entry entry : genotype.getValues().entrySet()) {
System.out.println(" " + entry.getKey() + ": " + entry.getValue());
}
}
Genome genome = client.genome(profile.getId());
int length = genomes.getValues().length();
System.out.println("genome:");
System.out.println(" values: " + (length < 32) ? genomes.getValues() : genomes.getValues().substring(0, 32) + "...")
}[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/heuermh/personal-genome-client/trend.png)](https://bitdeli.com/free "Bitdeli Badge")