Commit e1444972 authored by bow's avatar bow
Browse files

Update returned filter function in WipeReads to use SAMRecords only

parent 2c5d1151
...@@ -149,7 +149,7 @@ object WipeReads extends MainCommand { ...@@ -149,7 +149,7 @@ object WipeReads extends MainCommand {
inBAM: File, inBAMIndex: File = null, inBAM: File, inBAMIndex: File = null,
filterOutMulti: Boolean = true, filterOutMulti: Boolean = true,
minMapQ: Int = 0, readGroupIDs: Set[String] = Set(), minMapQ: Int = 0, readGroupIDs: Set[String] = Set(),
bloomSize: Int = 100000000, bloomFp: Double = 1e-10): (Any => Boolean) = { bloomSize: Int = 100000000, bloomFp: Double = 1e-10): (SAMRecord => Boolean) = {
// TODO: implement optional index creation // TODO: implement optional index creation
/** Function to check for BAM file index and return a SAMFileReader given a File */ /** Function to check for BAM file index and return a SAMFileReader given a File */
...@@ -318,20 +318,14 @@ object WipeReads extends MainCommand { ...@@ -318,20 +318,14 @@ object WipeReads extends MainCommand {
.foldLeft(bfm.create())(_.++(_)) .foldLeft(bfm.create())(_.++(_))
if (filterOutMulti) if (filterOutMulti)
(rec: Any) => rec match { (rec: SAMRecord) => filteredOutSet.contains(rec.getReadName).isTrue
case rec: SAMRecord => filteredOutSet.contains(rec.getReadName).isTrue
case rec: String => filteredOutSet.contains(rec).isTrue
case _ => false
}
else else
(rec: Any) => rec match { (rec: SAMRecord) => {
case rec: SAMRecord if rec.getReadPairedFlag => if (rec.getReadPairedFlag)
filteredOutSet.contains(rec.getReadName + "_" + rec.getAlignmentStart).isTrue && filteredOutSet.contains(rec.getReadName + "_" + rec.getAlignmentStart).isTrue &&
filteredOutSet.contains(rec.getReadName + "_" + rec.getMateAlignmentStart).isTrue filteredOutSet.contains(rec.getReadName + "_" + rec.getMateAlignmentStart).isTrue
case rec: SAMRecord if !rec.getReadPairedFlag => else
filteredOutSet.contains(rec.getReadName + "_" + rec.getAlignmentStart).isTrue filteredOutSet.contains(rec.getReadName + "_" + rec.getAlignmentStart).isTrue
case rec: String => filteredOutSet.contains(rec).isTrue
case _ => false
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment