View source: R/to_genomic_ranges.R
| to_genomic_ranges_fast | R Documentation |
Drop-in replacement for to_genomic_ranges that uses the fast
coordinate backend in coor_to_genomic_ranges for genomic
coordinate input. Accepts the same input_seq and complement_seq
arguments as to_genomic_ranges, plus a list input
list(pkg_name = ..., seq = ...) for large tiling jobs.
This function processes a vector of sequences string, a FASTA file, or a character vector with genomic coordinates into a GenomicRanges object, optionally including complementary sequences. sequence names are parsed based on their format: - If names have this pattern "chr:start-end:strand:species[:name]" (e.g., "chr1:1-5:+:seq_1"), parse components into seqnames, ranges, strand, and name. - If names have this pattern "chr:start-end:strand" (e.g., "chr1:1-5:+"), parse components into seqnames, ranges, and strand. - If names have this pattern "chr:start-end" (e.g., "chr1:1-5"), parse components into seqnames and ranges. - If no names are provided, use default values: seqnames = "chr1", start = 1, width = sequence length, strand = "*", name = "1", etc. Complementary sequences are either provided or automatically generated.
to_genomic_ranges_fast(
input_seq,
complement_seq = NULL,
method = c("vectorized", "preload_chr")
)
to_genomic_ranges(input_seq, complement_seq = NULL)
input_seq |
Input sequence(s) in 5' to 3' direction. Can be provided as either:
- A character string (e.g., c("ATGCG", "GCTAG"))
- A path to a FASTA file containing the sequence(s)
- A character vector where each element is a string in the format "chr:start-end:strand:species" #' (e.g., "chr1:100-200:+:BSgenome.Hsapiens.UCSC.hg38"). Strand is "+" for positive or "-" for negative.
- chr: Chromosome ID
- start: Start position
- end: End position
- strand: positive or negative strand
- species: Species name for reference genome (e.g., "BSgenome.Hsapiens.UCSC.hg38"), see |
complement_seq |
Optional complementary sequences. If NULL, complementary sequences will be auto-generated. otherwise, the complementary sequences will be used as metadata. Can be provided as format of input_seq. |
method |
Sequence extraction method passed to
|
A GRanges object. See coor_to_genomic_ranges for
metadata columns when coordinate input is used.
A GenomicRanges object with seqnames, ranges, strand, name, sequence, Complement, and Tm as metadata.
Junhui Li
## Not run:
gr <- to_genomic_ranges_fast(
list(
pkg_name = "BSgenome.Hsapiens.UCSC.hg38",
seq = c("chr1:1000-1199:+:win1", "chr1:1200-1399:+:win2")
)
)
## End(Not run)
# Using a character vector with auto-generated complementary sequences
seqs <- c("ATGCG", "GCTAG")
names(seqs) <- c("chr1:1-5:+:seq_1", "chr2:1-5:+")
gr <- to_genomic_ranges(seqs)
gr
# Using a character vector with provided complementary sequences
seqs <- c("ATGCG", "GCTAG")
comp_seqs <- c("TACGC", "CGTA")
gr <- to_genomic_ranges(seqs, comp_seqs)
gr
# Using a FASTA file
gr <- to_genomic_ranges(system.file("extdata", "example1.fasta", package = "TmCalculator"))
## Not run:
# Using a character vector with genomic coordinates
seqs <- c(
"chr1:1898000-1898050:+:BSgenome.Hsapiens.UCSC.hg38",
"chr2:2563000-2563050:-:BSgenome.Hsapiens.UCSC.hg38"
)
gr <- to_genomic_ranges(seqs)
gr
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.