GitHunt
JE

jean-philippe-martin/api-client-java

A command line tool for Google Genomics API queries.

==============
api-client-java |Build Status|_ |Build Coverage|_

.. |Build Status| image:: http://img.shields.io/travis/googlegenomics/api-client-java.svg?style=flat
.. _Build Status: https://travis-ci.org/googlegenomics/api-client-java

.. |Build Coverage| image:: http://img.shields.io/coveralls/googlegenomics/api-client-java.svg?style=flat
.. _Build Coverage: https://coveralls.io/r/googlegenomics/api-client-java?branch=master

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 <http://googlegenomics.readthedocs.org/en/latest/auth_requirements.html>_
    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.

.. _Google Genomics API: https://cloud.google.com/genomics/what-is-google-genomics
.. _Apache Maven: http://maven.apache.org/download.cgi
.. _sign up instructions: https://cloud.google.com/genomics/install-genomics-tools#authenticate

Code layout

CommandLine.java <src/main/java/com/google/cloud/genomics/api/client/CommandLine.java>:
sets up the command line options using the jcommander library <https://github.com/cbeust/jcommander>
.

GenomicsSample.java <src/main/java/com/google/cloud/genomics/api/client/GenomicsSample.java>:
uses the GenomicsFactory from utils-java <https://github.com/googlegenomics/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 <src/main/java/com/google/cloud/genomics/api/client/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 <https://groups.google.com/forum/#!forum/google-genomics-discuss>_ 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 <https://groups.google.com/forum/#!forum/google-genomics-discuss>_.

jean-philippe-martin/api-client-java | GitHunt