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 authentication instructions to generate a valid
client_secrets.jsonfile.Move the
client_secrets.jsonfile 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
The default API provider is Google, but you can also query against 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)"
See the docs for the full set of options
Most of the Java code is a generated client library. This includes everything under
com/google/api/services. Currently, the generated client library
(part of this parent project) is only creatable by Google.
Very shortly though it will become a proper Maven dependency
(artifactId google-api-services-genomics under groupId com.google.apis).
There are only 2 non-generated files:
- CommandLine.java:
- defines all of the possible command line arguments using the args4j library.
- GenomicsSample.java:
- provides the bulk of the logic. In its
mainmethod, 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.
- 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.
This code is mostly static, there are no known feature requests. All bug fixes will be addressed but it's unlikely the overall structure and featureset will change much.
There is an ongoing need to integrate more API calls as they become available. The work involved is small.
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.