Description Usage Arguments Details Examples
Change tag value in sam/bam file using regular expression.
1 | bamtagregex(input, output, tag, pattern, replace, remake = FALSE)
|
input |
an input sam/bam file |
output |
an output sam/bam file |
tag |
a tag to modify |
pattern |
a regex pattern |
replace |
a string to replace matched pattern |
remake |
optional remake the output if it already exists |
This code is a thin wrapper over the Python script bamtagregex.py
found
in the package's inst
folder.
The bamtagregex.py
uses the amazing pysam
package to manipulate the sam/bam files.
The Python's pysam
package is powered by the htslib
library. the same library
that powers samtools
.
In R, there is a similar package to pysam
, the Rsamtools
found in bioconductor. But this
library reads the whole file at once (instead of using memory efficient iterators), which
makes working with a large bam files less than ideal.
1 2 3 4 5 | ## Not run:
# Replace the end of 10x barcode from "-1" to "-baz"
bamtagregex("foo.bam", "bar.bam", "CB", "-1", "-baz")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.