Skip to content

VCF writer - no way to pass escapechar param #12

@davmlaw

Description

@davmlaw

If you try and write a string that needs escaping, writing fails with:

need to escape, but no escapechar set

Fix would be to add an escapechar param. Or, just allow **kwargs that you pass to csv.writer (let me know if you want a pull request but this is super simple)

Workaround is to override the writer property

    vcf_writer = Writer(f, vcf_reader)
    # Need to pass escapechar so redefine writer
    vcf_writer.writer = csv.writer(
        f,
        delimiter="\t",
        lineterminator="\n",
        quoting=csv.QUOTE_NONE,
        escapechar="\\",
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions