:type sequence: int
        :type ourBaseKey: ECKeyPair
        :type ourRatchetKey: ECKeyPair
        :type  ourIdentityKey: IdentityKeyPair
515046
def setPendingKeyExchange(self, sequence, ourBaseKey, ourRatchetKey, ourIdentityKey):
        
        structure = self.sessionStructure.PendingKeyExchange()
        structure.sequence = sequence
        structure.localBaseKey = ourBaseKey.getPublicKey().serialize()
        structure.localBaseKeyPrivate = ourBaseKey.getPrivateKey().serialize()
        structure.localRatchetKey = ourRatchetKey.getPublicKey().serialize()
        structure.localRatchetKeyPrivate = ourRatchetKey.getPrivateKey().serialize()
        structure.localIdentityKey = ourIdentityKey.getPublicKey().serialize()
        structure.localIdentityKeyPrivate = ourIdentityKey.getPrivateKey().serialize()

        self.sessionStructure.pendingKeyExchange.MergeFrom(structure)
997192
def is_sequence(obj):
    """"""
    return isinstance(obj, Sequence) and not (
        isinstance(obj, str) or BinaryClass.is_valid_type(obj))
1146431
def checkseq(sequence: str=None,  code="ATGC") -> bool:
    
    for base in sequence:
        if base not in code:
            return False
    return True
621105
def _constructor(cls, mapping, configuration):
        
        attr = cls(mapping)
        attr._setattr('_sequence_type', configuration)

        return attr
1029772
def sequencetyper(self):
        
        for sample in self.metadata.samples:
            if sample.general.bestassemblyfile != 'NA':
                if type(sample[self.analysistype].allelenames) == list:
                    #
                    if sample[self.analysistype].profile != 'NA':
                        # Initialise dictionaries
                        sample[self.analysistype].profilematches = dict()
                        sample[self.analysistype].sequencetypematches = dict()
                        # Create the profiledata variable to avoid writing self.profiledata[self.analysistype]
                        profiledata = sample[self.analysistype].profiledata
                        # For each gene
                        for gene in sorted(sample[self.analysistype].allelenames):
                            try:
                                allelenumber = sample[self.analysistype].allelematches[gene].split('-')[1]
                                # Find the profile with the most alleles in common with the query genome
                                for sequencetype in profiledata:
                                    # refallele is the allele number of the sequence type
                                    refallele = profiledata[sequencetype][gene]
                                    if allelenumber == refallele:
                                        # Add matching alleles
                                        try:
                                            sample[self.analysistype].profilematches[sequencetype] += 1
                                            sample[self.analysistype].sequencetypematches[sequencetype].append(
                                                refallele)
                                        except KeyError:
                                            sample[self.analysistype].profilematches[sequencetype] = 1
                                            sample[self.analysistype].sequencetypematches[sequencetype] = list()
                                            sample[self.analysistype].sequencetypematches[sequencetype].append(
                                                refallele)
                            except KeyError:
                                pass
1340937
def _sequence(self, i):
        """"""

        c = next(i)
        if c == '!':
            c = next(i)
        if c in ('^', '-', '['):
            c = next(i)

        while c != ']':
            if c == '\\':
                # Handle escapes
                subindex = i.index
                try:
                    self._references(i, True)
                except PathNameException:
                    raise StopIteration
                except StopIteration:
                    i.rewind(i.index - subindex)
            elif c == '/':
                raise StopIteration
            c = next(i)
1061797
def sequence_type(self):
        ''''''
        if self.known_sequence_type is not None:
            return self.known_sequence_type
        else:
            # If its Gzipped and fastq make a small sample of the sequence to be
            # read
            cmd='%s | head -n 2' % (self.command_line())
            first_seq = subprocess.check_output(
                                                cmd,
                                                shell=True,
                                                preexec_fn=lambda:signal(SIGPIPE, SIG_DFL)
                                                )
            _, seq = tuple(first_seq.strip().split('\n'))
            self.type = self._guess_sequence_type_from_string(seq)
            logging.debug("Detected sequence type as %s" % self.type)
            return self.type
687742
def copy(self):
        '''

        '''
        return type(self)(str(self._sequence), features=self.features,
                          run_checks=False)
1094875
def is_a_sequence(var, allow_none=False):
    
    return isinstance(var, (list, tuple)) or (var is None and allow_none)
647412
def sequencebank(self):
        
        path = ['enhancement', 'sequencebanks', 'sequencebank']
        items = listify(chained_get(self._head, path, []))
        bank = namedtuple('Sequencebank', 'name sequence_number type')
        out = []
        for item in items:
            numbers = listify(item['sequence-number'])
            for number in numbers:
                new = bank(name=item['@name'], sequence_number=number['$'],
                           type=number['@type'])
                out.append(new)
        return out or None
992989
private void setSeq() {
		char tempseq[] = new char[seqLength];
		for (int x = 0; x <= seqLength - 1; ++x) {
			tempseq[x] = (char) traceData[PBAS2 + x];
		}
		sequence = new String(tempseq);
	}
1065333
def sequence(values):
    
    import ibis.expr.operations as ops

    return ops.ValueList(values).to_expr()
843390
def _fluent_range_type(cls, fluents, ordering) -> Sequence[str]:
        '''
        '''
        range_types = []
        for name in ordering:
            fluent = fluents[name]
            range_type = fluent.range
            range_types.append(range_type)
        return tuple(range_types)
770827
def get_objects_in_sequence(brain_or_object, ctype, cref):
    
    obj = api.get_object(brain_or_object)
    if ctype == "backreference":
        return get_backreferences(obj, cref)
    if ctype == "contained":
        return get_contained_items(obj, cref)
    raise ValueError("Reference value is mandatory for sequence type counter")
1201315
def encode(self, sequence):
		""""""
		
		polymorphisms = []
		defaultSequence = '' 
		binSequence = array.array(self.forma.typecode)
		b = 0
		i = 0
		trueI = 0 #not inc in case if poly
		poly = set()
		while i < len(sequence)-1:
			b = b | self.forma[self.charToBin[sequence[i]]]
			if sequence[i+1] == '/' :
				poly.add(sequence[i])
				i += 2
			else :
				binSequence.append(b)
				if len(poly) > 0 :
					poly.add(sequence[i])
					polymorphisms.append((trueI, poly))
					poly = set()
				
				bb = 0
				while b % 2 != 0 :
					b = b/2
					
				defaultSequence += sequence[i]
				b = 0
				i += 1
				trueI += 1
		
		if i < len(sequence) :
			b = b | self.forma[self.charToBin[sequence[i]]]
			binSequence.append(b)
			if len(poly) > 0 :
				if sequence[i] not in poly :
					poly.add(sequence[i])
				polymorphisms.append((trueI, poly))
			defaultSequence += sequence[i]
		
		return (binSequence, defaultSequence, polymorphisms)
652116
def idx_sequence(self):
        
        return [x[1] for x in sorted(zip(self._record, list(range(len(self._record)))))]
1189751
def interm_range_type(self) -> Sequence[str]:
        '''
        '''
        fluents = self.domain.intermediate_fluents
        ordering = self.domain.interm_fluent_ordering
        return self._fluent_range_type(fluents, ordering)