crispr_analysis_utils.guide_annotation.promoters¶
crispr_analysis_utils.guide_annotation.promoters ¶
Transcription start sites, from a BED file or from the store itself.
PromoterError ¶
Bases: RuntimeError
The promoter file is unusable, or shares no contig with the store.
Source code in src/crispr_analysis_utils/guide_annotation/promoters.py
17 18 | |
read_promoters ¶
read_promoters(path: str | PathLike[str]) -> pd.DataFrame
Read a TSS BED file.
Parameters:
-
path(str | PathLike[str]) –A BED of transcription start sites, one row per site: a gene with several promoters needs one row each. Six columns at least; a seventh is read as the gene id, which is what lets a TSS be tied back to the store, and an eighth as the transcript id, which is what fills
promoter_enst. Leading#,trackandbrowserlines are skipped.
Returns:
-
DataFrame–Chromosome,Start,End,Strand,gene_symbol,ensgandenst, the last two empty when the file has no seventh or eighth column.
Raises:
-
PromoterError–The file is missing, empty, or has fewer than six columns.
Source code in src/crispr_analysis_utils/guide_annotation/promoters.py
21 22 23 24 25 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 | |
check_contigs ¶
check_contigs(promoters: DataFrame, store) -> None
Fail when no TSS contig is in the store, rather than measure from none.
Raises:
-
PromoterError–The TSS and the store name contigs differently,
1againstchr1, so every distance would be to no promoter at all.
Source code in src/crispr_analysis_utils/guide_annotation/promoters.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
promoters_from_store ¶
promoters_from_store(store, *, reference_only: bool = False) -> pd.DataFrame
Derive the TSS of every transcript from the store.
A gene has as many promoters as it has distinct transcript starts, and a guide at an alternative promoter is invisible to a one-TSS-per-gene file, so every transcript contributes a site by default.
Parameters:
-
store–A loaded
Store. -
reference_only(bool, default:False) –Take only each gene's reference transcript, one TSS per gene. This is the older behaviour and loses alternative promoters.
Returns:
-
DataFrame–The same columns
read_promotersreturns, each TSS one base wide, deduplicated so two transcripts sharing a start give one row per transcript but not two identical ones.
Source code in src/crispr_analysis_utils/guide_annotation/promoters.py
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 | |