frag_pele/serie_handler.py
def extract_hydrogens_from_instructions(instruction):
    """
    If the core or the fragment atom contains a "-" means that the user is selecting an specific H to be bonded with
    the heavy atom. For this reason, this detects if this option has been selected by the user and extract the PDB-atom-name
    of each element.
    :param instruction: list that follow this structure: [fragment_pdb_file, pdb_atom_name_of_the_core
    (and H if required), pdb_atom_name_of_the_fragment (and H if required)]
    :return: if the "-" is found in the pdb_atom_name_of_the_core or pdb_atom_name_of_the_fragment it returns a list with
    PDB-atom-names split following this order: heavy_atom_core, hydrogen_core, heavy_atom_fragment, hydrogen_fragment.
    Otherwise it returns False.
    """
    if "-" in instruction[1] or "-" in instruction[2]:
        try:
            heavy_core = instruction[1].split("-")[0]
            hydrogen_core = instruction[1].split("-")[1]
            heavy_fragment = instruction[2].split("-")[0]
            hydrogen_fragment = instruction[2].split("-")[1]
            return heavy_core, hydrogen_core, heavy_fragment, hydrogen_fragment
        except IndexError:
            raise IndexError(f"Wrong growing direction in {instruction}. Both, fragment and core atoms must include one or two atoms." 
                              "Ex: frag.pdb  C1  C2 |or| frag.pdb  C1-H1  C2-H2")
    else:
        return False

    If the core or the fragment atom contains a "-" means that the user is selecting an specific H to be bonded with
    the heavy atom. For this reason, this detects if this option has been selected by the user and extract the PDB-atom-name
    of each element.
    :param instruction: list that follow this structure: [fragment_pdb_file, pdb_atom_name_of_the_core
    (and H if required), pdb_atom_name_of_the_fragment (and H if required)]
    :return: if the "-" is found in the pdb_atom_name_of_the_core or pdb_atom_name_of_the_fragment it returns a list with
    PDB-atom-names split following this order: heavy_atom_core, hydrogen_core, heavy_atom_fragment, hydrogen_fragment.
    Otherwise it returns False.
    
If the core or the fragment atom contains a "-" means that the user is selecting an specific H to be bonded with
the heavy atom. For this reason, this detects if this option has been selected by the user and extract the PDB-atom-name
of each element.
If the core or the fragment atom contains a " - " means that the user is selecting an specific H to be bonded with the heavy atom . For this reason this detects if this option has been selected by the user and extract the PDB - atom - name of each element .
def extract_hydrogens_from_instructions(instruction):
    if "-" in instruction[1] or "-" in instruction[2]:
        try:
            heavy_core = instruction[1].split("-")[0]
            hydrogen_core = instruction[1].split("-")[1]
            heavy_fragment = instruction[2].split("-")[0]
            hydrogen_fragment = instruction[2].split("-")[1]
            return heavy_core, hydrogen_core, heavy_fragment, hydrogen_fragment
        except IndexError:
            raise IndexError(f"Wrong growing direction in {instruction}. Both, fragment and core atoms must include one or two atoms." 
                              "Ex: frag.pdb  C1  C2 |or| frag.pdb  C1-H1  C2-H2")
    else:
        return False
def extract_hydrogens_from_instructions ( instruction ) : if "-" in instruction [ 1 ] or "-" in instruction [ 2 ] : try : heavy_core = instruction [ 1 ] . split ( "-" ) [ 0 ] hydrogen_core = instruction [ 1 ] . split ( "-" ) [ 1 ] heavy_fragment = instruction [ 2 ] . split ( "-" ) [ 0 ] hydrogen_fragment = instruction [ 2 ] . split ( "-" ) [ 1 ] return heavy_core , hydrogen_core , heavy_fragment , hydrogen_fragment except IndexError : raise IndexError ( f"Wrong growing direction in {instruction}. Both, fragment and core atoms must include one or two atoms." "Ex: frag.pdb  C1  C2 |or| frag.pdb  C1-H1  C2-H2" ) else : return False
If the core or the fragment atom contains a "-" means that the user is selecting an specific H to be bonded with
the heavy atom.
If the core or the fragment atom contains a " - " means that the user is selecting an specific H to be bonded with the heavy atom .
"""
    If the core or the fragment atom contains a "-" means that the user is selecting an specific H to be bonded with
    the heavy atom. For this reason, this detects if this option has been selected by the user and extract the PDB-atom-name
    of each element.
    :param instruction: list that follow this structure: [fragment_pdb_file, pdb_atom_name_of_the_core
    (and H if required), pdb_atom_name_of_the_fragment (and H if required)]
    :return: if the "-" is found in the pdb_atom_name_of_the_core or pdb_atom_name_of_the_fragment it returns a list with
    PDB-atom-names split following this order: heavy_atom_core, hydrogen_core, heavy_atom_fragment, hydrogen_fragment.
    Otherwise it returns False.
    """
if the "-" is found in the pdb_atom_name_of_the_core or pdb_atom_name_of_the_fragment it returns a list with
PDB-atom-names split following this order: heavy_atom_core, hydrogen_core, heavy_atom_fragment, hydrogen_fragment.
Otherwise it returns False.
if the " - " is found in the pdb_atom_name_of_the_core or pdb_atom_name_of_the_fragment it returns a list with PDB - atom - names split following this order : heavy_atom_core hydrogen_core heavy_atom_fragment hydrogen_fragment . Otherwise it returns False .
instruction
list that follow this structure: [fragment_pdb_file, pdb_atom_name_of_the_core
(and H if required), pdb_atom_name_of_the_fragment (and H if required)]
list that follow this structure : [ fragment_pdb_file pdb_atom_name_of_the_core ( and H if required ) pdb_atom_name_of_the_fragment ( and H if required ) ]