How to use the dnaio.readers.FastaReader function in dnaio

To help you get started, we’ve selected a few dnaio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcelm / cutadapt / src / cutadapt / parser.py View on Github external
def parse(self, spec: str, cmdline_type: str = 'back') -> Iterator[Adapter]:
        """
        Parse an adapter specification and yield appropriate Adapter classes.
        This works like the _parse_no_file() function above, but also supports the
        ``file:`` notation for reading adapters from an external FASTA
        file. Since a file can contain multiple adapters, this
        function is a generator.
        """
        if spec.startswith('file:'):
            # read adapter sequences from a file
            with xopen(spec[5:], mode="rb", threads=0) as f:
                fasta = FastaReader(f)
                for record in fasta:
                    name = record.name.split(None, 1)
                    name = name[0] if name else None
                    yield self._parse(record.sequence, cmdline_type, name=name)
        else:
            yield self._parse(spec, cmdline_type, name=None)

dnaio

Read and write FASTA and FASTQ files efficiently

MIT
Latest version published 10 days ago

Package Health Score

75 / 100
Full package analysis