writeHits {CRISPRseek} | R Documentation

## Write the hits of sequence search from a sequence to a file

### Description

write the hits of sequence search from a sequence instead of BSgenome to a file, internal function used by searchHits

### Usage

    writeHits(gRNA, seqname, matches, strand, file, gRNA.size = 20L,
         PAM = "NGG", PAM.pattern = "N[A|G]G$", max.mismatch = 4L,
         chrom.len, append = FALSE, PAM.location = "3prime",
         PAM.size = 3L, allowed.mismatch.PAM = 1L,
         seqs,
        baseEditing = FALSE, targetBase = "C", editingWindow = 4:8)

### Arguments

`gRNA` | DNAString object with gRNA sequence with PAM appended immediately after,e.g., ACGTACGTACGTACTGACGTCGG with 20bp gRNA sequence plus 3bp PAM sequence CGG
`seqname` | sequence name as character
`matches` | XStringViews object storing matched chromosome locations
`strand` | strand of the match, + for plus strand and - for minus strand
`file` | file path where the hits is written to
`gRNA.size` | gRNA size, default 20
`PAM` | PAM as regular expression for appending to the gRNA, default NGG for SpCas9, change to TTTN for cpf1.
`PAM.pattern` | PAM as regular expression for filtering the hits, default N[A|G]G$ for spCas9. For cpf1, ^TTTN since it is a 5 prime PAM sequence.
`max.mismatch` | maximum mismatch allowed within the gRNA (excluding PAM portion) for filtering the hits, default 4
`chrom.len` | length of the matched chromosome
`append` | TRUE if append to existing file, false if start a new file
`PAM.location` | PAM location relative to gRNA. For example, spCas9 PAM is located on the 3 prime while cpf1 PAM is located on the 5 prime
`PAM.size` | Size of PAM, default 3
`allowed.mismatch.PAM` | Maximum number of mismatches allowed in the offtargets comparing to the PAM sequence. Default to 1 for NGG PAM
`seqs` | DNAString object containing a DNA sequence.
`baseEditing` | Indicate whether to design gRNAs for base editing. Default to FALSE If TRUE, please set baseEditing = TRUE, targetBase and editingWidow accordingly.
`targetBase` | Applicable only when baseEditing is set to TRUE. It is used to indicate the target base for base editing systems, default to C for converting C to T in the CBE system. Please change it to A if you intend to use the ABE system.
`editingWindow` | Applicable only when baseEditing is set to TRUE. It is used to indicate the effective editing window to consider for the offtargets search only, default to 4 to 8 which is for the original CBE system. Please change it accordingly if the system you use have a different editing window, or you would like to include offtargets with the target base in a larger editing window.

### Value

results are saved in the file specified by file

### Author(s)

Lihua Julie Zhu

### References

http://bioconductor.org/packages/2.8/bioc/vignettes/BSgenome/inst/doc/ GenomeSearching.pdf

### See Also

offTargetAnalysis

### Examples

     if(interactive())
     {
        gRNAPlusPAM <- DNAString("ACGTACGTACGTACTGACGTCGG")
        x <- DNAString("AAGCGCGATATGACGTACGTACGTACTGACGTCGG")
        chrom.len <- nchar(as.character(x))
        m <- matchPattern(gRNAPlusPAM, x)
        names(m) <- "testing"
        writeHits(gRNA = gRNAPlusPAM, seqname = "chr1",
            matches = m, strand = "+", file = "exampleWriteHits.txt",
            chrom.len = chrom.len, append = FALSE)
     }

[Package CRISPRseek version 1.28.0 Index]