reads.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. // Copyright 2016 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.genomics.v1;
  16. import "google/api/annotations.proto";
  17. import "google/genomics/v1/range.proto";
  18. import "google/genomics/v1/readalignment.proto";
  19. import "google/genomics/v1/readgroupset.proto";
  20. import "google/longrunning/operations.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option cc_enable_arenas = true;
  24. option java_multiple_files = true;
  25. option java_outer_classname = "ReadsProto";
  26. option java_package = "com.google.genomics.v1";
  27. service StreamingReadService {
  28. // Returns a stream of all the reads matching the search request, ordered
  29. // by reference name, position, and ID.
  30. rpc StreamReads(StreamReadsRequest) returns (stream StreamReadsResponse) {
  31. option (google.api.http) = { post: "/v1/reads:stream" body: "*" };
  32. }
  33. }
  34. // The Readstore. A data store for DNA sequencing Reads.
  35. service ReadServiceV1 {
  36. // Creates read group sets by asynchronously importing the provided
  37. // information.
  38. //
  39. // For the definitions of read group sets and other genomics resources, see
  40. // [Fundamentals of Google
  41. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  42. //
  43. // The caller must have WRITE permissions to the dataset.
  44. //
  45. // ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import
  46. //
  47. // - Tags will be converted to strings - tag types are not preserved
  48. // - Comments (`@CO`) in the input file header will not be preserved
  49. // - Original header order of references (`@SQ`) will not be preserved
  50. // - Any reverse stranded unmapped reads will be reverse complemented, and
  51. // their qualities (also the "BQ" and "OQ" tags, if any) will be reversed
  52. // - Unmapped reads will be stripped of positional information (reference name
  53. // and position)
  54. rpc ImportReadGroupSets(ImportReadGroupSetsRequest) returns (google.longrunning.Operation) {
  55. option (google.api.http) = { post: "/v1/readgroupsets:import" body: "*" };
  56. }
  57. // Exports a read group set to a BAM file in Google Cloud Storage.
  58. //
  59. // For the definitions of read group sets and other genomics resources, see
  60. // [Fundamentals of Google
  61. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  62. //
  63. // Note that currently there may be some differences between exported BAM
  64. // files and the original BAM file at the time of import. See
  65. // [ImportReadGroupSets][google.genomics.v1.ReadServiceV1.ImportReadGroupSets]
  66. // for caveats.
  67. rpc ExportReadGroupSet(ExportReadGroupSetRequest) returns (google.longrunning.Operation) {
  68. option (google.api.http) = { post: "/v1/readgroupsets/{read_group_set_id}:export" body: "*" };
  69. }
  70. // Searches for read group sets matching the criteria.
  71. //
  72. // For the definitions of read group sets and other genomics resources, see
  73. // [Fundamentals of Google
  74. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  75. //
  76. // Implements
  77. // [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135).
  78. rpc SearchReadGroupSets(SearchReadGroupSetsRequest) returns (SearchReadGroupSetsResponse) {
  79. option (google.api.http) = { post: "/v1/readgroupsets/search" body: "*" };
  80. }
  81. // Updates a read group set.
  82. //
  83. // For the definitions of read group sets and other genomics resources, see
  84. // [Fundamentals of Google
  85. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  86. //
  87. // This method supports patch semantics.
  88. rpc UpdateReadGroupSet(UpdateReadGroupSetRequest) returns (ReadGroupSet) {
  89. option (google.api.http) = { patch: "/v1/readgroupsets/{read_group_set_id}" body: "read_group_set" };
  90. }
  91. // Deletes a read group set.
  92. //
  93. // For the definitions of read group sets and other genomics resources, see
  94. // [Fundamentals of Google
  95. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  96. rpc DeleteReadGroupSet(DeleteReadGroupSetRequest) returns (google.protobuf.Empty) {
  97. option (google.api.http) = { delete: "/v1/readgroupsets/{read_group_set_id}" };
  98. }
  99. // Gets a read group set by ID.
  100. //
  101. // For the definitions of read group sets and other genomics resources, see
  102. // [Fundamentals of Google
  103. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  104. rpc GetReadGroupSet(GetReadGroupSetRequest) returns (ReadGroupSet) {
  105. option (google.api.http) = { get: "/v1/readgroupsets/{read_group_set_id}" };
  106. }
  107. // Lists fixed width coverage buckets for a read group set, each of which
  108. // correspond to a range of a reference sequence. Each bucket summarizes
  109. // coverage information across its corresponding genomic range.
  110. //
  111. // For the definitions of read group sets and other genomics resources, see
  112. // [Fundamentals of Google
  113. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  114. //
  115. // Coverage is defined as the number of reads which are aligned to a given
  116. // base in the reference sequence. Coverage buckets are available at several
  117. // precomputed bucket widths, enabling retrieval of various coverage 'zoom
  118. // levels'. The caller must have READ permissions for the target read group
  119. // set.
  120. rpc ListCoverageBuckets(ListCoverageBucketsRequest) returns (ListCoverageBucketsResponse) {
  121. option (google.api.http) = { get: "/v1/readgroupsets/{read_group_set_id}/coveragebuckets" };
  122. }
  123. // Gets a list of reads for one or more read group sets.
  124. //
  125. // For the definitions of read group sets and other genomics resources, see
  126. // [Fundamentals of Google
  127. // Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
  128. //
  129. // Reads search operates over a genomic coordinate space of reference sequence
  130. // & position defined over the reference sequences to which the requested
  131. // read group sets are aligned.
  132. //
  133. // If a target positional range is specified, search returns all reads whose
  134. // alignment to the reference genome overlap the range. A query which
  135. // specifies only read group set IDs yields all reads in those read group
  136. // sets, including unmapped reads.
  137. //
  138. // All reads returned (including reads on subsequent pages) are ordered by
  139. // genomic coordinate (by reference sequence, then position). Reads with
  140. // equivalent genomic coordinates are returned in an unspecified order. This
  141. // order is consistent, such that two queries for the same content (regardless
  142. // of page size) yield reads in the same order across their respective streams
  143. // of paginated responses.
  144. //
  145. // Implements
  146. // [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85).
  147. rpc SearchReads(SearchReadsRequest) returns (SearchReadsResponse) {
  148. option (google.api.http) = { post: "/v1/reads/search" body: "*" };
  149. }
  150. }
  151. // The read group set search request.
  152. message SearchReadGroupSetsRequest {
  153. // Restricts this query to read group sets within the given datasets. At least
  154. // one ID must be provided.
  155. repeated string dataset_ids = 1;
  156. // Only return read group sets for which a substring of the name matches this
  157. // string.
  158. string name = 3;
  159. // The continuation token, which is used to page through large result sets.
  160. // To get the next page of results, set this parameter to the value of
  161. // `nextPageToken` from the previous response.
  162. string page_token = 2;
  163. // The maximum number of results to return in a single page. If unspecified,
  164. // defaults to 256. The maximum value is 1024.
  165. int32 page_size = 4;
  166. }
  167. // The read group set search response.
  168. message SearchReadGroupSetsResponse {
  169. // The list of matching read group sets.
  170. repeated ReadGroupSet read_group_sets = 1;
  171. // The continuation token, which is used to page through large result sets.
  172. // Provide this value in a subsequent request to return the next page of
  173. // results. This field will be empty if there aren't any additional results.
  174. string next_page_token = 2;
  175. }
  176. // The read group set import request.
  177. message ImportReadGroupSetsRequest {
  178. enum PartitionStrategy {
  179. PARTITION_STRATEGY_UNSPECIFIED = 0;
  180. // In most cases, this strategy yields one read group set per file. This is
  181. // the default behavior.
  182. //
  183. // Allocate one read group set per file per sample. For BAM files, read
  184. // groups are considered to share a sample if they have identical sample
  185. // names. Furthermore, all reads for each file which do not belong to a read
  186. // group, if any, will be grouped into a single read group set per-file.
  187. PER_FILE_PER_SAMPLE = 1;
  188. // Includes all read groups in all imported files into a single read group
  189. // set. Requires that the headers for all imported files are equivalent. All
  190. // reads which do not belong to a read group, if any, will be grouped into a
  191. // separate read group set.
  192. MERGE_ALL = 2;
  193. }
  194. // Required. The ID of the dataset these read group sets will belong to. The
  195. // caller must have WRITE permissions to this dataset.
  196. string dataset_id = 1;
  197. // The reference set to which the imported read group sets are aligned to, if
  198. // any. The reference names of this reference set must be a superset of those
  199. // found in the imported file headers. If no reference set id is provided, a
  200. // best effort is made to associate with a matching reference set.
  201. string reference_set_id = 4;
  202. // A list of URIs pointing at [BAM
  203. // files](https://samtools.github.io/hts-specs/SAMv1.pdf)
  204. // in Google Cloud Storage.
  205. repeated string source_uris = 2;
  206. // The partition strategy describes how read groups are partitioned into read
  207. // group sets.
  208. PartitionStrategy partition_strategy = 5;
  209. }
  210. // The read group set import response.
  211. message ImportReadGroupSetsResponse {
  212. // IDs of the read group sets that were created.
  213. repeated string read_group_set_ids = 1;
  214. }
  215. // The read group set export request.
  216. message ExportReadGroupSetRequest {
  217. // Required. The Google Developers Console project ID that owns this
  218. // export. The caller must have WRITE access to this project.
  219. string project_id = 1;
  220. // Required. A Google Cloud Storage URI for the exported BAM file.
  221. // The currently authenticated user must have write access to the new file.
  222. // An error will be returned if the URI already contains data.
  223. string export_uri = 2;
  224. // Required. The ID of the read group set to export. The caller must have
  225. // READ access to this read group set.
  226. string read_group_set_id = 3;
  227. // The reference names to export. If this is not specified, all reference
  228. // sequences, including unmapped reads, are exported.
  229. // Use `*` to export only unmapped reads.
  230. repeated string reference_names = 4;
  231. }
  232. message UpdateReadGroupSetRequest {
  233. // The ID of the read group set to be updated. The caller must have WRITE
  234. // permissions to the dataset associated with this read group set.
  235. string read_group_set_id = 1;
  236. // The new read group set data. See `updateMask` for details on mutability of
  237. // fields.
  238. ReadGroupSet read_group_set = 2;
  239. // An optional mask specifying which fields to update. Supported fields:
  240. //
  241. // * [name][google.genomics.v1.ReadGroupSet.name].
  242. // * [referenceSetId][google.genomics.v1.ReadGroupSet.reference_set_id].
  243. //
  244. // Leaving `updateMask` unset is equivalent to specifying all mutable
  245. // fields.
  246. google.protobuf.FieldMask update_mask = 3;
  247. }
  248. message DeleteReadGroupSetRequest {
  249. // The ID of the read group set to be deleted. The caller must have WRITE
  250. // permissions to the dataset associated with this read group set.
  251. string read_group_set_id = 1;
  252. }
  253. message GetReadGroupSetRequest {
  254. // The ID of the read group set.
  255. string read_group_set_id = 1;
  256. }
  257. message ListCoverageBucketsRequest {
  258. // Required. The ID of the read group set over which coverage is requested.
  259. string read_group_set_id = 1;
  260. // The name of the reference to query, within the reference set associated
  261. // with this query. Optional.
  262. string reference_name = 3;
  263. // The start position of the range on the reference, 0-based inclusive. If
  264. // specified, `referenceName` must also be specified. Defaults to 0.
  265. int64 start = 4;
  266. // The end position of the range on the reference, 0-based exclusive. If
  267. // specified, `referenceName` must also be specified. If unset or 0, defaults
  268. // to the length of the reference.
  269. int64 end = 5;
  270. // The desired width of each reported coverage bucket in base pairs. This
  271. // will be rounded down to the nearest precomputed bucket width; the value
  272. // of which is returned as `bucketWidth` in the response. Defaults
  273. // to infinity (each bucket spans an entire reference sequence) or the length
  274. // of the target range, if specified. The smallest precomputed
  275. // `bucketWidth` is currently 2048 base pairs; this is subject to
  276. // change.
  277. int64 target_bucket_width = 6;
  278. // The continuation token, which is used to page through large result sets.
  279. // To get the next page of results, set this parameter to the value of
  280. // `nextPageToken` from the previous response.
  281. string page_token = 7;
  282. // The maximum number of results to return in a single page. If unspecified,
  283. // defaults to 1024. The maximum value is 2048.
  284. int32 page_size = 8;
  285. }
  286. // A bucket over which read coverage has been precomputed. A bucket corresponds
  287. // to a specific range of the reference sequence.
  288. message CoverageBucket {
  289. // The genomic coordinate range spanned by this bucket.
  290. Range range = 1;
  291. // The average number of reads which are aligned to each individual
  292. // reference base in this bucket.
  293. float mean_coverage = 2;
  294. }
  295. message ListCoverageBucketsResponse {
  296. // The length of each coverage bucket in base pairs. Note that buckets at the
  297. // end of a reference sequence may be shorter. This value is omitted if the
  298. // bucket width is infinity (the default behaviour, with no range or
  299. // `targetBucketWidth`).
  300. int64 bucket_width = 1;
  301. // The coverage buckets. The list of buckets is sparse; a bucket with 0
  302. // overlapping reads is not returned. A bucket never crosses more than one
  303. // reference sequence. Each bucket has width `bucketWidth`, unless
  304. // its end is the end of the reference sequence.
  305. repeated CoverageBucket coverage_buckets = 2;
  306. // The continuation token, which is used to page through large result sets.
  307. // Provide this value in a subsequent request to return the next page of
  308. // results. This field will be empty if there aren't any additional results.
  309. string next_page_token = 3;
  310. }
  311. // The read search request.
  312. message SearchReadsRequest {
  313. // The IDs of the read groups sets within which to search for reads. All
  314. // specified read group sets must be aligned against a common set of reference
  315. // sequences; this defines the genomic coordinates for the query. Must specify
  316. // one of `readGroupSetIds` or `readGroupIds`.
  317. repeated string read_group_set_ids = 1;
  318. // The IDs of the read groups within which to search for reads. All specified
  319. // read groups must belong to the same read group sets. Must specify one of
  320. // `readGroupSetIds` or `readGroupIds`.
  321. repeated string read_group_ids = 5;
  322. // The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to
  323. // `*`, only unmapped reads are returned. If unspecified, all reads (mapped
  324. // and unmapped) are returned.
  325. string reference_name = 7;
  326. // The start position of the range on the reference, 0-based inclusive. If
  327. // specified, `referenceName` must also be specified.
  328. int64 start = 8;
  329. // The end position of the range on the reference, 0-based exclusive. If
  330. // specified, `referenceName` must also be specified.
  331. int64 end = 9;
  332. // The continuation token, which is used to page through large result sets.
  333. // To get the next page of results, set this parameter to the value of
  334. // `nextPageToken` from the previous response.
  335. string page_token = 3;
  336. // The maximum number of results to return in a single page. If unspecified,
  337. // defaults to 256. The maximum value is 2048.
  338. int32 page_size = 4;
  339. }
  340. // The read search response.
  341. message SearchReadsResponse {
  342. // The list of matching alignments sorted by mapped genomic coordinate,
  343. // if any, ascending in position within the same reference. Unmapped reads,
  344. // which have no position, are returned contiguously and are sorted in
  345. // ascending lexicographic order by fragment name.
  346. repeated Read alignments = 1;
  347. // The continuation token, which is used to page through large result sets.
  348. // Provide this value in a subsequent request to return the next page of
  349. // results. This field will be empty if there aren't any additional results.
  350. string next_page_token = 2;
  351. }
  352. // The stream reads request.
  353. message StreamReadsRequest {
  354. // The Google Developers Console project ID or number which will be billed
  355. // for this access. The caller must have WRITE access to this project.
  356. // Required.
  357. string project_id = 1;
  358. // The ID of the read group set from which to stream reads.
  359. string read_group_set_id = 2;
  360. // The reference sequence name, for example `chr1`,
  361. // `1`, or `chrX`. If set to *, only unmapped reads are
  362. // returned.
  363. string reference_name = 3;
  364. // The start position of the range on the reference, 0-based inclusive. If
  365. // specified, `referenceName` must also be specified.
  366. int64 start = 4;
  367. // The end position of the range on the reference, 0-based exclusive. If
  368. // specified, `referenceName` must also be specified.
  369. int64 end = 5;
  370. // Restricts results to a shard containing approximately `1/totalShards`
  371. // of the normal response payload for this query. Results from a sharded
  372. // request are disjoint from those returned by all queries which differ only
  373. // in their shard parameter. A shard may yield 0 results; this is especially
  374. // likely for large values of `totalShards`.
  375. //
  376. // Valid values are `[0, totalShards)`.
  377. int32 shard = 6;
  378. // Specifying `totalShards` causes a disjoint subset of the normal response
  379. // payload to be returned for each query with a unique `shard` parameter
  380. // specified. A best effort is made to yield equally sized shards. Sharding
  381. // can be used to distribute processing amongst workers, where each worker is
  382. // assigned a unique `shard` number and all workers specify the same
  383. // `totalShards` number. The union of reads returned for all sharded queries
  384. // `[0, totalShards)` is equal to those returned by a single unsharded query.
  385. //
  386. // Queries for different values of `totalShards` with common divisors will
  387. // share shard boundaries. For example, streaming `shard` 2 of 5
  388. // `totalShards` yields the same results as streaming `shard`s 4 and 5 of 10
  389. // `totalShards`. This property can be leveraged for adaptive retries.
  390. int32 total_shards = 7;
  391. }
  392. message StreamReadsResponse {
  393. repeated Read alignments = 1;
  394. }