Colocalisation
gentropy.dataset.colocalisation.Colocalisation
dataclass
¶
Bases: Dataset
Colocalisation results for pairs of overlapping study-locus.
Source code in src/gentropy/dataset/colocalisation.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
append_study_metadata(study_locus: StudyLocus, study_index: StudyIndex, *, metadata_cols: list[str], colocalisation_side: str = 'right') -> DataFrame
¶
Appends metadata from the study to the requested side of the colocalisation dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
study_locus
|
StudyLocus
|
Dataset containing study loci that links the colocalisation dataset and the study index via the studyId |
required |
study_index
|
StudyIndex
|
Dataset containing study index that contains the metadata |
required |
metadata_cols
|
list[str]
|
List of study columns to append |
required |
colocalisation_side
|
str
|
Which side of the colocalisation dataset to append metadata to. Must be either 'right' or 'left' |
'right'
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
Colocalisation dataset with appended metadata of the study from the requested side |
Raises:
Type | Description |
---|---|
ValueError
|
if colocalisation_side is not 'right' or 'left' |
Source code in src/gentropy/dataset/colocalisation.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
extract_maximum_coloc_probability_per_region_and_gene(study_locus: StudyLocus, study_index: StudyIndex, *, filter_by_colocalisation_method: str, filter_by_qtls: str | list[str] | None = None) -> DataFrame
¶
Get maximum colocalisation probability for a (studyLocus, gene) window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
study_locus
|
StudyLocus
|
Dataset containing study loci to filter the colocalisation dataset on and the geneId linked to the region |
required |
study_index
|
StudyIndex
|
Study index to use to get study metadata |
required |
filter_by_colocalisation_method
|
str
|
optional filter to apply on the colocalisation dataset |
required |
filter_by_qtls
|
str | list[str] | None
|
optional filter to apply on the colocalisation dataset |
None
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
table with the maximum colocalisation scores for the provided study loci |
Raises:
Type | Description |
---|---|
ValueError
|
if filter_by_qtl is not in the list of valid QTL types or is not in the list of valid colocalisation methods |
Source code in src/gentropy/dataset/colocalisation.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
get_schema() -> StructType
classmethod
¶
Provides the schema for the Colocalisation dataset.
Returns:
Name | Type | Description |
---|---|---|
StructType |
StructType
|
Schema for the Colocalisation dataset |
Source code in src/gentropy/dataset/colocalisation.py
30 31 32 33 34 35 36 37 |
|
Schema¶
root
|-- leftStudyLocusId: string (nullable = false)
|-- rightStudyLocusId: string (nullable = false)
|-- rightStudyType: string (nullable = false)
|-- chromosome: string (nullable = false)
|-- colocalisationMethod: string (nullable = false)
|-- numberColocalisingVariants: long (nullable = false)
|-- h0: double (nullable = true)
|-- h1: double (nullable = true)
|-- h2: double (nullable = true)
|-- h3: double (nullable = true)
|-- h4: double (nullable = true)
|-- clpp: double (nullable = true)
|-- betaRatioSignAverage: double (nullable = true)