bc_cure_depth filters barcodes by the read counts or the UMI counts.
bc_cure_depth(barcodeObj, depth = 0, isUpdate = TRUE)
# S4 method for class 'BarcodeObj'
bc_cure_depth(barcodeObj, depth = 0, isUpdate = TRUE)
A BarcodeObj object.
A numeric or a vector of numeric, specifying the threshold of
minimum count for a barcode to keep. If the input is a vector and the vector
length is not the same as the sample number, the element will be repeatedly
used. And when the depth argument is a number with a negative value, automatic
cutoff point will be chosen by bc_auto_cutoff
function for each
samples. See bc_auto_cutoff
for details.
A logical value. If TRUE, the cleanBc
slot in
BarcodeObj
will be used preferentially, otherwise the messyBc
slot will be used. If no cleanBc is available, messyBc
will be used.
A BarcodeObj
object with cleanBc
slot updated or
created.
data(bc_obj)
d1 <- data.frame(
seq = c(
"ACTTCGATCGATCGAAAAGATCGATCGATC",
"AATTCGATCGATCGAAGAGATCGATCGATC",
"CCTTCGATCGATCGAAGAAGATCGATCGATC",
"TTTTCGATCGATCGAAAAGATCGATCGATC",
"AAATCGATCGATCGAAGAGATCGATCGATC",
"CCCTCGATCGATCGAAGAAGATCGATCGATC",
"GGGTCGATCGATCGAAAAGATCGATCGATC",
"GGATCGATCGATCGAAGAGATCGATCGATC",
"ACTTCGATCGATCGAACAAGATCGATCGATC",
"GGTTCGATCGATCGACGAGATCGATCGATC",
"GCGTCCATCGATCGAAGAAGATCGATCGATC"
),
freq = c(
30, 60, 9, 10, 14, 5, 10, 30, 6, 4 , 6
)
)
pattern <- "([ACTG]{3})TCGATCGATCGA([ACTG]+)ATCGATCGATC"
bc_obj <- bc_extract(list(test = d1), pattern, sample_name=c("test"),
pattern_type=c(UMI=1, barcode=2))
# Remove barcodes with depth < 5
(bc_cured <- bc_cure_depth(bc_obj, depth=5))
#> ------------
#> bc_cure_depth: isUpdate is TRUE, update the cleanBc.
#> ------------
#> Bonjour le monde, This is a BarcodeObj.
#> ----------
#> It contains:
#> ----------
#> @metadata: 3 field(s) available:
#> raw_read_count barcode_read_count depth_cutoff
#> ----------
#> @messyBc: 1 sample(s) for raw barcodes:
#> In sample $test there are: 10 Tags
#> ----------
#> @cleanBc: 1 samples for cleaned barcodes
#> In sample $test there are: 4 barcodes
bc_2matrix(bc_cured)
#> test
#> AAAG 50
#> ACAAG 6
#> AGAAG 14
#> AGAG 104
# Use UMI information, filter the barcode < 5 UMI
bc_umi_cured <- bc_cure_umi(bc_obj, depth =0, doFish=TRUE, isUniqueUMI=TRUE)
bc_cure_depth(bc_umi_cured, depth = 5)
#> ------------
#> bc_cure_depth: isUpdate is TRUE, update the cleanBc.
#> ------------
#> Bonjour le monde, This is a BarcodeObj.
#> ----------
#> It contains:
#> ----------
#> @metadata: 3 field(s) available:
#> raw_read_count barcode_read_count depth_cutoff
#> ----------
#> @messyBc: 1 sample(s) for raw barcodes:
#> In sample $test there are: 10 Tags
#> ----------
#> @cleanBc: 1 samples for cleaned barcodes
#> In sample $test there are: 0 barcodes
###