Ejemplo n.º 1
0
def copy_identical_residues(template,
                            alignment,
                            model,
                            strict=True,
                            modifications=True):
    """*copy_identical_residues(template, alignment, model, strict=True, modifications=True)*

Copies all bases identical identical in the alignment
from the template structure to a model. The residue numbers
do not change.

:Arguments:
    * Template object
    * Alignment object
    * RnaModel object
    * strict=1 complains and stops on any problem encountered (default); strict=0 goes on if single residues fail to be copied
    * modifications=0 does not copy modified bases; modifications=1 is default.
    """
    template = validate_template(template)
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    if template: model.template = template
    if alignment:
        model.alignment = alignment
        model.recipe = RecipeMaker(alignment).recipe
    model.copy_all_residues(strict=strict, modifications=modifications)
Ejemplo n.º 2
0
 def __init__(self, template=None, alignment=None, model_chain_name='A', data_type=None, data=None, seq=None):
     ModernaStructure.__init__(self, data_type=data_type, data=data, chain_name=model_chain_name, seq=seq)
     #TODO: order of arguments is inconsistent.
     #TODO: template + alignment should be obligatory
     #TODO: replace alignment by recipe
     #TODO: rename to SingleTemplateModeling and/or refactor classes for tasks out.
     self.template = template
     if template:
         self.template.set_template_numeration()
     if alignment:
         self.recipe = RecipeMaker(alignment).recipe
     self.alignment = alignment
     self.s = ModernaSuperimposer()
Ejemplo n.º 3
0
def apply_missing_ends(alignment, model):
    """*apply_missing_ends(alignment,  model)*
    
Attaches an extended fragment of structure at both
the 5' and 3' ends of the target, where there is no corresponding
part in the template.

:Arguments:
    * Alignment object
    * model
    """
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    if alignment:
        model.alignment = alignment
        model.recipe = RecipeMaker(alignment).recipe
    model.add_missing_5p()
    model.add_missing_3p()
Ejemplo n.º 4
0
def add_all_modifications(template, alignment, model):
    """*add_all_modifications(template, alignment, model)*

Adds all modifications that occur in the target sequence, and are
not present in the template.
    
:Arguments:
    * Template object
    * Alignment object
    * RnaModel object
    """
    template = validate_template(template)
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    if template: model.template = template
    if alignment:
        model.alignment = alignment
        model.recipe = RecipeMaker(alignment).recipe
    model.add_all_modifications_copy()
Ejemplo n.º 5
0
def remove_mismatching_modifications(template, alignment, model):
    """*remove_mismatching_modifications(template, alignment, model)*

Removes all nucleotide modifications that occur in the template, 
and are not present in the target sequence. 
The nucleotides are transformed into standard bases from which the modifications originated.
   
:Arguments:
    * Template object
    * Alignment object
    * RnaModel object
    """
    template = validate_template(template)
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    model.template = template
    model.alignment = alignment
    model.recipe = RecipeMaker(alignment).recipe
    model.remove_all_modifications_copy()
Ejemplo n.º 6
0
def exchange_mismatches(template, alignment, model):
    """*exchange_mismatches(template, alignment, model)*
    
Exchanges the bases for all standard base mismatches in an alignment.
This applies all exchanges of one standard base by another.
Modified bases are not changed (use the apply_alignment command for that).
 
:Arguments:
    * Template object
    * Alignment object
    * RnaModel object
    """
    template = validate_template(template)
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    if template: model.template = template
    if alignment:
        model.alignment = alignment
        model.recipe = RecipeMaker(alignment).recipe
    model.exchange_all_bases()
Ejemplo n.º 7
0
def apply_alignment(template, alignment, model):
    """*apply_alignment(template, alignment, model)*

Applies all operations on single bases that are in an alignment:
Copying identical residues, exchanging mismatches, adding modifications,
and removing modifications. As a result, all these residues are copied
into a model (which may be empty).
For gaps in the alignment, nothing is done.

:Arguments:
    * Template object
    * Alignment object
    * RNAModel object
    """
    template = validate_template(template)
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    model.alignment = alignment
    model.recipe = RecipeMaker(alignment).recipe
    model.template = template
    model.apply_alignment()
Ejemplo n.º 8
0
def apply_all_indels(alignment, model):
    """*apply_all_indels(alignment, model)*
    
Finds and inserts the best fragment candidate for each gap region in the alignment. 
This command can be used to fill in gaps automatically. 
The procedure automatically retrieves the 20 best fitting candidates 
from the fragment database, checks whether they produce any clashes upon insertion, 
and inserts the best scoring candidate.

It depends, however on
    * gaps being shorter than 17 bases.
    (if longer a database of fragments up to 100 nt is available)

:Arguments:
    * Alignment object
    * RnaModel object
    """
    alignment = validate_alignment(alignment)
    model = validate_model(model)

    if alignment:
        model.alignment = alignment
        model.recipe = RecipeMaker(alignment).recipe
    model.insert_all_fragments()