Methods to automate the list of pangos for augur filter?

Hi,
I frequently SARS-CoV-2 builds, and every time I need to update the list of pangos to filter on. For example like this:

builds:
    ba_2_86:
        pango_lineage: "['BA.2.86', 'BA.2.86.1', 'JN.1', 'JN.1.1', 'JN.1.1.1']"

Is there a clever way to update the list of pangos in the builds file? For example by referring to a text file of entries?

Is that example something that is already working, or is that an example of what you are trying to do? It may be easier to manage in native YAML:

builds:
    ba_2_86:
        pango_lineage:
        - BA.2.86
        - BA.2.86.1
        - JN.1
        - JN.1.1
        - JN.1.1.1

I haven’t tested, but this should work in a Snakemake rule that looks something like:

rule filter:
    params:
        include_where = ' '.join(f'pango_lineage="{lineage}"'
                                 for lineage in config['builds']['ba_2_86']['pango_lineage']),
    shell:
        """
        augur filter --include-where {params.include_where}
        """

If you want to keep the list in a separate text file, there should be a way in Snakemake to read the list from a text file into a list that can be used the same way as the example above.

Yes, my first example already works. But as you mention, maybe I can keep a separate file with a list of pangos and then make Snakemake access this the same way as it accesses the builds file through [‘builds’]? I will check it out.
Thanks

1 Like