crisprVerse / crisprDesign

Comprehensive design of CRISPR gRNAs for nucleases and base editors
MIT License
16 stars 5 forks source link

CrisprVerse problem: export a guideSet in a file #15

Closed frvcw closed 1 year ago

frvcw commented 1 year ago

Hi

Shortcut to my problem: I need to find unique protospacers. I forged a R package with a newly released genome of A thaliana. Therefore is lacking TxDb object and I cannot visualize my best protospacers from guideSet with CrisprViz lacking a geneModel parameter. I need to visualize guideSet database with info on the Off-target.

Longer explanation: 1) I created a BSgenome package. It seems to work.

2) I made GRanges in the centromere 2 for searching my protospacers. gr_only_Chr2 <- GRanges(seqnames = c("Chr2"), strand = c("*"), ranges = IRanges(start = c(5430214,6216078,6584087), end = c(5439350,6250009,6645423)))

3) I successfully created a guideSet with findSpacers(). It reported a GuideSet object with 5152 ranges. guideSet <- findSpacers(gr_only_Chr2, bsgenome=BSgenome.AtNaish2021.NCBI.Col, crisprNuclease=LbCas12a)

4) I made a bowtie alignement for seqrching off-target matches of the protospacer designed with guideSet in all the chromosomes. I also tried with single chromnosomes to reduce computing power demand in later steps. fastaFile <- "C:/folder/sequence.fasta" outdirAll <- tempdir() Rbowtie::bowtie_build(fastaFile, outdir= outdirAll, force=TRUE, prefix="Arabidopsis") index <- file.path(outdirAll, index_prefix="Arabidopsis")

5) With addSpacerAlignments(), I scored I aligned the protospacers with my newly forged BSgenome package. guideSet <- addSpacerAlignments(guideSet, aligner = "bowtie", colname = "alignments", aligner_index=index, bsgenome=bsgenome, n_mismatches=1, n_max_alignments = 3)

Now, I struggle anyway to visualize my data. I do not have annotations so the command plotGuideSet() from ‘CrisprViz’ cannot be used. I am currently try to forge correctly formatted GRangeList from TxDb to use as geneModel. This procedure will take time.

My questions are: Is there a way to simply export the guideSet data frame to a txt file to speed up my analysis?
Should I invest my time to create the annotations "geneModel-friendly" for visualize my result with plotGuideSet()? Do you have suggestion how?

Thanks for the your kind assistance

Jfortin1 commented 1 year ago

Hi @frvcw,

You can use the function GuideSet2DataFrames to convert the GuideSet object into a named list of data.frames. Each data.frame can be saved as a text file. See ?GuideSet2DataFrames

(crisprDesign v>1.1.20 required).

frvcw commented 1 year ago

Hi Jfortin1

Thanks for your kind assistance I solved my problem.

Even thou I could not download a crisprDesign v>1.1.20, I run the script I found on GitHub for GuideSet2DataFrames.R in my console and it worked out.

Have a nice day