# Modules and functions in this package

## Superimposition-based approach modules

### Check Stoichometry module

To import this any function within this module, use the next import

```python
>> from sbiRandM.check_stoichometry import *
```

#### Available functions

```python
check_fasta_stoichometry(fasta_path):

    """
    Input: path to the desired fasta file (string)
    Output: Dictionary with the stoichiometry done

    This function takes the path of the Fasta file of the Complex, 
    and checks the homology between chains
    to detect the steichiometry of the protein.
    """
```

### Complex\_build module

To import any function within this module, use the next import

```python
>> from sbiRandM.complex_build import *
```

#### Available function

```python
compute_equal_chain(s1,s2):

    """
    Input: Two Biopython PDB structures of an interaction
    Output: A list of Atoms corresponding to the same chain
    """
```

```python
check_chain_addition(complexPDB, chain, pairwise_dict, stechiometryDict):
    
    """
    Input: Protein's PDB, it's chain and two dictionaries, 
    the results of the pairwise alignment and the calculation 
    of the stechiometry

    Output: the common chains.

    The function looks wether the pdb complex and the chain that 
    we want to add have an interaction. 
    """
```

```python
build_complex(file1,file2):

    """
    Input: two files with pub interactions
    Output: File path of the complex PDB File

    This function takes the complex output file 
    (or in the first iteration one of the pairwise interactions) 
    and another pairwise interaction PDB complex. 
    Then it tries to add the chain to the complex until there is 
    not clash
    """
```

```python
rename_complex_chains(file):

    """
    Input: PDB file
    Output: PDB file with the chains named

    This function takes a PDB file, delete all the END lines, 
    and rename the chains according to Alphabet found in data module.
    """
```

```python
execute_complex(stechiometry_dict, pairwise_dict, args):

    """
    Input: Both dictionaries result of the stechiometry and the 
    alignment and some arguments.
    Output: the complex
    """
```

### Interaction Module

For using this module and the functions inside it, use the next command

```python
>> from sbiRandM.interaction_module import *
```

#### Available functions

```python
check_homology(fasta1,fasta2):

    """
    Input: Two fasta sequences
    Output: Boolean variable indicating if the sequence are homologous

    his function check the identity percentage between two chains, 
    and returns True if they are homologous or False if they are not. 
    The threshold is currently at 70%.
    """
```

```python
Get_fasta(chain):

    """
    Input: Biopython PDB Chain object
    Output: String of the sequence of Aminoacids of the PDB Chain Object

    This function takes as input a Biopython PDB Chain object, 
    and parse it into a sequence of aminoacids.
    """
```

```python
check_clash(structure_complex, mobile_chain):

    """
    Input: Biopython object of the actual complex and 
    Biopython object of the moving chain
    Output: True or False wether the chain is clashing or 
    not with the complex
    """
```

```python
obtain_pairwise_dict(steichiometry_dict, TMP_folder):

    """
    Input:Steichiometry dict with the next format.
         Name of the chain : 
             Steichiometry - Absolute number that the 
                             chain appear in the Fasta.
             Sequence - Sequence of the chain

    Output:Dictionary with the next keys:
      [Name of Chain] - 
          [Name of chain in the interaction] - 
               [Path to that PDB file]
               
       This function parse a folder full with PDB of the pairwise 
       interactions, and parse them into a dictionary that contains 
       as keys the interacting chains, and as value, 
       the path of the file that contains the structure 
       of the interaction.
   """
```

## Modeling-based approach Modules

### Modeller Comparison Module

For using this module and the functions inside it, use the next command

```python
>> from sbiRandM.modeller_comparison import *
```

#### Available functions

```python
fasta_to_object(fasta):

    """
    Input: File with Fasta
    Output: Query object.

    This function takes a fasta file with several chains, 
    and parse it into a query object. 
    Also changes the DNA chains to Placeholder characters.
    """
```

```python
create_models(folder):

    """
    Input folder: Folder where you store the 
    pairwise complexes of the protein
    Output: List of Protein_Interaction objects

    This function takes a folder that contains the 
    complexes of the pairwise interactions, 
    parse them and return a list of Protein_Interaction 
    objects with information bout the location and the sequences.
    """
```

```python
check_similarity(query, interactions_list):

    """
    Input: Query instance and a list of interactions
    Output: The interaction dict updated

    This function takes a query object and a 
    list of Pairwise interaction objects, 
    returns the interaction list with the attribute 
    "originalChain" updated for each chain of the 
    pairwise interactions.  
    First it tries to check if the sequence of 
    interaction is a subset.
    If not, it checks over a 73% of similarity
    """
```

```python
generate_alignment(query, interactions, output_folder):

    """
    Input: Query instance, the interaction file and the 
    output where the files will be (a path).
    Output: the files in the path.
    """
```

```python
make_model(output_folder, interaction_pdb_folder, fasta):

    """
    Input: the pdbs, the fasta and the output folder
    Output: the files in the directory
    """
```

```python
separe_interactions(interactions):

    """
    This function takes a list of protein pairwise interactions, 
    that have more than originalChain (When mapping to homodimers) 
    and divide them into several objects, with one chain for each.
    """
```

```python
remove_duplicate_chains(folder):

    """
    This function removes duplicates and gets a 
    print in the terminal as an output.
    """
```
