Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Klinische Genetica
prinia
Commits
e451eef4
Commit
e451eef4
authored
Aug 09, 2017
by
Sander Bollen
Browse files
expose new options in primerdesign
parent
8e4ba82e
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
e451eef4
...
...
@@ -55,6 +55,10 @@ usage: primerdesign [-h] (-l LOVD | --region REGION) [-p PADDING]
[-f FIELD] [-af ALLELE_FREQ] [-fq1 FQ1] [-fq2 FQ2] -R
REFERENCE --dbsnp DBSNP --primer3 PRIMER3 [--bwa BWA]
[--samtools SAMTOOLS] [--ignore-errors]
[--opt-primer-length OPT_PRIMER_LENGTH]
[--opt-gc-perc OPT_GC_PERC]
[--min-melting-temperature MIN_MELTING_TEMPERATURE]
[--max-melting-temperature MAX_MELTING_TEMPERATURE]
optional arguments:
-h, --help show this help message and exit
...
...
@@ -77,11 +81,7 @@ optional arguments:
--strict Enable strict mode. Primers with products larger than
max product size will NOT be returned
--n_raw_primers N_RAW_PRIMERS
Amount of raw primers from primer3 output that will be
considered. By default, only the top 4 primers (in
each direction) will be considered. Increasing this
value does not mean more primers will be returned; it
simply increases the search space.
Legacy option. Will be ignored
--m13 Output primers with m13 tails
--m13-forward M13_FORWARD
Sequence of forward m13 tail
...
...
@@ -104,6 +104,14 @@ optional arguments:
--bwa BWA Path to BWA exe
--samtools SAMTOOLS Path to samtools exe
--ignore-errors Ignore errors
--opt-primer-length OPT_PRIMER_LENGTH
Optimum primer length (default = 25)
--opt-gc-perc OPT_GC_PERC
Optimum primer GC percentage (default = 50)
--min-melting-temperature MIN_MELTING_TEMPERATURE
Minimum primer melting temperature (default = 58)
--max-melting-temperature MAX_MELTING_TEMPERATURE
Maximum primer melting temperature (default = 62)
```
...
...
prinia/design.py
View file @
e451eef4
...
...
@@ -35,7 +35,8 @@ def get_sequence_fasta(region, reference=None, padding=True):
def
run_primer3
(
sequence
,
region
,
padding
=
True
,
primer3_script
=
PRIMER3_SCRIPT
,
product_size
=
"200-450"
,
n_primers
=
4
,
prim3_exe
=
None
):
n_primers
=
4
,
prim3_exe
=
None
,
**
kwargs
):
"""Run primer 3. All other kwargs will be passed on to primer3"""
if
padding
:
target_start
=
region
.
padding_left
target_len
=
len
(
sequence
)
-
region
.
padding_left
-
region
.
padding_right
...
...
@@ -45,7 +46,7 @@ def run_primer3(sequence, region, padding=True,
target
=
","
.
join
(
map
(
str
,
[
target_start
,
target_len
]))
p3
=
Primer3
(
prim3_exe
,
sequence
,
target
,
target
)
p3
=
Primer3
(
prim3_exe
,
sequence
,
target
,
target
,
**
kwargs
)
p3_out
=
p3
.
run
()
primers
=
parse_primer3_output
(
p3_out
)
return
primers
...
...
@@ -331,7 +332,9 @@ def chop_region(region, size):
def
get_primer_from_region
(
region
,
reference
,
product_size
,
n_prims
,
bwa_exe
,
samtools_exe
,
primer3_exe
,
output_bam
=
None
,
dbsnp
=
None
,
field
=
None
,
max_freq
=
None
,
strict
=
False
,
min_margin
=
10
):
max_freq
=
None
,
strict
=
False
,
min_margin
=
10
,
**
prim_args
):
"""**prim_args will be passed on to primer3"""
min_length
,
max_length
=
list
(
map
(
int
,
product_size
.
split
(
"-"
)))
regions
=
chop_region
(
region
,
min_length
)
...
...
@@ -345,7 +348,8 @@ def get_primer_from_region(region, reference, product_size, n_prims,
sequence
=
get_sequence_fasta
(
reg
,
reference
=
reference
)
raw_primers
=
run_primer3
(
sequence
,
reg
,
padding
=
True
,
product_size
=
product_size
,
n_primers
=
n_prims
,
prim3_exe
=
primer3_exe
)
n_primers
=
n_prims
,
prim3_exe
=
primer3_exe
,
**
prim_args
)
bam
=
aln_primers
(
raw_primers
,
bwa_exe
=
bwa_exe
,
samtools_exe
=
samtools_exe
,
ref
=
reference
,
output_bam
=
output_bam
)
prims
=
find_best_bwa
(
bam
,
region
=
reg
,
dbsnp
=
dbsnp
,
field
=
field
,
max_freq
=
max_freq
)
...
...
prinia/primerdesign.py
View file @
e451eef4
...
...
@@ -19,7 +19,9 @@ __author__ = 'ahbbollen'
def
primers_from_lovd
(
lovd_file
,
padding
,
product_size
,
n_prims
,
reference
,
bwa_exe
,
samtools_exe
,
primer3_exe
,
output_bam
,
dbsnp
,
field
,
max_freq
,
m13
=
False
,
m13_f
=
""
,
m13_r
=
""
,
strict
=
False
,
min_margin
=
10
,
ignore_errors
=
False
):
strict
=
False
,
min_margin
=
10
,
ignore_errors
=
False
,
**
prim_args
):
"""**prim_args will be passed on to primer3"""
variants
=
var_from_lovd
(
lovd_file
)
primers
=
[]
...
...
@@ -32,7 +34,8 @@ def primers_from_lovd(lovd_file, padding, product_size, n_prims, reference,
output_bam
=
output_bam
,
dbsnp
=
dbsnp
,
field
=
field
,
max_freq
=
max_freq
,
strict
=
strict
,
min_margin
=
min_margin
)
min_margin
=
min_margin
,
**
prim_args
)
primers
.
append
(
prims
[
0
])
except
NoPrimersException
:
if
ignore_errors
:
...
...
@@ -48,7 +51,9 @@ def primers_from_lovd(lovd_file, padding, product_size, n_prims, reference,
def
primers_from_region
(
bed_path
,
padding
,
product_size
,
n_prims
,
reference
,
bwa_exe
,
samtools_exe
,
primer3_exe
,
output_bam
,
dbsnp
,
field
,
max_freq
,
m13
=
False
,
m13_f
=
""
,
m13_r
=
""
,
strict
=
False
,
min_margin
=
10
):
m13_r
=
""
,
strict
=
False
,
min_margin
=
10
,
**
prim_args
):
"""**prim_args will be passed on to primer3"""
regions
=
[]
primers
=
[]
with
open
(
bed_path
,
"rb"
)
as
bed
:
...
...
@@ -64,7 +69,8 @@ def primers_from_region(bed_path, padding, product_size, n_prims, reference,
dbsnp
=
dbsnp
,
field
=
field
,
max_freq
=
max_freq
,
strict
=
strict
,
min_margin
=
min_margin
)
min_margin
=
min_margin
,
**
prim_args
)
regions
+=
regs
primers
+=
prims
...
...
@@ -139,10 +145,7 @@ def main():
parser
.
add_argument
(
"--strict"
,
help
=
"Enable strict mode. "
"Primers with products larger than max product size will NOT be returned"
,
action
=
"store_true"
)
parser
.
add_argument
(
'--n_raw_primers'
,
help
=
"Amount of raw primers from primer3 output that will be considered.
\
By default, only the top 4 primers (in each direction) will be considered.
\
Increasing this value does not mean more primers
\
will be returned; it simply increases the search space."
,
parser
.
add_argument
(
'--n_raw_primers'
,
help
=
"Legacy option. Will be ignored"
,
default
=
4
,
type
=
int
)
parser
.
add_argument
(
'--m13'
,
action
=
"store_true"
,
help
=
"Output primers with m13 tails"
)
...
...
@@ -167,6 +170,19 @@ def main():
parser
.
add_argument
(
"--ignore-errors"
,
help
=
"Ignore errors"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--opt-primer-length"
,
help
=
"Optimum primer length (default = 25)"
,
type
=
int
,
default
=
25
)
parser
.
add_argument
(
"--opt-gc-perc"
,
help
=
"Optimum primer GC percentage (default = 50)"
,
type
=
int
,
default
=
50
)
parser
.
add_argument
(
"--min-melting-temperature"
,
help
=
"Minimum primer melting temperature (default = 58)"
,
type
=
int
,
default
=
58
)
parser
.
add_argument
(
"--max-melting-temperature"
,
help
=
"Maximum primer melting temperature (default = 62)"
,
type
=
int
,
default
=
62
)
args
=
parser
.
parse_args
()
if
not
args
.
lovd
and
not
args
.
region
:
...
...
@@ -181,6 +197,15 @@ def main():
if
args
.
field
and
not
args
.
allele_freq
:
raise
ValueError
(
"Must set an allele frequency"
)
primer_args
=
{
"opt_primer_length"
:
args
.
opt_primer_length
,
"opt_gc_perc"
:
args
.
opt_gc_perc
,
"min_melting_t"
:
args
.
min_melting_temperature
,
"max_melting_t"
:
args
.
max_melting_temperature
,
"min_product_size"
:
int
(
args
.
product_size
.
split
(
"-"
)[
0
]),
"max_product_size"
:
int
(
args
.
product_size
.
split
(
"-"
)[
1
])
}
primers
=
[]
if
args
.
lovd
and
args
.
xml
:
variants
,
primers
=
primers_from_lovd
(
args
.
lovd
,
args
.
padding
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment