drive.models package

Contents

drive.models package#

Submodules#

drive.models.data_container module#

class drive.models.data_container.Data(networks: List[Network_Interface], output_path: Path, carriers: Dict[str, Dict[str, Set[str]]], phenotype_descriptions: Dict[str, Dict[str, str]])[source]#

Bases: object

main class to hold the data from the network analysis and the different pvalues

carriers: Dict[str, Dict[str, Set[str]]]#
networks: List[Network_Interface]#
output_path: Path#
phenotype_descriptions: Dict[str, Dict[str, str]]#
class drive.models.data_container.Data_Interface(*args, **kwargs)[source]#

Bases: Protocol

Protocol defining what attributes the DataHolder Interface needs to have

carriers: Dict[str, Dict[str, Set[str]]]#
networks: List[Network_Interface]#
output_path: Path#
phenotype_descriptions: Dict[str, Dict[str, str]]#

drive.models.generate_indices module#

class drive.models.generate_indices.FileIndices(*args, **kwargs)[source]#

Bases: Protocol

get_haplotype_id(data: DataFrame, ind_id_indx: int, phase_col_indx: int, col_name: str) None[source]#
class drive.models.generate_indices.Germline(id1_indx: int = 0, hap1_indx: int = 1, id2_indx: int = 2, hap2_indx: int = 3, chr_indx: int = 4, str_indx: int = 5, end_indx: int = 6, cM_indx: int = 10, unit: int = 11)[source]#

Bases: FileIndices

cM_indx: int = 10#
chr_indx: int = 4#
end_indx: int = 6#
get_haplotype_id(data: DataFrame, ind_id_indx: int, phase_col_indx: int, col_name: str) None[source]#
hap1_indx: int = 1#
hap2_indx: int = 3#
id1_indx: int = 0#
id2_indx: int = 2#
str_indx: int = 5#
unit: int = 11#
class drive.models.generate_indices.HapIBD(id1_indx: int = 0, hap1_indx: int = 1, id2_indx: int = 2, hap2_indx: int = 3, chr_indx: int = 4, str_indx: int = 5, end_indx: int = 6, cM_indx: int = 7)[source]#

Bases: FileIndices

cM_indx: int = 7#
chr_indx: int = 4#
end_indx: int = 6#
get_haplotype_id(data: DataFrame, ind_id_indx: int, phase_col_indx: int, col_name: str) None[source]#
hap1_indx: int = 1#
hap2_indx: int = 3#
id1_indx: int = 0#
id2_indx: int = 2#
str_indx: int = 5#
class drive.models.generate_indices.Rapid(id1_indx: int = 1, hap1_indx: int = 3, id2_indx: int = 2, hap2_indx: int = 4, chr_indx: int = 0, cM_indx: int = 7, str_indx: int = 5, end_indx: int = 6)[source]#

Bases: FileIndices

cM_indx: int = 7#
chr_indx: int = 0#
end_indx: int = 6#
get_haplotype_id(data: DataFrame, ind_id_indx: int, phase_col_indx: int, col_name: str) None[source]#
hap1_indx: int = 3#
hap2_indx: int = 4#
id1_indx: int = 1#
id2_indx: int = 2#
str_indx: int = 5#
drive.models.generate_indices.create_indices(ibd_file_format: str) FileIndices[source]#

Factory method to generate the proper file indice object based on the ibd program

Parameters:

ibd_file_format (str) – string indicating what ibd program was used identify IBD segments. EX: hapibd, ilash, rapid, and germline. expects this value to be lower case

Returns:

returns an object that conforms to the FileIndices protocol. It will have the method getHAPID. It will also have the correct indices for the ibd program

Return type:

FileIndices

Raises:

ValueError – Raises a value error if the user passes an ibd_file_format that is not hapibd, hap-ibd, germline, ilash, rapid

class drive.models.generate_indices.iLASH(id1_indx: int = 0, hap1_indx: int = 1, id2_indx: int = 2, hap2_indx: int = 3, chr_indx: int = 4, str_indx: int = 5, end_indx: int = 6, cM_indx: int = 9)[source]#

Bases: FileIndices

cM_indx: int = 9#
chr_indx: int = 4#
end_indx: int = 6#
get_haplotype_id(data: DataFrame, ind_id_indx: int, phase_col_indx: int, col_name: str) None[source]#
hap1_indx: int = 1#
hap2_indx: int = 3#
id1_indx: int = 0#
id2_indx: int = 2#
str_indx: int = 5#

drive.models.networks module#

class drive.models.networks.Network(clst_id: float, true_positive_count: int, true_positive_percent: float, false_negative_edges: List[int], false_negative_count: int, members: Union[Set[int], Set[str]], haplotypes: Union[List[int], List[str]], min_pvalue_str: str = '', pvalues: Dict[str, Dict[str, Any]] = <factory>)[source]#

Bases: object

clst_id: float#
false_negative_count: int#
false_negative_edges: List[int]#
haplotypes: List[int] | List[str]#
members: Set[int] | Set[str]#
min_pvalue_str: str = ''#
print_members_list() str[source]#

Returns a string that has all of the members ids separated by space

Returns:

returns a string where the members list attribute is formatted as a string for the output file. Individuals strings are joined by comma.

Return type:

str

pvalues: Dict[str, Dict[str, Any]]#
true_positive_count: int#
true_positive_percent: float#
class drive.models.networks.Network_Interface(*args, **kwargs)[source]#

Bases: Protocol

clst_id: float#
false_negative_count: int#
false_negative_edges: List[int]#
haplotypes: List[int]#
members: Set[int]#
min_pvalue_str: str = ''#
print_members_list() str[source]#

Returns a string that has all of the members ids separated by space

Returns:

returns a string where the members list attribute is formatted as a string for the output file. Individuals strings are joined by comma.

Return type:

str

pvalues: Dict[str, str] = Field(name=None,type=None,default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=None)#
true_positive_count: int#
true_positive_percent: float#

drive.models.types module#

class drive.models.types.Filter(*args, **kwargs)[source]#

Bases: Protocol

ibd_pd: DataFrame#
ibd_vs: DataFrame#
class drive.models.types.Genes(chr, start, end)#

Bases: tuple

chr#

Alias for field number 0

end#

Alias for field number 2

start#

Alias for field number 1