28 #include "alignment.h" 40 typedef unique_ptr<Clonotype> ClonotypePtr;
49 SequenceType seq_type,
51 const segments_storage_t &segments,
53 const n_D_alignments_storage_t &n_D_alignments)
58 _good(segments[0] && segments[1] && ((segments[2] && recomb == VDJ_RECOMB) || recomb == VJ_RECOMB))
64 SequenceType seq_type,
71 _good(alignment.
nVar() && alignment.nJoi() && ((alignment.nDiv() && recomb == VDJ_RECOMB) || recomb == VJ_RECOMB))
89 const sequence_t&
sequence()
const {
return _sequence; }
92 const sequence_t& nuc_sequence()
const {
94 check_and_throw(_seq_type != NUCLEOTIDE,
"Clonotype's call to nuc_sequence() is incorrect: wrong sequence type.");
99 sequence_t aa_sequence()
const {
101 check_and_throw(_seq_type == UNDEF_SEQ_TYPE,
"Clonotype's call to aa_sequence() is incorrect: undefined sequence type.");
103 if (_seq_type == NUCLEOTIDE) {
104 return translate(_sequence);
112 sequence_t::const_iterator seq_iterator(seq_len_t pos)
const {
return _sequence.cbegin() + pos; }
115 Recombination recombination()
const {
return _recomb; }
118 SequenceType sequence_type()
const {
return _seq_type; }
126 if (_seq_type == NUCLEOTIDE) {
127 return !(is_out_of_frame(_sequence) || has_end_codon(_sequence));
129 return !has_bad_aa_codons(_sequence);
133 bool isNoncoding()
const {
134 if (_seq_type == NUCLEOTIDE) {
135 return is_out_of_frame(_sequence) || has_end_codon(_sequence);
137 return has_bad_aa_codons(_sequence);
141 bool isOutOfFrame()
const {
142 if (_seq_type == NUCLEOTIDE) {
143 return is_out_of_frame(_sequence);
145 return has_oof_aa_codon(_sequence);
154 std::string res =
"";
155 res += this->nuc_sequence() +
"\t";
156 res +=
"V:" + std::to_string(_segments[0]) +
"\t";
157 res +=
"D:" + std::to_string(_segments[2]) +
"\t";
158 res +=
"J:" + std::to_string(_segments[1]);
162 bool is_good()
const {
return _good; }
166 Recombination _recomb;
168 SequenceType _seq_type;
170 sequence_t _sequence;
Definition: nogap_alignment_vector.h:37
std::string toString() const
Return the string representation of the clonotype.
Definition: clonotype.h:153
Definition: clonotype.h:46
VDJAlignment()
Definition: vdj_alignment.h:226
bool isCoding() const
Check if clonotype's sequence is coding, noncoding or out-of-frame.
Definition: clonotype.h:125
seg_index_t nVar() const
Get the number of alignments for the specific gene.
Definition: vdj_alignment.h:100
Definition: vdj_alignment.h:36
const sequence_t & sequence() const
Get the sequence of this Clonotype.
Definition: clonotype.h:90