Giter Club home page Giter Club logo

prinia's Introduction

PRINIA

Prinia is a python package for designing primers from genomic regions or LOVD import format files.

Requirements

Python version

3.5+

Python packages

  • future >= 0.15.2
  • biopython >= 1.66
  • lxml >= 3.4.4
  • pyfaidx >= 0.4.4
  • pyvcf >= 0.6.7
  • jsonschema >= 2.6.0
  • Jinja2 >= 2.9.5

Other dependencies

You must have a recent version of primer3, samtools and bwa

Installation

It is recommended you use a virtual environment, such that the risk of dependency hell is minimized.

After creating your virtualenv, clone this repository. Install all the required python packages with:

pip install -r requirements.txt

Then install PRINIA with:

python setup.py install

Primer design

A primerdesign tool will be be added to your path upon installation of prinia. This tool will generate your primers from BED records (regions) or LOVD import file format files.

Help

usage: primerdesign [-h] (-l LOVD | --region REGION) [-p PADDING]
                    (-x XML | -t TSV) -b BAM [-s SAMPLE]
                    [--min-margin MIN_MARGIN] [--strict] [--m13]
                    [--m13-forward M13_FORWARD] [--m13-reverse M13_REVERSE]
                    [-f FIELD] [-af ALLELE_FREQ] [-fq1 FQ1] [-fq2 FQ2] -R
                    REFERENCE [--dbsnp DBSNP] --primer3 PRIMER3 [--bwa BWA]
                    [--samtools SAMTOOLS] [--settings-json SETTINGS_JSON]
                    [--thermodynamic-params THERMODYNAMIC_PARAMS]
                    [--ignore-errors]

optional arguments:
  -h, --help            show this help message and exit
  -l LOVD, --lovd LOVD  Input LOVD file
  --region REGION       Input region file
  -p PADDING, --padding PADDING
                        Padding around regions or variants in bases. Defaults
                        to 100
  -x XML, --xml XML     Output Miracle XML file
  -t TSV, --tsv TSV     Output TSV file
  -b BAM, --bam BAM     Path to output BAM file containing primers
  -s SAMPLE, --sample SAMPLE
                        Same ID for regions
  --min-margin MIN_MARGIN
                        Minimum distance from region or variant. Default = 10
  --strict              Enable strict mode. Primers with products larger than
                        max product size will NOT be returned
  --m13                 Output primers with m13 tails
  --m13-forward M13_FORWARD
                        Sequence of forward m13 tail
  --m13-reverse M13_REVERSE
                        Sequence of reverse m13 tail
  -f FIELD, --field FIELD
                        Name of field in DBSNP file for allele frequency
  -af ALLELE_FREQ, --allele-freq ALLELE_FREQ
                        Max accepted allele freq
  -fq1 FQ1              Path to forward fastq file for primer output. Set if
                        you want to export your primers in fastq format
                        (qualities will be sanger-encoded 40)
  -fq2 FQ2              Path to reverse fastq file for primer output. Set if
                        you want to export your primers in fastq format
                        (qualities will be sanger-encoded 40)
  -R REFERENCE, --reference REFERENCE
                        Path to reference fasta file
  --dbsnp DBSNP         Path to DBSNP vcf
  --primer3 PRIMER3     Path to primer3_core exe
  --bwa BWA             Path to BWA exe
  --samtools SAMTOOLS   Path to samtools exe
  --settings-json SETTINGS_JSON
                        Optional path to primer3 settings json file.
  --thermodynamic-params THERMODYNAMIC_PARAMS
                        Optional path to primer3 thermodynamic parameters
                        location
  --ignore-errors       Ignore errors

Usage

primerdesign requires either the -l or --region arguments for input.

  • -l : LOVD import file format
  • --region: BED track

When --region is used, a sample name must be given with -s <sample>.

It will output in either of the following two formats with the -x and -t arguments:

  • -x: Miracle XML
  • -t: BED-like tab-delimited format

The following arguments are mandatory:

  • -R: path to reference fasta. This fasta must have a .fai index. Generate this with samtools faidx <fasta>
  • --dbsnp: Path to DBSNP VCF file
  • --primer3: Path to primer 3 executable.

