--- a +++ b/third_party/nucleus/protos/reference.proto @@ -0,0 +1,83 @@ +// Copyright 2018 Google LLC. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +syntax = "proto3"; + +import "third_party/nucleus/protos/range.proto"; + +package nucleus.genomics.v1; + +// This file contains information about a reference genome assembly. It +// currently only defines a message to represent a single contig, but can be +// extended to capture information about an entire assembly as well (e.g. +// all contigs present on an assembly, the species, build, etc.). + +// This record type records information about a contig. This is used both in +// VCF header parsing and by GenomeReference objects for querying references. +// Due to its generality, this message is also used by the FastaReader to +// provide detailed information on the description line of a FASTA record even +// in cases where the record does not correspond to a reference genome contig. +message ContigInfo { + // Required. The name of the contig. Canonically this is the first + // non-whitespace-containing string after the > marker in a FASTA file. + // For example, the line: + // >chr1 more info here + // has a name of "chr1" and a description of "more info here" + string name = 1; + + // Ideally this record is filled in as described above, but not all FASTA + // readers capture the description information after the name. Since a + // description is not required by the FASTA spec, we cannot distinguish cases + // where a description was not present and where a parser ignored it. + string description = 2; + + // The length of this contig in basepairs. + int64 n_bases = 3; + + // Additional information used when reading and writing VCF headers. An + // example map of key-value extra fields would transform an input line + // containing 'assembly=B36,taxonomy=x,species="Homo sapiens"' to a map with + // "assembly" -> "B36", "taxonomy" -> "x", "species" -> "Homo sapiens". We + // never use this information internally, other than reading it in so we can + // write the contig out again. + map<string, string> extra = 5; + + // The position of this contig in the src_fasta file. The first contig would + // have position 0. + // TODO: rename to something more generic. + int32 pos_in_fasta = 4; +} + +// A full, or partial, sequence of bases from a contig in a reference genome. +message ReferenceSequence { + // The location on the genome this sequence of bases comes from. + Range region = 1; + + // The bases of this part of the reference genome. + string bases = 2; +}