Code Monkey home page Code Monkey logo

api-client-java's Introduction

api-client-java Build Status_

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 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-v1beta.jar searchreadsets --dataset_id 376902546192 --fields "readsets(id,name)"
    
    java -jar target/genomics-tools-client-java-v1beta.jar searchreads --readset_id "CJDmkYn8ChCh4IH4hOf4gacB" --sequence_name 1 --sequence_start 10000 --sequence_end 10000

Troubleshooting

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

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

    java -jar target/genomics-tools-client-java-v1beta.jar searchreadsets
  • 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-v1beta.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.

Other backends

Some of the commands can be used against GA4GH providers other than Google. For example, you can search both readsets and reads at NCBI. (Be sure to specify the fields parameter as some of the NCBI fields don't pass the strict type checking done by the Java JSON parser):

java -jar target/genomics-tools-client-java-v1beta.jar searchreadsets --root_url "http://trace.ncbi.nlm.nih.gov/Traces/gg/" --dataset_id "SRP034507" --fields "readsets(id,name,fileData),pageToken"

java -jar target/genomics-tools-client-java-v1beta.jar searchreads --root_url "http://trace.ncbi.nlm.nih.gov/Traces/gg/" --readset_id "SRR1050536" --sequence_name "gi|333959|gb|M74568.1|RSHSEQ" --sequence_start 1 --sequence_end 100 --fields "pageToken,reads(name,position,flags)"

Code layout

CommandLine.java:

defines all of the possible command line arguments using the args4j library.

GenomicsSample.java:

provides the bulk of the logic. In its main method, the user's request is dispatched to either make a call to the Genomics API or to authenticate the user. Most of the code deals with OAuth.

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

This code is getting improvements!

Instead of being just a simple wrapper around API calls, the command line will start providing additional functionality to make things simpler for callers.

For example, the command line is now validating datasetIds, keeping track of past jobs, storing recently used datasets and more.

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 [email protected] or just post using the web forum page.

api-client-java's People

Contributors

cassiedoll avatar deflaux avatar gkrasin avatar heuermh avatar kwestbrooks avatar lucena avatar namn avatar smoitra-g avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.