Sequence code documentation
发布时间:2026-10-01 | 浏览:1
Table Of Contents
Sequence code documentation sequence sequence_io repeat_detection_io repeat_detection_run
repeat_detection_io
repeat_detection_run
Enter search terms or a module, class or function name.
Initial version of the sequence submodule documentation.
A Sequence describes either a protein or a DNA sequence.
Sequence contains methods that act on single sequences, for example:
The sequence with standard amino acids only
Create sequence(s) from file.
Create sequence(s) from file.
file ( str ) – Path to input file
format ( str ) – Either “fasta” or “pickle”
Write checks for format and file .
Detects tandem repeats on self.seq from 2 possible sources.
A list of Repeat instances is created for tandem repeat detections on the sequence from two possible sources:
Sequence profile hidden Markov models HMM
de novo detection algorithms.
hmm ( HMM ) – A list of HMM instances.
denovo ( bool ) – boolean
realignment ( str ) – either “mafft”, “proPIP” or None
*kwargs – Parameters fed to denovo TR prediction and/or Repeat instantiation. E.g. repeat = {"calc_score": True}
A RepeatList instance
Retrieve repeatlist from this sequence instance.
Retrieve repeatlist from this sequence instance. Access repeatlist as self.d_repeatlist[tag]
Sanity check whether the repeat is part of this sequence . In case, calculate the position of the repeat within the sequence .
If yes: Return True, set repeat.begin to corrected value if necessary. If no: Return False. Perform sanity check on sequences where all amino acids are or are converted to standard amino acids.
Decide whether save_original_msa is needed here.
Add repeatlist as attribute to this sequence instance.
Add repeatlist as attribute to this sequence instance. Access repeatlist as self.d_repeatlist[tag]
repeatlist ( RepeatList ) – A repeat_list instance.
tag ( str ) – A identifier for the repeat_list
Write sequence to file.
Write sequence to file using one of two formats.
file ( str ) – Path to output file
format ( str ) – Either “fasta” or “pickle”
Write checks for format and file .
Read all sequences from a fasta file.
Read all sequences from a fasta file. At current, the Biopython SeqIO parser is used.
file ( str ) – Path to input file
start ( [int, int] ) – Index of the first returned sequence, and the first not returned sequence.
Write a sequence str to fasta format in specified <sequence_file>
Write s sequence str to fasta format in specified <sequence_file>
sequence ( str ) – Sequence
sequence_file ( str ) – Path to the output file
sequence_id ( str ) – ID of the sequence in the output file.
repeat_detection_io ¶
Derive the MSA from a strange combination of consensusMSA and sequenceMSA in TRF (Benson) txt.html output files
msa – The multiple sequence alignment predicted by TRF.
Read repeats from a HHREPID standard output (stdout) file stream successively.
Read repeats from a HHREPID standard output (stdout) file stream successively. Postcondition: infile points to EOF.
Layout of HHREPID standard output:
infile ( file stream ) – File stream from HHREPID standard output.
by e.g. ( [Generated ) – ./hhrepid_32 -i FASTAFILE -v 0 -d cal.hhm -o INFILE]
A generator function is returned that, when called in a loop, yields one repeat per iteration.
Layout HHREPID output syntax.
Read repeats from a PHOBOS output file stream successively.
Read repeats from a PHOBOS output file stream successively. Postcondition: infile points to EOF.
Show PHOBOS output syntax.
Read repeats from a TRED standard output (stdout) file stream successively.
Read repeats from a TRED standard output (stdout) file stream successively. Postcondition: infile points to EOF.
Layout of TRED output file:
Layout TRED output syntax.
Construct a MSA from pairwise alignments.
Construct a MSA from pairwise alignments. At the moment, gaps following the repeat are not added. However, these gaps are added automatically when a Repeat instance is created.
Is the Args format mentioned correctly?
Read repeats from a T-REKS standard output (stdout) file stream successively.
Read repeats from a T-REKS standard output (stdout) file stream successively. Postcondition: infile points to EOF.
Layout of T-REKS output file:
Layout T-REKS output syntax.
Read repeats from a TRF txt.html file stream file stream successively.
Read repeats from a TRF txt.html file stream file stream successively. Postcondition: infile points to EOF.
TRF output file syntax:
(generated via e.g. ./trf404.linux64.exe FASTAFILE 2 7 7 80 10 50 500 -d > /dev/null If the -h flag is set, no .txt.html output is produced)
Layout TRF output syntax.
Does not search for the sequence identifier at current!
return a trust msa that has no longer indels than maximal_gap_length, that contains the indel characters even when not part of the trust output file. Background trust returns tandem repeats, but also distant repeats.
Read repeats from a TRUST standard output (stdout) file stream successively.
Read repeats from a TRUST standard output (stdout) file stream successively. Postcondition: infile points to EOF.
Layout of TRUST standard output:
Layout TRUST output syntax.
Read repeats from a XSTREAM output xls chart
Read repeats from a XSTREAM output xls chart
Postcondition: infile points to EOF.
repeat_detection_run ¶
Contains the executable, and combines executable with parameters.
Contains the executable, and combines executable with parameters.
Return the command line to invoke the program with the arguments args
Return the tokens to invoke the program with the arguments args
Define a global dictionary of all used detector functions.
Define a global dictionary of all used detector functions.
lDetector ( list of str ) – A list of repeat detection algorithm names.
sequence_type ( str ) – Either “AA” or “DNA”.
Exception – if at least one of the provided detectors in lDetector does not exist.
Check for java problems. Return True if there were problems, else False.
Check for these java errors:
Stdout file is empty but stderr file is not.
Java Exception string is indicated in the errfile
Return True if there were problems, else False.
outfile ( file handle ) – Redirected standard output channel file.
errfile ( file handle ) – Redirected standard error channel file If None, no copies are saved.
log – Name of the log to issue log messages to. If none, no log messages will be issued.
Complete docstring
Run TRD on sequence_records and return the predicted repeats for each seq_records and for each tandem repeat detector. Example of return type:
seq_records ( list of Sequence ) – A list of Sequence instances
detectors ( list of str ) – A list tandem repeat detector names
sequence_type ( str ) – Either “AA” or “DNA”
default ( bool ) – If True, default values for the detection algorithms are used.
local_working_dir ( str ) – Directory where data and results are stored. If provided,
files are not deleted/ ( temporary ) –
num_threads ( int ) – Run num_threads detectors on parallel threads.
A list with a dictionary for each record in seq_records. The dictionary contains a list of repeats for each detector that was used.
list of dictionary
Split a FASTA file with multiple entries to several FASTA files with one entry
Arguments: seq_records – List of Sequence instances. working_dir – Output directory for splitted file
Returns: A list of tuples containing the Protein identifier and the file name