Extracts unmapped reads from BAM and writes them to a FASTA file

extract_unmapped(bam, outfa = NULL)

Arguments

bam

path to BAM file.

outfa

path to output FASTA (default is same directory as input BAM).

Value

path to FASTA file of unmapped reads.

Author

Kathryn Rozen-Gagnon

Examples

testFasta <- system.file("extdata/hg19Small.fa",package="CLIPflexR")
myIndex <- suppressWarnings(bowtie2_index(testFasta, overwrite=TRUE))
testFQ <- system.file("extdata/Fox3_Std_small.fq.gz",package="CLIPflexR")
FqFile_FF <- ctk_fastqFilter(testFQ,qsFilter="mean:0-29:20")
FqFile <- decompress(FqFile_FF,overwrite=TRUE)
FqFile_clipped <- fastx_clipper(FqFile,length=20)
FqFile_QF <- fastq_quality_trimmer(FqFile_clipped)
FqFile_Col <- ctk_fastq2collapse(FqFile_QF)
FqFile_QFColStripped <- ctk_stripBarcode(FqFile_Col,linkerlength=5, inputFormat="fastq")
bam <- suppressWarnings(bowtie_align(FqFile_QFColStripped,myIndex, 
overwrite=TRUE, inputFormat="fastq"))
extract_unmapped(bam)
#> [1] "/Users/runner/work/_temp/Library/CLIPflexR/extdata/Collapsed_QT_FF_Fox3_Std_small_clip_rm5_unmapped.fa"