Repeat code documentation
发布时间:2026-10-01 | 浏览:1
Table of Contents
Repeat code documentation repeat repeat_align repeat_exon repeat_io repeat_pvalue repeat_score
HMM code documentation
Repeat_list code documentation
The repeat submodule documentation.
The Repeat Class.
Tandem repeats are consecutive copies of genomic sequence.
A tandem repeat is stored in terms of a multiple sequence alignment of its tandem repeat units. For example, the amino acid tandem repeat KLMKLMKLKLM can be displayed as a multiple sequence alignment (here: “multiple repeat unit alignment”) KLM KLM KL- KLM and can be stored as [“KLM”, “KLM”, “KL-“, “KLM”]. The - char stands for a gap: It indicates that either, there used to be a char at the same position, but it got deleted. Or, all other chars in the same column got inserted at some point.
For research on tandem repeats, many different statistics need to be calculated on the multiple sequence alignment of the tandem repeat.
[Description of these statistics]
The original alignment of repeat units.
The alignment of repeat units without rare chars.
The transposed alignment of repeat units. E.g. [“KKKK”, “LLLL”, “MM-M”].
The number of repeat units in the original msa. E.g. 4.
The length of the repeat units in the original msa. E.g. 3.
The number of columns in the original msa not counting insertion columns (i.e. columns with more gaps than chars).
The number of chars in the MSA without insertion columns divided by n_effective.
The repeat region of the tandem repeats (e.g. all chars in the MSA without gaps concatenated.)
The number of gaps in msa
The lengths of text
formerly named: set_begin
Calculate the effective number of repeat units n_effective
Calculate the number of letters in in all non-insertion columns, divided by <l_effective>
self ( Repeat instance ) –
Calculate pvalues on a Repeat instance.
Calculate pvalues on a Repeat instance for all scores in scoreslist .
self ( Repeat ) – An instance of the repeat class.
scoreslist(list of Str): A list of the names of the scores (e.g. [“phylo_gap01”]) for which p-Values are calculated on the Repeat instance self
Calculate scores on a Repeat instance.
Calculate scores on a Repeat instance for all scores in scoreslist .
self ( Repeat ) – An instance of the repeat class.
[“phylo_gap01”]) that are calculated on the Repeat instance self
Read tandem repeat from file.
Read tandem repeat from file (currently, only pickle is supported)
format ( str ) – Currently only “pickle”
format ( str ) – Currently only “pickle”
file ( str ) – Path to output file
file ( str ) – Path to output file
Write checks for format and file .
Can repeat_io.read_fasta be replaced by e.g. BioPython seqIO?
without insertion columns.
We define insertion columns as columns where there are more or equal gaps compared to chars. These columns are removed from both msa to create msaD and msaT to create msaTD .
Calculate the number and length of insertions and deletions for this tandem repeat.
alignment msaTD
how many deletions of what length begin in this column?: deletion_lengths`[`iColumn ] = list of deletion lengths
deletion_lengths`[`iColumn ] = list of deletion lengths
how many insertions of what length begin in potential insertion columns before this column?: insertion_lengths`[`iColumn ] = list of insertion lengths
how many insertions of what length begin in potential insertion columns before this column?: insertion_lengths`[`iColumn ] = list of insertion lengths
self ( Repeat ) – An instance of the repeat class.
Update of tandem repeat MSA.
self ( Repeat instance ) –
self ( Repeat instance ) –
realignment ( str ) – either “proPIP” or “mafft”
realignment ( str ) – either “proPIP” or “mafft”
rate_distribution ( str ) – either “constant” or “gamma” (per default value from REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’])
rate_distribution ( str ) – either “constant” or “gamma” (per default value from REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’])
recalculate the original msa, assuming that begin is defined correctly (index starting counting on 1.) This function might be obsolete when the original MSA is saved from the beginning.
Write tandem repeat to file.
Write tandem repeat to file using one of three formats.
file ( str ) – Path to input file
file ( str ) – Path to input file
file_format ( str ) – Either “fasta”, “pickle” or “stockholm”
file_format ( str ) – Either “fasta”, “pickle” or “stockholm”
Write checks for format and file .
Calculate the index of the begin and the end of a TR within an alignment returns
begin ( int ) – (needs explaining)
begin ( int ) – (needs explaining)
length ( int ) – (needs explaining)
length ( int ) – (needs explaining)
alignment – (needs explaining)
alignment – (needs explaining)
Alignment of tandem repeat units.
Realignment of a repeat MSA using mafft or proPIP
A good multiple sequence alignment (MSA) is an important description of a tandem repeat (TR) and can be crucial to distinguish a true positive from a false positive TR. This can be realised using a proper MSA estimation algorithm. Currently, Mafft and proPIP can be used to realign a TR.
REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’] == ‘constant’: no gamma distribution is used for the proPIP algorithm
REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’] == ‘constant’: no gamma distribution is used for the proPIP algorithm
REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’] == ‘gamma’: gamma distribution (n=6, alpha=0.5)
REPEAT_CONFIG[‘castor_parameter’][‘rate_distribution’] == ‘gamma’: gamma distribution (n=6, alpha=0.5)
my_msa ( list of strings ) – List of sequences (str)
my_msa ( list of strings ) – List of sequences (str)
realignment ( str ) – Either “mafft” or “proPIP”
realignment ( str ) – Either “mafft” or “proPIP”
sequence_type ( str ) – Either “AA” or “DNA”
sequence_type ( str ) – Either “AA” or “DNA”
user_path ( str ) – copy alignment files to user defined path
user_path ( str ) – copy alignment files to user defined path
my_msa realigned (list of strings)
decide what happens if branch length of tree is getting zero
decide what happens if branch length of tree is getting zero
helper function to remove a character in a sequence
Remove columns in a MSA which contain only gaps. Do not use MSA longer than 3000 characters.
Returns the MSA as a list without only-gap-containing columns.
msa ( list of strings ) – List of sequences (str)
msa (list of strings) with removed colums in case they only contain gaps
Calculate diverse exon measures
Exon structure parameters: # exon_structure = [{‘Exon Chr End (bp)’: ‘43478424’, ‘Exon Chr Start (bp)’: ‘43477252’, ‘CDS End’: ‘272’, ‘CDS Start’: ‘1’}, {‘Exon Chr End (bp)’: ‘43476658’, ‘Exon Chr Start (bp)’: ‘43476498’, ‘CDS End’: ‘433’, ‘CDS Start’: ‘273’}, {‘Exon Chr End (bp)’: ‘43476158’, ‘Exon Chr Start (bp)’: ‘43476036’, ‘CDS End’: ‘556’, ‘CDS Start’: ‘434’}, {‘Exon Chr End (bp)’: ‘43475664’, ‘Exon Chr Start (bp)’: ‘43475564’, ‘CDS End’: ‘657’, ‘CDS Start’: ‘557’}, {‘Exon Chr End (bp)’: ‘43475416’, ‘Exon Chr Start (bp)’: ‘43475194’, ‘CDS End’: ‘880’, ‘CDS Start’: ‘658’}, {‘Exon Chr End (bp)’: ‘43475046’, ‘Exon Chr Start (bp)’: ‘43474707’, ‘CDS End’: ‘951’, ‘CDS Start’: ‘881’}]
Exon structure parameters: # exon_structure = [{‘Exon Chr End (bp)’: ‘43478424’, ‘Exon Chr Start (bp)’: ‘43477252’, ‘CDS End’: ‘272’, ‘CDS Start’: ‘1’}, {‘Exon Chr End (bp)’: ‘43476658’, ‘Exon Chr Start (bp)’: ‘43476498’, ‘CDS End’: ‘433’, ‘CDS Start’: ‘273’}, {‘Exon Chr End (bp)’: ‘43476158’, ‘Exon Chr Start (bp)’: ‘43476036’, ‘CDS End’: ‘556’, ‘CDS Start’: ‘434’}, {‘Exon Chr End (bp)’: ‘43475664’, ‘Exon Chr Start (bp)’: ‘43475564’, ‘CDS End’: ‘657’, ‘CDS Start’: ‘557’}, {‘Exon Chr End (bp)’: ‘43475416’, ‘Exon Chr Start (bp)’: ‘43475194’, ‘CDS End’: ‘880’, ‘CDS Start’: ‘658’}, {‘Exon Chr End (bp)’: ‘43475046’, ‘Exon Chr Start (bp)’: ‘43474707’, ‘CDS End’: ‘951’, ‘CDS Start’: ‘881’}]
Functions to check whether the exon structure and the repeat unit structure are correlated.
Exon structure parameters: # exon_structure = [{‘Exon Chr End (bp)’: ‘43478424’, ‘Exon Chr Start (bp)’: ‘43477252’, ‘CDS End’: ‘272’, ‘CDS Start’: ‘1’}, {‘Exon Chr End (bp)’: ‘43476658’, ‘Exon Chr Start (bp)’: ‘43476498’, ‘CDS End’: ‘433’, ‘CDS Start’: ‘273’}, {‘Exon Chr End (bp)’: ‘43476158’, ‘Exon Chr Start (bp)’: ‘43476036’, ‘CDS End’: ‘556’, ‘CDS Start’: ‘434’}, {‘Exon Chr End (bp)’: ‘43475664’, ‘Exon Chr Start (bp)’: ‘43475564’, ‘CDS End’: ‘657’, ‘CDS Start’: ‘557’}, {‘Exon Chr End (bp)’: ‘43475416’, ‘Exon Chr Start (bp)’: ‘43475194’, ‘CDS End’: ‘880’, ‘CDS Start’: ‘658’}, {‘Exon Chr End (bp)’: ‘43475046’, ‘Exon Chr Start (bp)’: ‘43474707’, ‘CDS End’: ‘951’, ‘CDS Start’: ‘881’}]
Input/output for tandem repeats.
Simulate evolved sequences with ALF.
Simulate evolved sequences with ALF: Dalquen, D. A., Anisimova, M., Gonnet, G. H. & Dessimoz, C. ALF–a simulation framework for genome evolution. Molecular Biology and Evolution 29, 1115–1123 (2012).
l ( int ) – The length of the repeat unit
l ( int ) – The length of the repeat unit
n ( int ) – The number of repeat units in the tandem repeat
n ( int ) – The number of repeat units in the tandem repeat
n_samples ( int ) – The number of samples
n_samples ( int ) – The number of samples
sequence_type ( str ) – Either “AA” or “DNA”
sequence_type ( str ) – Either “AA” or “DNA”
job_id ( str ) – A tag for files produces with ALF, and result files.
job_id ( str ) – A tag for files produces with ALF, and result files.
mutation_rate ( float ) – The mutation rate.
mutation_rate ( float ) – The mutation rate.
tree ( str ) – The type of tree, e.g. “star” or “birthdeath”
tree ( str ) – The type of tree, e.g. “star” or “birthdeath”
indel_rate_per_site ( int or False ) – The indel rate per site.
indel_rate_per_site ( int or False ) – The indel rate per site.
return_type ( str ) – Either “repeat” or “list”
return_type ( str ) – Either “repeat” or “list”
sequence_length ( int ) – The total length of the simulated sequence
sequence_length ( int ) – The total length of the simulated sequence
Return type depends on return_type : Repeat or Bio.Seq.Seq instance.
Simulate random sequence locally.
Simulate random sequence locally.
n_samples ( int ) – The number of samples
n_samples ( int ) – The number of samples
sequence_type ( str ) – Either “AA” or “DNA”
sequence_type ( str ) – Either “AA” or “DNA”
return_type ( str ) – Either “repeat” or “list”
return_type ( str ) – Either “repeat” or “list”
equilibrium_frequencies ( str ) – Only “human” option available at current
equilibrium_frequencies ( str ) – Only “human” option available at current
l ( int ) – The length of the repeat unit
l ( int ) – The length of the repeat unit
n ( int ) – The number of repeat units in the tandem repeat
n ( int ) – The number of repeat units in the tandem repeat
sequence_length ( int ) – The total length of the simulated sequence
sequence_length ( int ) – The total length of the simulated sequence
Return type depends on return_type .
Read repeat from file in fasta format.
Read repeat from file in fasta format.
seq_filename ( str ) – Path to the repeats containing fasta file
seq_filename ( str ) – Path to the repeats containing fasta file
sequence_type ( str ) – Either “AA” or “DNA”
sequence_type ( str ) – Either “AA” or “DNA”
A list of Repeat instances.
(list of Repeat)
save multiple <tandem_repeats> in Fasta format in specified <file>
At current, only one TR per sequence can be defined, as the identifiers in the dict <tandem_repeats> must be unique.
e.g. {‘ENSP00012’: msa1, ‘ENSP00013’: msa2}
>ID GHKI GHKI GH–
save <tandem_repeat> in STOCKHOLM format in specified <file>
e.g. [“ACDEF-“, “ACCDEF”]
More information in ftp://selab.janelia.org/pub/software/hmmer3/3.0/Userguide.pdf STOCKHOLM Format Example:
# STOCKHOLM 1.0 seq1 ACDEF…GHIKL seq2 ACDEF…GHIKL seq3 …EFMNRGHIKL
seq1 MNPQTVWY seq2 MNPQTVWY seq3 MNPQT… //
Save multiple tandem_repeats in T-REKS format in specified file
At current, only one TR per sequence can be defined, as the identifiers in the dict <tandem_repeats> must be unique.
e.g. {‘ENSP00012’: [msa1, begin1], ‘ENSP00013’: [msa2, begin2]}
T-REKS format example:
>a Length: 3 residues - nb: 3 from 1 to 10 - Psim:0.8076923076923077 region Length:42 GHKI GHKI GH– ******************
Length: 3 residues - nb: 2 from 21 to 27 - Psim:0.7857142857142857 region Length:22 GHKI GH– ******************
>b Length: 3 residues - nb: 3 from 1 to 10 - Psim:0.8095238095238095 region Length:20 UIR UIR UIR
repeat_pvalue ¶
The repeat pvalue module.
Create and save a null distribution for repeats scores for p-Value calculation.
You can use a different null distribution for each column of different length for both the parsimony and the pSim score. Therefore, calculate the structure of the TR before you calculate the null distribution of tandem repeat scores of tandem repeats with the same gap distribution.
repeats ( list of Repeat ) – A list of Repeat instances.
repeats ( list of Repeat ) – A list of Repeat instances.
result_file_path ( str ) – Path to result folder.
result_file_path ( str ) – Path to result folder.
file_name ( str ) – Name of result file.
file_name ( str ) – Name of result file.
scoretypes ( list of str ) – List of scores. E.g. [‘phylo’,’phylo_gap’].
scoretypes ( list of str ) – List of scores. E.g. [‘phylo’,’phylo_gap’].
gappy_data ( bool ) – True if any of repeats contain gaps, else False.
gappy_data ( bool ) – True if any of repeats contain gaps, else False.
Calculate the number of columns with a certain number of gaps for each column in a Repeat instance.
You can use a different null distribution for each column of different length for both the parsimony and the pSim score. Therefore, calculate the structure of the TR before you calculate the null distribution of tandem repeat scores of tandem repeats with the same gap distribution.
n ( int ) – The number of repeat units.
n ( int ) – The number of repeat units.
score – The heuristic model used. E.g. “psim”.
score – The heuristic model used. E.g. “psim”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
l_repeat_structure (list) n_repeat_structure (int)
Include exact definition of returned values.
sequence_type data of length n .
Load and return the probability density function of the score on random sequence_type data of length n . This method handels scores with distributions independent of l . This includes all parsimony scores, and excludes model based scores.
The order of the values in the probability density function is WORST FIRST: The first values describe the probability for “bad” scores, the last values the probabilities for “top” scores.
Currently, for all models values are available until
For n <= n_max all values are available. If no distribution is available for a given n the closest values for n is used.
For values of n above n_max , the n_max pdf is returned.
n ( int ) – The number of repeat units.
n ( int ) – The number of repeat units.
score_type – The heuristic model used. E.g. “psim”.
score_type – The heuristic model used. E.g. “psim”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
A numpy list of length 10.000
Check return type.
Check how this method concurs with the empirical_list method.
Helper function for the analytic calculation of parsimony or pSim scores.
Called by d_average_multiple_max_multinom or d_average_multiple_pars_multinom .
Return the l -times self-convoluted pdf of the score on random sequence_type data of length n . The order of the pdf is kept from column_pdf() .
For details see:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
l ( int ) – The length of the repeat unit.
l ( int ) – The length of the repeat unit.
n ( int ) – The number of repeat units.
n ( int ) – The number of repeat units.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
score_type – The model of repeat evolution used. Either ‘psim’ or ‘parsimony’.
score_type – The model of repeat evolution used. Either ‘psim’ or ‘parsimony’.
(description missing)
if precision higher than max(uint32) use uint64 instead. CHECK: http://docs.scipy.org/doc/numpy/user/basics.types.html
Describe return value.
as a probability density function.
Analytically calculate the p-Value distribution for the pSim score for repeats of type tandemrepeat . The derivation is described in:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
tandemrepeat ( Repeat ) – A Repeat instance.
tandemrepeat ( Repeat ) – A Repeat instance.
precision ( float ) – The precision of the returned probability density function in
precision ( float ) – The precision of the returned probability density function in
of the length of the resulting list. ( terms ) –
of the length of the resulting list. ( terms ) –
cumulated probabilities from 0 to 1. unnamed (list of float): scores corresponding to the probabilities in p .
p (list of float)
if precision higher than max(uint32) use uint64 instead. CHECK: http://docs.scipy.org/doc/numpy/user/basics.types.html
as a probability density function.
Analytically calculate the p-Value distribution for the parsimony score for repeats of type tandemrepeat . The derivation is described in:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
tandemrepeat ( Repeat ) – A Repeat instance.
tandemrepeat ( Repeat ) – A Repeat instance.
precision ( float ) – The precision of the returned probability density function in
precision ( float ) – The precision of the returned probability density function in
of the length of the resulting list. ( terms ) –
of the length of the resulting list. ( terms ) –
cumulated probabilities from 0 to 1. unnamed (list of float): scores corresponding to the probabilities in p .
p (list of float)
if precision higher than max(uint32) use uint64 instead. CHECK: http://docs.scipy.org/doc/numpy/user/basics.types.html
distribution from an external file.
If no distribution is available for a given l and n , the closest values for l and n are chosen instead.
For the standard model score “phylo”, currently values are available until
total_repeat_length_max = 1000
total_repeat_length_max = 1000
For l <= l_max and n <= n_max and n*l <= total_repeat_length_max all values are available.
For other values, we use the closest distribution, assuming that values change little (heuristic assumption!).
l ( int ) – The length of the repeat unit.
l ( int ) – The length of the repeat unit.
n ( int ) – The number of repeat units.
n ( int ) – The number of repeat units.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
sequence_type ( str ) – The type of the sequence: either “AA” or “DNA”.
score_type – The model of repeat evolution used. E.g. “phylo”.
score_type – The model of repeat evolution used. E.g. “phylo”.
A numpy list of length 10.000
Define “phylo” model.
Perhaps add distributions beyond l_max, n_max.
Calculate the gap penalty for a Repeat given mutation rate mu .
tandemrepeat ( Repeat ) – A Repeat instance.
tandemrepeat ( Repeat ) – A Repeat instance.
mu ( float ) – The mutation rate.
mu ( float ) – The mutation rate.
Gap penalty (float)
Define mu more precisely.
Is this function called from anywhere? In case, consider refactoring.
Calculates the p-Value of a score_type for the given tandemrepeat .
The p-Value is the number of scores for comparable tandem repeats, i.e. of same repeat unit length and repeat unit copy number that are as good or better.
tandemrepeat ( Repeat ) – An instance of the Repeat class.
tandemrepeat ( Repeat ) – An instance of the Repeat class.
score_type – The model of repeat evolution used. E.g. “phylo”.
score_type – The model of repeat evolution used. E.g. “phylo”.
score_value ( float ) – The value of the score of the Repeat instance.
score_value ( float ) – The value of the score of the Repeat instance.
empirical – The null distribution of the score for repeats of the same type.
empirical – The null distribution of the score for repeats of the same type.
Calculate the p-Value of the parsimony score for a Repeat.
Retrieve the probability density function for repeats of the same type as tandemrepeat . Then, calculate the p-Value given this probability density function, and the parsimony score of tandemrepeat .
tandemrepeat ( Repeat ) – A Repeat instance.
p-Value (float)
Check the method’s behaviour if tandemrepeat s parsimony score has not been calculated before.
Check exception: if pdf == False: return 1.
Calculate the p-Value of the pSim score for a Repeat.
Retrieve the probability density function for repeats of the same type as tandemrepeat . Then, calculate the p-Value given this probability density function, and the pSim score of tandemrepeat .
tandemrepeat ( Repeat ) – A Repeat instance.
p-Value (float)
Check the method’s behaviour if tandemrepeat s parsimony score has not been calculated before.
Check exception: if pdf == False: return 1.
Describe precision .
The repeat score module.
CALCULATE THE PROBABILITY DISTRIBUTION OF SCORES
Calculate the entropy of a list.
Calculate the entropy of list. Assume that the frequency of elements in the list reflects a probability density estimator.
For an exact description see:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
column ( list of str ) – List of elements that can be ordered in a set, e.g. str or int.
The entropy of column .
Load equilibrium frequencies from a substitution matrix file.
Load equilibrium frequencies from a substitution matrix file. Note that with minor changes, the whole amino acid substitution matrix could be returned.
file_name ( str ) – Path to substitution matrix file, E.g. LG.dat.
Dictionary of one letter amino acid codes and float value
(Dict of str, float)
tandem repeat assuming a star tree.
Calculate the log-likelihood of the gap structure in a tandem repeat assuming a star tree (i.e. repeat unit correlations are not modeled). The gap length model is a zipfian distribution with parameter indel_zipf . The gap generation model is a simple poisson model with rate parameter indel_rate_per_site .
t ( float ) – The divergence of the tandem_repeat units.
t ( float ) – The divergence of the tandem_repeat units.
tandem_repeat ( Repeat ) – An instance of the Repeat class.
tandem_repeat ( Repeat ) – An instance of the Repeat class.
indel_rate_per_site ( float ) – The mutation rate of insertions and deletions, as opposed to t .
indel_rate_per_site ( float ) – The mutation rate of insertions and deletions, as opposed to t .
gaps ( str ) – The mode of gap counting. Options are “row_wise”,
gaps ( str ) – The mode of gap counting. Options are “row_wise”,
"ignore_trailing_gaps" and ( "ignore_coherent_deletions" , ) –
"ignore_trailing_gaps" and ( "ignore_coherent_deletions" , ) –
"ignore_trailing_gaps_and_coherent_deletions". –
"ignore_trailing_gaps_and_coherent_deletions". –
indel_zipf ( float ) – The parameter of the Zipfian distribution.
indel_zipf ( float ) – The parameter of the Zipfian distribution.
The loglikelihood value for the gap structure of the tandem repeat.
USE LOG EARLIER, NOT JUST IN RETURN STATEMENT
sequence model defined by Q , t , eq_freq and alphabet .
t ( float ) – The divergence of the tandem_repeat units.
t ( float ) – The divergence of the tandem_repeat units.
Q ( dict ? ) – A substitution matrix.
Q ( dict ? ) – A substitution matrix.
eq_freq ( dict ? ) – Equilibrium frequencies of all chars.
eq_freq ( dict ? ) – Equilibrium frequencies of all chars.
alphabet ( dict of str , ? ) – An alphabet from a substitution matrix.
alphabet ( dict of str , ? ) – An alphabet from a substitution matrix.
tandem_repeat ( Repeat ) – An instance of the Repeat class.
tandem_repeat ( Repeat ) – An instance of the Repeat class.
The loglikelihood value for the tandem repeat.
alignment in repeat according to a measure_of_similarity .
repeat ( Repeat ) – An instance of the Repeat class.
repeat ( Repeat ) – An instance of the Repeat class.
measure_of_similarity ( str ) – Either “entropy”, “parsimony”, or “pSim”.
measure_of_similarity ( str ) – Either “entropy”, “parsimony”, or “pSim”.
ignore_gaps ( boolean ) – Are gaps, “-” treated as chars (False) or ignored (True).
ignore_gaps ( boolean ) – Are gaps, “-” treated as chars (False) or ignored (True).
A similarity measure for the repeat units in repeat .
Binary one-dimensional optimisation of function .
Perform a binary one dimensional optimisation of parameter t on function with the additional list of arguments/parameters args . Start on a given range of start, and iterate n_iteration times. Return the maximum of the function, together with the maximum parameter t as a tuple.
In addition to start_min and start_max , additional hard boundaries on the optimisation parameter t are hard-coded: t E [0.0000000001, 100]
function ( method ) – Method with input (float, args ) and output float.
function ( method ) – Method with input (float, args ) and output float.
args ( list of items ) – List of arguments for function .
args ( list of items ) – List of arguments for function .
start_min (float): Minimum value of function parameter t . start_max (float): Maximum value of function parameter t . n_iteration (int): Number of iterations until optimisation results are returned.
float, Corresponding function parameter: float)
Corresponding function parameter: float)
tuple (Maximum of function Todo Check why region_bounded is hardcoded at current. Todo Check why stepsize is hardcoded at current. Todo Generalise hard-coded optimisation parameter boundaries.
tuple (Maximum of function
Check why region_bounded is hardcoded at current.
Check why stepsize is hardcoded at current.
Generalise hard-coded optimisation parameter boundaries.
Calculate the pSim score of a list.
Calculate the pSim score on column : Count the frequency of the most frequent element in a column of a multiple sequence alignment.
For an exact description see:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
column ( list of str ) – A list of elements.
The pSim score of column .
Calculate the parsimony score of a list.
Calculate the parsimony score on column : Count the number of changes in a column of a multiple sequence alignment and divide by the maximally possible number of changes.
For an exact description see:
Schaper, E., Kajava, A., Hauser, A., & Anisimova, M. Repeat or not repeat? –Statistical validation of tandem repeat prediction in genomic sequences. Nucleic Acids Research (2012).
column ( list of str ) – A list of two or more elements that can be
column ( list of str ) – A list of two or more elements that can be
in a set , e.g. str or int ( ordered ) –
in a set , e.g. str or int ( ordered ) –
The parsimony score of column .
At which step shall we assert that the length of column > 1?