Skip to contents

Uses minimap2 to re-align reads to transcriptome

Usage

minimap2_realign(
  config,
  fq_in,
  outdir,
  minimap2,
  samtools = NULL,
  prefix = NULL,
  minimap2_args,
  sort_by,
  threads = 1
)

Arguments

config

Parsed list of FLAMES config file

fq_in

File path to the fastq file used as a query sequence file

outdir

Output folder

minimap2

Path to minimap2 binary

samtools

path to the samtools binary, required for large datasets since Rsamtools does not support CSI indexing

prefix

String, the prefix (e.g. sample name) for the outputted BAM file

minimap2_args

vector of command line arguments to pass to minimap2

sort_by

String, If provided, sort the BAM file by this tag instead of by position.

threads

Integer, threads for minimap2 to use, see minimap2 documentation for details, FLAMES will try to detect cores if this parameter is not provided.

Value

a data.frame summarising the reads aligned

See also

[minimap2_align()]

Examples

outdir <- tempfile()
dir.create(outdir)
annotation <- system.file('extdata', 'rps24.gtf.gz', package = 'FLAMES')
genome_fa <- system.file('extdata', 'rps24.fa.gz', package = 'FLAMES')
fasta <- annotation_to_fasta(annotation, genome_fa, outdir)
#> 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.
#> OK
fastq <- system.file('extdata', 'fastq', 'demultiplexed.fq.gz', package = 'FLAMES')
minimap2_realign(
  config = jsonlite::fromJSON(
    system.file("extdata", "config_sclr_nanopore_3end.json", package = 'FLAMES')
  ),
  fq_in = fastq,
  outdir = outdir
)
#> 02:13:37 AM Fri Oct 25 2024 minimap2_realign
#> Sorting by position
#>                                                        total mapped primary
#> /tmp/RtmpoS7Kzz/file1f6d55ae3f4/realign2transcript.bam    31     31      10
#>                                                        secondary
#> /tmp/RtmpoS7Kzz/file1f6d55ae3f4/realign2transcript.bam        21