rule entrez__download_sequences_by_genbank_id:
    """
    Download sequences from NCBI Genbank database according to the list of enumerated genbank ids
    :output reference: Downloaded sequences in FASTA format
    :output taxonomy: Taxonomies for downloaded sequences
    :param method_config: Configuration of entrez. It has to contain list of Genbank identifiers for sequences to download
    :param email: Inform NCBI who you are to contact you in case of excessive use. Otherwise they may block your access directly.
    """
    output:
        reference = protected('reference/{reference}/{reference}.fa'),
        taxonomy = protected('reference/{reference}/{reference}.tax')
    params:
        email = method_config['email'],
	script_path = srcdir('scripts/entrez.py'),
    conda:
        config['snakelines_dir'] + '/environments/entrez.yaml'
    shell:
        """
        python3 {params.script_path}\
            {wildcards.reference}\
            {params.email}\
            {output.reference}\
            {output.taxonomy}
        """

