SamFilter.h

00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef __SAM_FILTER_H__
00019 #define __SAM_FILTER_H__
00020 
00021 #include "SamRecord.h"
00022 #include "GenomeSequence.h"
00023 
00024 class SamFilter
00025 {
00026 public:
00027     enum FilterStatus {
00028         NONE, // The filter did not affect the read.
00029         CLIPPED, // Filtering clipped the read.
00030         FILTERED // Filtering caused the read to be modified to unmapped.
00031     };
00032 
00033     // Clip the read based on the specified mismatch threshold.
00034     // Returns how the read was affected, 
00035     //     NONE if the read was not modified,
00036     //     CLIPPED if the read was clipped,
00037     //     FILTERED if the whole read would have been clipped so instead the
00038     //              read was modified to unmapped.
00039     static FilterStatus clipOnMismatchThreshold(SamRecord& record, 
00040                                                 GenomeSequence& refSequence,
00041                                                 double mismatchThreshold);
00042 
00043     // Filter the read based on the specified quality threshold.
00044     // Returns how the read was affected, 
00045     //     NONE if the read was not modified,
00046     //     FILTERED if the read was modified to unmapped because it was over
00047     //              the quality threshold.
00048     static FilterStatus filterOnMismatchQuality(SamRecord& record,
00049                                                 GenomeSequence& refSequence,
00050                                                 uint32_t qualityThreshold, 
00051                                                 uint8_t defaultQualityInt);
00052     
00053     static uint32_t sumMismatchQuality(SamRecord& record, 
00054                                        GenomeSequence& refSequence,
00055                                        uint8_t defaultQualityInt);
00056 
00057     // Filter the read out (mark it as unmapped.
00058     static void filterRead(SamRecord& record);
00059 };
00060 
00061 #endif
00062 
Generated on Wed Nov 17 15:38:27 2010 for StatGen Software by  doxygen 1.6.3