API Reference
primerdriver.checks.PrimerChecks
__init__(sequence, no_interaction=False)
A set of validation checks to perform on the DNA/protein input before processing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str
|
The input DNA/protein sequence. |
required |
no_interaction
|
Suppress all prompts and use program defaults if not explicitly provided. |
False
|
is_valid_dna()
Check if the self.sequence
contains valid bases [ATCG].
Raises:
Type | Description |
---|---|
PrimerCheckError
|
DNA/protein sequence contains bases/amino acids. |
Returns: The input DNA sequence.
is_valid_gc_content()
Check if the self.sequence
has valid %GC content (determined by settings.json).
Raises:
Type | Description |
---|---|
PrimerCheckError
|
DNA/protein sequence has too little/too much GC content. |
is_valid_protein()
Check if the self.sequence
contains valid amino acids.
Raises:
Type | Description |
---|---|
PrimerCheckError
|
Protein sequence contains invalid amino acids. |
Returns: The input protein sequence.
is_valid_sequence_length()
Check if the self.sequence
is within the allowed processing length (40 <= sequence <= 8000).
Raises:
Type | Description |
---|---|
PrimerCheckError
|
DNA/protein sequence is too short/long. |
primerdriver.checks.SequenceChecks
__init__(sequence)
Set of checks to perform on a generated primer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The generated primer's DNA sequence. |
required |
primerdriver.exceptions.PrimerCheckError
Bases: ValueError
primerdriver.input_handler.interactive_handler()
primerdriver.input_handler.single_command_handler(args)
primerdriver.output_handler.interactive_saver(df)
primerdriver.output_handler.single_command_saver(df, savename)
primerdriver.primer_design.PrimerDesign
calculate_gc_content(seq)
staticmethod
Calculate the GC content of a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq
|
str | list[str]
|
The sequence to calculate the GC content of. |
required |
Returns:
Type | Description |
---|---|
float
|
The %GC content of the sequence. |
calculate_melting_temperature(seq, mutation_type, replacement, gc_content, mismatch)
staticmethod
Calculate the melting temperature of a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq
|
str | list[str]
|
The sequence to calculate the melting temperature of. |
required |
mutation_type
|
MutationType
|
The type of mutation (substitution, insertion, or deletion). |
required |
replacement
|
str | list[str]
|
The replacement sequence for the mutation. |
required |
gc_content
|
float
|
The %GC content of the sequence. |
required |
mismatch
|
float
|
The base mismatch percentage of the sequence. |
required |
Returns:
Type | Description |
---|---|
float
|
The melting temperature of the sequence in degrees Celsius. |
calculate_mismatch(seq, mismatched_bases)
staticmethod
Calculate the base mismatch percentage of a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq
|
str | list[str]
|
The sequence to calculate the mismatch percentage of. |
required |
mismatched_bases
|
int
|
The number of mismatched bases in the sequence. |
required |
Returns:
Type | Description |
---|---|
float
|
The base mismatch percentage of the sequence. |
characterize_primer(sequence, mutation_type, replacement, mismatched_bases, index=None, reverse=None)
Characterize a primer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The sequence of the primer. |
required |
mutation_type
|
MutationType
|
The type of mutation (substitution, insertion, or deletion). |
required |
replacement
|
str | list[str] | None
|
The replacement sequence for the mutation. |
required |
mismatched_bases
|
int
|
The number of mismatched bases in the sequence. |
required |
index
|
int | None
|
The index of the primer in the list of primers. |
None
|
reverse
|
list[str] | None
|
The reverse complement of the sequence. |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
A DataFrame containing the characteristics of the primer. |
deletion(sequence, mutation_type, target, replacement, start_position, mismatched_bases)
Perform a deletion mutation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The sequence of the primer. |
required |
mutation_type
|
MutationType
|
The type of mutation. |
required |
target
|
str | list[str] | None
|
The target sequence. |
required |
replacement
|
str | list[str]
|
The replacement sequence. |
required |
start_position
|
int
|
The starting position of the mutation. |
required |
mismatched_bases
|
int
|
The number of mismatched bases. |
required |
Returns:
Type | Description |
---|---|
DataFrame | None
|
A DataFrame containing the characteristics of the generated primer(s). |
dna_based()
DNA based primer design.
get_reverse_complement(seq)
Get the reverse complement of a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq
|
str | list[str]
|
The sequence to get the reverse complement of. |
required |
Returns:
Type | Description |
---|---|
list[str]
|
The reverse complement of the sequence. |
insertion(sequence, mutation_type, target, replacement, start_position, mismatched_bases)
Perform an insertion mutation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The sequence to mutate. |
required |
mutation_type
|
MutationType
|
The type of mutation to perform. |
required |
target
|
str | list[str] | None
|
The target sequence to insert into the sequence. |
required |
replacement
|
str | list[str]
|
The sequence to insert into the sequence. |
required |
start_position
|
int
|
The position to start the mutation. |
required |
mismatched_bases
|
int
|
The number of mismatched bases in the sequence. |
required |
Returns:
Type | Description |
---|---|
DataFrame | None
|
A DataFrame containing the characteristics of the generated primer(s). |
is_gc_end(sequence)
staticmethod
Check if a sequence starts/ends in G or C.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The sequence to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the sequence starts/ends in G or C, False otherwise. |
protein_based()
Protein based primer design.
substitution(sequence, mutation_type, target, replacement, start_position, mismatched_bases)
Performs a substitution mutation on a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
str | list[str]
|
The sequence to mutate. |
required |
mutation_type
|
MutationType
|
The type of mutation (substitution, insertion, or deletion). |
required |
target
|
str | list[str] | None
|
The target of the mutation. |
required |
replacement
|
str | list[str]
|
The replacement sequence for the mutation. |
required |
start_position
|
int
|
The starting position of the mutation. |
required |
mismatched_bases
|
int
|
The number of mismatched bases in the sequence. |
required |
Returns:
Type | Description |
---|---|
DataFrame | None
|
A DataFrame containing the characteristics of the generated primer(s). |
primerdriver.primer_design.OperationMode
Bases: Enum
CHARACTERIZATION = 'CHAR'
class-attribute
instance-attribute
DNA = 'DNA'
class-attribute
instance-attribute
PROTEIN = 'PRO'
class-attribute
instance-attribute
primerdriver.primer_design.MutationType
Bases: Enum
DELETION = 'D'
class-attribute
instance-attribute
INSERTION = 'I'
class-attribute
instance-attribute
SUBSTITUTION = 'S'
class-attribute
instance-attribute
primerdriver.primer_design.PrimerMode
Bases: Enum