1 // ***************************************************************************
2 // BamIndexFactory_p.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 5 April 2011 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides interface for generating BamIndex implementations
9 // ***************************************************************************
11 #ifndef BAMINDEX_FACTORY_P_H
12 #define BAMINDEX_FACTORY_P_H
14 #include <api/BamIndex.h>
20 class BamIndexFactory {
22 // static interface methods
24 // creates a new BamIndex object, depending on extension of @indexFilename
25 static BamIndex* CreateIndexFromFilename(const std::string& indexFilename,
26 BamReaderPrivate* reader);
27 // creates a new BamIndex object, of requested @type
28 static BamIndex* CreateIndexOfType(const BamIndex::IndexType& type,
29 BamReaderPrivate* reader);
30 // returns name of existing index file that corresponds to @bamFilename
31 // will defer to @preferredType if possible
32 // if @preferredType not found, will attempt to load any supported index type
33 // returns empty string if no index file (of any type) is found
34 static const std::string FindIndexFilename(const std::string& bamFilename,
35 const BamIndex::IndexType& preferredType);
39 // generates index filename from BAM filename (depending on requested type)
40 // if type is unknown, returns empty string
41 static const std::string CreateIndexFilename(const std::string& bamFilename,
42 const BamIndex::IndexType& type);
43 // retrieves file extension (including '.')
44 static const std::string FileExtension(const std::string& filename);
47 } // namespace Internal
48 } // namespace BamTools
50 #endif // BAMINDEX_FACTORY_P_H