def __init__(self, input_path): """Initializes a NativeFastqReader. Args: input_path: str. A path to a resource containing FASTQ records. """ super(NativeFastqReader, self).__init__() fastq_path = input_path.encode('utf8') options = fastq_pb2.FastqReaderOptions() self._reader = fastq_reader.FastqReader.from_file(fastq_path, options) self.header = None
def test_fastq_iterate(self): with fastq_reader.FastqReader.from_file(self.fastq, self.options) as reader: iterable = reader.iterate() self.assertIsInstance(iterable, clif_postproc.WrappedCppIterable) self.assertEqual(test_utils.iterable_len(iterable), 3) zreader = fastq_reader.FastqReader.from_file( self.zipped_fastq, fastq_pb2.FastqReaderOptions( compression_type=fastq_pb2.FastqReaderOptions.GZIP)) with zreader: ziterable = zreader.iterate() self.assertIsInstance(ziterable, clif_postproc.WrappedCppIterable) self.assertEqual(test_utils.iterable_len(ziterable), 3)
def setUp(self): self.fastq = test_utils.genomics_core_testdata('test_reads.fastq') self.options = fastq_pb2.FastqReaderOptions()