AnoPrimer API#

This notebook provides an overview of the API for the AnoPrimer python package, to design primers in Anopheles mosquitoes whilst considering genomic variation.

design_primers()#

AnoPrimer.design_primers(species, assay_type, assay_name, target, min_amplicon_size, max_amplicon_size, n_primer_pairs, primer_parameters, cDNA_exon_junction=True)#

Run whole AnoPrimer workflow to design primers/probes

Parameters
  • species (str) – The species to design primers for. Either ‘gambiae_sl’ or ‘funestus’

  • assay_type ({'gDNA primers', 'cDNA primers', 'gDNA primers + probe', 'probe}, str) – The type of oligos we wish to design. If ‘gDNA primers’ or ‘cDNA primers’ are specified, then only primers will be designed. If ‘gDNA primers + probe’ is specified, then primers and a probe will be designed. If ‘probe’ is specified, then only an internal probe will be designed.

  • assay_name (str) – A name to give the assay, used for naming output files.

  • min_amplicon_size (int) – The minimum size of the amplicon we wish to design primers for.

  • max_amplicon_size (int) – The maximum size of the amplicon we wish to design primers for. cDNA primers for gene expression assays should be designed with a max amplicon size of ~120.

  • n_primer_pairs (int) – The number of primer pairs to design.

  • target (str) – The target to design primers for. For gDNA primers, this should be a contig:position string, for example ‘2L:28545767’. For cDNA primers, this should be an AGAP identifier.

  • primer_parameters (dict or 'default') – A dictionary of primer3 parameters to use for primer design. If ‘default’ is specified, default primer3 parameters will be generated.

  • cDNA_exon_junction (bool, optional) –

    If True, cDNA primers will be designed to span an exon-exon junction. We strongly recommend that this is set to True. In the case of gDNA primers, this parameter is ignored.

    returns

    An AnoPrimerResults object containing the results of the primer design.

    rtype

    AnoPrimerResults

evaluate_primers()#

AnoPrimerResults.evaluate_primers(self, sample_sets, sample_query=None, out_dir=None, legend_loc='best', assembly='anoGam3')#

Evaluate the designed primers by plotting SNP frequencies and primer locations.

This method generates plots of SNP frequencies for each primer pair and the locations of the primers in relation to nearby exons on the genome. It also performs a BLAT alignment of the primers to the genome using the gget library.

Parameters
  • sample_sets (str or list) – Sample set identifier(s) to use for frequency calculation.

  • sample_query (str) – A pandas query string to filter the samples.

  • out_dir (str) – Directory to save the output files.

  • legend_loc (str, optional) – Location of the legend in the plot. Default is “best”.

  • assembly (str, optional) – The genome assembly to use with BLAT. Default is “anoGam3”.

plot_primer_snp_frequencies()#

AnoPrimerResults.plot_primer_snp_frequencies(self, sample_sets, sample_query=None, out_dir=None)#

Plot SNP frequencies for each primer pair.

This method retrieves allele frequency data for each primer pair and generates a plot using the Plotly library.

Parameters
  • sample_sets (str or list) – Sample set identifier(s) to use for frequency calculation.

  • sample_query (str, optional) – A pandas query string to filter the samples.

  • out_dir (str, optional) – Directory to save the output files. If None, files are not saved.

Returns

A dictionary containing the frequency data for each primer pair.

Return type

dict

plot_primer_locs()#

AnoPrimerResults.plot_primer_locs(self, legend_loc='best', out_dir=None)#

Plot the positions of primer sets in relation to nearby exons.

This method generates a matplotlib figure showing the locations of primers and nearby exons on the genome.

Parameters
  • legend_loc (str, optional) – Location of the legend in the plot. Default is “best”.

  • out_dir (str, optional) – Directory to save the output files. If None, files are not saved.

gget_blat_genome()#

AnoPrimerResults.gget_blat_genome(self, assembly='anoGam3')#

Align primers to the genome using BLAT.

This method uses the gget library to perform BLAT alignment of the designed primers against the specified genome assembly.

Parameters

assembly (str, optional) – The genome assembly to use with BLAT. Default is “anoGam3”.

Returns

A DataFrame containing BLAT alignment results, or None if no hits found.

Return type

pd.DataFrame or None

check_my_oligo()#

AnoPrimer.check_my_oligo(sequence, sample_sets='3.0', sample_query=None, width=700, height=400)#

Align a sequence to AgamP3, retrieve ag3 frequencies in this region and plot. Only works with An.gambiae_sl for now.

plot_sequence_frequencies()#

AnoPrimer.plot_sequence_frequencies(data_resource, region, sample_sets=None, sample_query=None, width=700, height=400)#

Retrieve frequencies

primer_params()#

AnoPrimer.primer_params(assay_type, primer_parameters=None, n_primer_pairs=None, amplicon_size_range=None, generate_defaults=False)#

adds necessary parameters depending on assay_type, or can generate the default parameters

Parameters
  • assay_type (str) – The type of assay, either ‘gDNA primers’ or ‘gDNA primers + probe’, ‘cDNA primers’ or ‘probe’

  • primer_parameters (dict) – A dictionary of primer3 parameters to use for primer design. If ‘default’ is specified, default primer3 parameters will be generated.

  • n_primer_pairs (int) – The number of primer pairs to design.

  • amplicon_size_range (list) – The minimum and maximum size of the amplicon to design primers for

  • generate_defaults (bool) – If True, default primer3 parameters will be generated.

primer3_to_pandas()#

AnoPrimer.primer3_to_pandas(primer_dict, assay_type)#

Convert primer3 results to pandas dataframe

Parameters
  • primer_dict (dict) – The primer3 results dictionary returned by primer3.designPrimers()

  • assay_type (str) – The type of assay, either ‘gDNA primers’ or ‘gDNA primers + probe’, ‘cDNA primers’ or ‘probe’

Returns

primer_df – A pandas DataFrame containing the primer sequences and their information.

Return type

pandas.DataFrame

primer3_run_statistics()#

AnoPrimer.primer3_run_statistics(primer_dict, assay_type)#

Prints out primer3 run statistics from the primer3 results dictionary.

Parameters
  • primer_dict (dict) – The primer3 results dictionary returned by primer3.designPrimers()

  • assay_type (str) – The type of assay, either ‘gDNA primers’ or ‘gDNA primers + probe’, ‘cDNA primers’ or ‘probe’