Filter the transcript coverage by applying a filter function to the coverage values.
Arguments
- x
The tibble returned by
get_coverage
, or a BAM file path, or a GAlignments object.- filter_fn
The filter function to apply to the coverage values. The function should take a numeric vector of coverage values and return a logical value (TRUE if the transcript passes the filter, FALSE otherwise). The default filter function is
convolution_filter
, which filters out transcripts with sharp drops / rises in coverage.
Examples
ppl <- example_pipeline("BulkPipeline")
#> Writing configuration parameters to: /tmp/RtmpA5lNG6/file329035b901ff/config_file_12944.json
#> Configured steps:
#> genome_alignment: TRUE
#> isoform_identification: TRUE
#> read_realignment: TRUE
#> transcript_quantification: TRUE
#> samtools not found, will use Rsamtools package instead
steps(ppl)["isoform_identification"] <- FALSE
ppl <- run_step(ppl, "read_realignment")
#> ── Running step: read_realignment @ Mon Jun 23 02:41:44 2025 ───────────────────
#> Using reference annotation for transcriptome assembly.
#> Import genomic features from the file as a GRanges object ...
#> OK
#> Prepare the 'metadata' data frame ...
#> OK
#> Make the TxDb object ...
#> Warning: The "phase" metadata column contains non-NA values for features of type
#> stop_codon. This information was ignored.
#> Warning: genome version information is not available for this TxDb object
#> OK
#> Realigning sample sample1 -> /tmp/RtmpA5lNG6/file329035b901ff/sample1_realign2transcript.bam
#> Warning: samtools not found, using Rsamtools instead, this could be slower and might fail for large BAM files.
#> Skipped sorting BAM files.
#> Realigning sample sample2 -> /tmp/RtmpA5lNG6/file329035b901ff/sample2_realign2transcript.bam
#> Warning: samtools not found, using Rsamtools instead, this could be slower and might fail for large BAM files.
#> Skipped sorting BAM files.
#> Realigning sample sample3 -> /tmp/RtmpA5lNG6/file329035b901ff/sample3_realign2transcript.bam
#> Warning: samtools not found, using Rsamtools instead, this could be slower and might fail for large BAM files.
#> Skipped sorting BAM files.
x <- get_coverage(ppl@transcriptome_bam[[1]])
nrow(x)
#> [1] 1
filter_coverage(x) |>
nrow()
#> 1 transcripts found in the BAM file.
#> 0(0%) transcripts failed the filter.
#> Failed transcripts account for 0 reads, out of 83(0%) reads in total.
#> [1] 1