def _qseq_to_protein_sequence(fh, seq_num=1, phred_offset=_default_phred_offset, variant=_default_variant, **kwargs): return _get_nth_sequence(_qseq_to_generator(fh, filter=False, phred_offset=phred_offset, variant=variant, constructor=Protein, **kwargs), seq_num)
def _fastq_to_protein_sequence(fh, variant=None, phred_offset=None, seq_num=1, **kwargs): return _get_nth_sequence( _fastq_to_generator(fh, variant=variant, phred_offset=phred_offset, constructor=Protein, **kwargs), seq_num)
def _fastq_to_rna(fh, variant=None, phred_offset=None, seq_num=1, **kwargs): return _get_nth_sequence( _fastq_to_generator(fh, variant=variant, phred_offset=phred_offset, constructor=RNA, **kwargs), seq_num)
def _construct_seq(fh, constructor=DNA, seq_num=1): lines = [] for i, (data_type, seq_id, l) in enumerate(_yield_record(fh), 1): if data_type == 'data' and seq_num == i: lines = l seq = _get_nth_sequence(_fasta_to_generator(fh, constructor=constructor), seq_num=seq_num) seq.interval_metadata = _parse_record(lines, len(seq)) return seq
def _fastq_to_biological_sequence(fh, variant=None, phred_offset=None, seq_num=1): return _get_nth_sequence( _fastq_to_generator(fh, variant=variant, phred_offset=phred_offset, constructor=Sequence), seq_num)
def _qseq_to_biological_sequence(fh, seq_num=1, phred_offset=_default_phred_offset, variant=_default_variant): return _get_nth_sequence( _qseq_to_generator(fh, filter=False, phred_offset=phred_offset, variant=variant, constructor=Sequence), seq_num)
def _qseq_to_protein(fh, seq_num=1, phred_offset=_default_phred_offset, variant=_default_variant, **kwargs): return _get_nth_sequence( _qseq_to_generator(fh, filter=False, phred_offset=phred_offset, variant=variant, constructor=Protein, **kwargs), seq_num)
def test_seq_num_just_right(self): value = _get_nth_sequence(self.gen, 3) self.assertEqual(value, 'goldilocks: 3')
def test_seq_num_too_small(self): with self.assertRaises(ValueError) as cm: _get_nth_sequence(self.gen, 0) self.assertIn('between 1 and', str(cm.exception)) self.assertIn('0', str(cm.exception))
def test_seq_num_too_big(self): with self.assertRaises(ValueError) as cm: _get_nth_sequence(self.gen, 6) self.assertIn('end of file', str(cm.exception)) self.assertIn('6th', str(cm.exception))
def _qseq_to_biological_sequence(fh, seq_num=1, phred_offset=_default_phred_offset, variant=_default_variant): return _get_nth_sequence(_qseq_to_generator(fh, filter=False, phred_offset=phred_offset, variant=variant, constructor=Sequence), seq_num)
def _embl_to_RNA(fh, seq_num=1, **kwargs): record = _get_nth_sequence(_parse_records(fh, _parse_single_embl), seq_num) return _construct(record, RNA, **kwargs)
def test_seq_num_just_right(self): value = _get_nth_sequence(self.gen, 3) self.assertEqual(value, "goldilocks: 3")
def _fasta_to_biological_sequence(fh, qual=FileSentinel, seq_num=1): return _get_nth_sequence( _fasta_to_generator(fh, qual=qual, constructor=Sequence), seq_num)
def _genbank_to_protein(fh, seq_num=1, **kwargs): record = _get_nth_sequence(_parse_genbanks(fh), seq_num) return _construct(record, Protein, **kwargs)
def _sam_to_RNA(fh, seq_num=1, **kwargs): record = _get_nth_sequence(_parse_records(fh), seq_num) return _construct(record, RNA, **kwargs)
def _fasta_to_protein_sequence(fh, qual=FileSentinel, seq_num=1, **kwargs): return _get_nth_sequence( _fasta_to_generator(fh, qual=qual, constructor=Protein, **kwargs), seq_num)
def _genbank_to_rna(fh, seq_num=1, **kwargs): record = _get_nth_sequence(_parse_genbanks(fh), seq_num) return _construct(record, RNA, **kwargs)
def _fasta_to_protein(fh, qual=FileSentinel, seq_num=1, **kwargs): return _get_nth_sequence( _fasta_to_generator(fh, qual=qual, constructor=Protein, **kwargs), seq_num)
def test_seq_num_too_small(self): with self.assertRaises(ValueError) as cm: _get_nth_sequence(self.gen, 0) self.assertIn("between 1 and", str(cm.exception)) self.assertIn("0", str(cm.exception))
def test_seq_num_too_big(self): with self.assertRaises(ValueError) as cm: _get_nth_sequence(self.gen, 6) self.assertIn("end of file", str(cm.exception)) self.assertIn("6th", str(cm.exception))