Recommended arguments:

  • --samtools: Path to samtools. If not given, will simply assume samtools is on the PATH.
  • --bwa: Path to bwa. If not given, will simply assume bwa is on the PATH.

Primer3 settings

Some settings that are passed on to primer3 can be provided with a json file. Said json file must conform to the json schema provided here. A validation error is thrown if the provided json does not conform to the schema.

Parameters not given in the settings file are supplied default values. In case no settings file is given at all, only the default values are used.

The schema defines all default values. For convenience, they are listed here as well:

parameter explanation default
primer_min_gc Minimum GC-percentage of primers 20
primer_internal_min_gc Equivalent parameter of primer_min_gc for the internal oligo. 20
primer_opt_gc_percent Optimum GC-percentage of primers 50
primer_internal_opt_gc_percent Equivalent parameter of primer_opt_gc_percent for the internal oligo 50
primer_max_gc Maximum GC-percentage of primers. 80
primer_internal_max_gc Equivalent parameter of primer_max_gc for the internal oligo. 80
primer_wt_gc_percent_lt Penalty weight for primers with GC-percentage lower than primer_opt_gc_percent 0
primer_internal_wt_gc_percent_lt Equivalent parameter of primer_wt_gc_percent_lt for the interal oligo. 0
primer_wt_gc_percent_gt Penalty weight for primers with GC-percentage higher than primer_opt_gc_percent 0
primer_internal_wt_gc_percent_gt Equivalent parameter of primer_wt_gc_percent_gt for the internal oligo. 0
primer_gc_clamp Require the specified number of consecutive Gs and Cs at the 3' end of both the left and right primer. 0
primer_max_end_gc The maximum number of Gs or Cs allowed in the last five 3' bases of a left or right primer. 5
primer_opt_size Optimum size of primers in bases. 25
primer_min_size Minimum size of primers in bases. 20
primer_max_size Maximum size of primers in bases. 30
primer_max_ns_accepted Maximum number of unknown bases (N) accepted in a primer 0
primer_product_size_range Accepted size range of the product size. 200-450
primer_product_opt_size Optimum size of product. Will default to the midpoint in primer_product_size_range unless specified 325
primer_pair_wt_product_size_gt Penalty weight for products larger than primer_product_opt_size 0.1
primer_pair_wt_product_size_lt Penalty weight for products smaller than primer_product_opt_size 0.1
primer_min_tm Minimum melting temperature of primer in degrees Celsius 58
primer_opt_tm Optimum melting temperature of primer in degrees Celcius 60
primer_max_tm Maximum melting temperature in degrees Celsius 62
primer_pair_max_diff_tm Maximum acceptable difference in melting temperature between primers 100
primer_max_hairpin_th 47
primer_num_return Number of returned primers. Increase to increase search space 200

Some example configuration files can be found here, here and here.

Known issues

  1. In some cases, no suitable primer pair can be found. If primerdesign fails with a NoPrimersException you can try to increase the padding.

prinia's People

Contributors

sndrtj avatar zamaudio avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar Guy Allard avatar Giannis Moustakas avatar  avatar Davy Cats avatar  avatar Leon Mei avatar  avatar

Forkers

zamaudio

prinia's Issues

Primer3 crashes with exit code 255 when installed via conda

When installed via conda, the primer3 call ends with exit code 255.
The output file will contain the following message

Error: thermodynamic approach chosen, but path to thermodynamic parameters not specified

This is due to conda installing the thermodynamic parameter configuration files in a non-standard location. The primer3 executable will look in two locations:

  1. /opt/primer3_config
  2. ./primer3_config

Conda installs those files in $CONDA_ENV/share/primer3/primer3_config.

Debian-based systems on apt will actually install the files in /etc/primer3_config, but Debian has pacthed primer3 to look there as well.

We can set an extra parameter PRIMER_THERMODYNAMIC_PARAMETERS_PATH to force primer3 to find its thermodynamic parameter configuration files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.