예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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)
예제 #4
0
파일: gff3.py 프로젝트: ElDeveloper/biolopy
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
예제 #5
0
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
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
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)
예제 #9
0
 def test_seq_num_just_right(self):
     value = _get_nth_sequence(self.gen, 3)
     self.assertEqual(value, 'goldilocks: 3')
예제 #10
0
    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))
예제 #11
0
    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))
예제 #12
0
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)
예제 #13
0
파일: embl.py 프로젝트: biocore/micronota
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)
예제 #14
0
 def test_seq_num_just_right(self):
     value = _get_nth_sequence(self.gen, 3)
     self.assertEqual(value, "goldilocks: 3")
예제 #15
0
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)
예제 #16
0
def _genbank_to_protein(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_genbanks(fh), seq_num)
    return _construct(record, Protein, **kwargs)
예제 #17
0
파일: sam.py 프로젝트: biocore/micronota
def _sam_to_RNA(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_records(fh), seq_num)
    return _construct(record, RNA, **kwargs)
예제 #18
0
def _genbank_to_protein(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_genbanks(fh), seq_num)
    return _construct(record, Protein, **kwargs)
예제 #19
0
파일: embl.py 프로젝트: sjanssen2/micronota
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)
예제 #20
0
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)
예제 #21
0
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)
예제 #22
0
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)
예제 #23
0
def _genbank_to_rna(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_genbanks(fh), seq_num)
    return _construct(record, RNA, **kwargs)
예제 #24
0
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)
예제 #25
0
def _genbank_to_rna(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_genbanks(fh), seq_num)
    return _construct(record, RNA, **kwargs)
예제 #26
0
    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))
예제 #27
0
    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))
예제 #28
0
def _sam_to_RNA(fh, seq_num=1, **kwargs):
    record = _get_nth_sequence(_parse_records(fh), seq_num)
    return _construct(record, RNA, **kwargs)