crispr_analysis_utils.guide_annotation.pipeline¶
crispr_analysis_utils.guide_annotation.pipeline ¶
The gene annotation: read the aligned sites, place them in genes, write the table.
outdir gets three folders and nothing else: annotations/ with the one
results table and its guide_gene_annotation_columns.yaml, run_metadata/ with this
invocation's record, and logs/.
RESULTS_DIR
module-attribute
¶
RESULTS_DIR = 'annotations'
Where the step's results go, so nothing of its own sits beside the inputs.
PROMOTER_WINDOW
module-attribute
¶
PROMOTER_WINDOW = 1000
How far either side of a TSS counts as its promoter, by default.
RunResult
dataclass
¶
What run produced.
Attributes:
-
outdir(Path) –The output folder.
-
annotated(DataFrame) –The annotation table: one row per site per overlapping gene.
-
store(Store) –The annotation store the run used.
-
metadata(dict) –The record written under
run_metadata/.
Source code in src/crispr_analysis_utils/guide_annotation/pipeline.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
run ¶
run(alignment: str | PathLike[str] | DataFrame, store: str | PathLike[str] | Store, outdir: str | PathLike[str], *, promoters: str | PathLike[str] | None = None, promoter_window: int = PROMOTER_WINDOW, distance_from: str = MIDPOINT) -> RunResult
Annotate every aligned site against the genes of the store.
Parameters:
-
alignment(str | PathLike[str] | DataFrame) –guide_genome_annotation.tsvfromguide_alignment.run, or the same table as a DataFrame. Only the sites with a PAM are annotated, which is what it means for a guide to map. -
store(str | PathLike[str] | Store) –The annotation store, as
build_storewrote it. -
outdir(str | PathLike[str]) –Where the table goes. Created if it does not exist; nothing is ever written outside it.
-
promoters(str | PathLike[str] | None, default:None) –A TSS BED. Without one, a site per transcript is taken from the store.
-
promoter_window(int, default:PROMOTER_WINDOW) –How far either side of a TSS counts as its promoter.
-
distance_from(str, default:MIDPOINT) –Where distances are measured from: the protospacer midpoint, or the target site 3 bases 5' of the PAM.
Returns:
-
RunResult–The table, the store and the record.
Raises:
-
AnnotationError–The sites and the store name contigs differently, or the alignment table holds no mapped site.
Source code in src/crispr_analysis_utils/guide_annotation/pipeline.py
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 | |