Skip to content

Java client for the 23andMe Personal Genome API.

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

heuermh/personal-genome-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

personal-genome-client

Java client for the 23andMe Personal Genome API.

Build Status

Hacking personal-genome-client

Install

To build

$ mvn install

To build demo webapp

$ cd webapp
$ mvn assembly:assembly

To 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.jar 

Open

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<Haplogroup> 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<PaternalTerminalSnp> 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<MaternalTerminalSnp> 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<Genotype> 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<String, String> 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

About

Java client for the 23andMe Personal Genome API.

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages