def make_read(bases, quals=None, cigar=None, mapq=50, chrom='chr1', start=1, name='read'): """Makes a third_party.nucleus.protos.Read for testing.""" if quals and len(bases) != len(quals): raise ValueError('Incompatable bases and quals', bases, quals) read = reads_pb2.Read( fragment_name=name, proper_placement=True, read_number=1, number_reads=2, aligned_sequence=bases, aligned_quality=quals, alignment=reads_pb2.LinearAlignment( position=position_pb2.Position(reference_name=chrom, position=start), mapping_quality=mapq, cigar=_cigar.to_cigar_units(cigar) if cigar else [])) return read
def make_read(bases, start, quals=None, cigar=None, mapq=50, chrom='chr1', name=None): """Makes a nucleus.genomics.v1.Read for testing.""" if quals and len(bases) != len(quals): raise ValueError('Incompatable bases and quals', bases, quals) read = reads_pb2.Read( fragment_name=name if name else 'read_' + str(make_read.counter), proper_placement=True, read_number=1, number_reads=2, aligned_sequence=bases, aligned_quality=quals, alignment=reads_pb2.LinearAlignment( position=position_pb2.Position(reference_name=chrom, position=start), mapping_quality=mapq, cigar=_cigar.to_cigar_units(cigar) if cigar else [])) make_read.counter += 1 return read
def _raw_next(self): record = reads_pb2.Read() not_done = self._cc_iterable.PythonNext(record) return record, not_done