Skip to contents

Convert bam files to fastq files.

Usage

Bam2Fastq(
  bam.folder = NULL,
  bam.path = NULL,
  bam.type = c("10x", "other"),
  pair.end = NULL,
  bamtofastq.path = NULL,
  bamtofastq.paras = "--nthreads 4",
  sort.name = FALSE,
  sort.thread = 4
)

Arguments

bam.folder

Folder contains bam files, obtained from DownloadSRA. Default: NULL.

bam.path

Paths of bams. bam.folder and bam.path cannot be both NULL. Default: NULL.

bam.type

The source of bam files, choose from 10x (e.g. CellRanger) or other. Default: 10x.

pair.end

The bam files are pair-end or single-end, used when bam.type is other. Default: NULL (identify with flag).

bamtofastq.path

Path to 10x bamtofastq (bam.type is 10x) or samtools (bam.type is other). Default: NULL (conduct automatic detection with bamtofastq_linux/samtools).

bamtofastq.paras

Parameters for bamtofastq.path. Default: "--nthreads 4".

sort.name

Logical value, whether the bam files are sorted by name, required when bam.type is other. Default: FALSE.

sort.thread

The number of threads for bam sorting, used when bam.type is other. Default: 4.

Value

NULL or paths of failed bams.

Examples

# GSE138266.runs = ExtractRun(acce = "GSE138266", platform = "GPL18573")
# GSE138266.down = DownloadBam(gsm.df = GSE138266.runs, prefetch.path = "/path/to/prefetch",
#                              out.folder = "/path/to/output")
# GSE138266.convert = Bam2Fastq(bam.folder = "/path/to/output", bamtofastq.path = "/path/to/bamtofastq_linux or samtools",
#                               bamtofastq.paras = "--nthreads 4")