Description Usage Arguments Details Author(s) Examples
Take a list of SAM files, unknown, mitochondrial, and "random" chromosomes, and save each to BAM Needs Rsamtools.
1 2 | sam_to_bam(filenames, fileFilteredSuffix = ".filtered.sam",
fileBamSuffix = ".filtered", outDest = "./", filterVerbose = FALSE)
|
filenames |
Character - List of SAM files |
fileFilteredSuffix |
String - |
fileBamSuffix |
String - |
outDest |
String - |
filterVerbose |
Logical - |
# Filter out mitochondrial, unmapped, and "random" chromosome reads from sam files generated by mapping with STAR. Convert the sam file to bam, sort the bam, and create an index file for it.. This script operates on sam files generated by mapping with STAR. Not bam, because Erin found that "random" chromosome reads weren't getting removed from bams along with the mito and unknown ones. But maybe I should try that again now that we're doing three separate commands; maybe that was the problem somehow. TIME: On yasuimac/Smintheus: 3.5 G sam file - 4m/5.5m filtering, 5.5m/6.6m asBam() 5 G sam file - 5.8m filtering, 7m asBam() 18 G sam file - Xm/26.6m filtering, Xm/33.5m asBam() Here are the equivalent commands at the command line: Filter sam file (took maybe 3-4m for a 4.6G file, and cut it down to 3.6G): sed '/chrM/d;/random/d;/chrUn/d' samplename_mapped_Aligned.out.sam > samplename_mapped_Aligned.out.filter.sam Convert to bam: samtools view -b samplename_mapped_Aligned.out.filter.sam > samplename_mapped_Aligned.out.filter.bam Sort the bam file (it will create a bunch of temporary files while it's working, and then merge them): samtools sort samplename_mapped_Aligned.out.filter.bam samplename_mapped_Aligned.out.filter.sorted -@ 4 Index the bam file: samtools index samplename_mapped_Aligned.out.filter.sorted.bam
Emma Myers
1 2 | fn = list.files(pattern='.sam')
sam_to_bam(fn, outDest='/path/to/filtered/sams')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.