Skip to content

jean-philippe-martin/api-client-java

 
 

Repository files navigation

api-client-java Build Status Build Coverage

Getting started

This Java client allows users to call the Google Genomics API through the command line.

  • To use, first build the client using Apache Maven:

    cd api-client-java
    mvn package
    
  • Then, follow the sign up instructions to generate a valid client_secrets.json file.

  • Move the client_secrets.json file into the api-client-java directory. (Authentication will take place the first time you make an API call.)

  • You can then perform API queries like fetching readsets or reads:

    java -jar target/genomics-tools-client-java-v1beta2.jar searchreadgroupsets --dataset_id 10473108253681171589 --fields "readGroupSets(id,name)"
    
    java -jar target/genomics-tools-client-java-v1beta2.jar searchreads --id "CMvnhpKTFhD04eLE-q2yxnU" --reference_name 1 --start 10000 --end 10001
    

Troubleshooting

  • You can get a list of valid commands by running:

    java -jar target/genomics-tools-client-java-v1beta2.jar
    
  • Or get help on a specific command with:

    java -jar target/genomics-tools-client-java-v1beta2.jar searchreadgroupsets
    
  • If your environment isn’t capable of running a local server, and then seeing that server on localhost with a browser, then you can use the --nolocalserver flag to go back to the more manual auth process:

    java -jar target/genomics-tools-client-java-v1beta2.jar listjobs --nolocalserver
    
  • Note that not all of Google's APIs are callable at this time. The docs have a list of which APIs are available.

  • If you wish to call an API that has not yet been fully integrated into the command line, use the custom command.

Code layout

CommandLine.java:
sets up the command line options using the jcommander library.
GenomicsSample.java:
uses the GenomicsFactory from utils-java to set up a valid Genomics object. It then dispatches to one of the command classes to handle the user's request.
commands:
This directory contains one java file for each command line option, which translates the user's command line arguments into API calls.

Updating the prebuilt jar

The prebuilt jar is currently generated by hand, whenever the code seems stable and has enough new features to warrant the effort.

To update the jar, we use a different set of maven commands:

cd api-client-java
mvn clean
mvn assembly:assembly
cp target/genomics-tools-client-java-v1beta2-jar-with-dependencies.jar genomics-tools-client-java-v1beta2.jar

Project status

Goals

  • Provide a command line interface to the Google Genomics APIs (to make importing, querying, and other methods more accessible)
  • Provide an example of how to use the generated Java client library.

Current status

Please file feature requests for additional things the command line can do to make your life easier!

The mailing list

The Google Genomics Discuss mailing list is a good way to sync up with other people who use genomics-tools including the core developers. You can subscribe by sending an email to google-genomics-discuss+subscribe@googlegroups.com or just post using the web forum page.

About

A command line tool for Google Genomics API queries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%