1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
/*++
Module Name:
FileFormat.h
Abstract:
Headers for the FileFormat class for the SNAP sequencer
Authors:
Ravi Pandya, February 2013
Environment:
User mode service.
Revision History:
--*/
#pragma once
#include "Compat.h"
#include "Tables.h"
#include "Read.h"
#include "Genome.h"
#include "LandauVishkin.h"
#include "AffineGap.h"
#include "AffineGapVectorized.h"
#include "AlignerOptions.h"
#include "Genome.h"
//
// abstract class defining format-specific operations
// for reading and writing files of reads
//
class FileFormat
{
public:
//
// files
//
// reading
//
virtual void getSortInfo(const Genome* genome, char* buffer, _int64 bytes, GenomeLocation* o_location, GenomeDistance* o_readBytes, OriginalContigNum* o_refID = NULL, int* o_pos = NULL) const = 0;
/*
virtual ReadReader* createReader(const DataSupplier* supplier, const char *fileName,
const Genome *genome, _int64 startingOffset, _int64 amountOfFileToProcess,
ReadClippingType clipping = ClipBack) = 0;
virtual PairedReadReader* createPairedReader(const DataSupplier* supplier, const char *fileName,
const Genome *genome, _int64 startingOffset, _int64 amountOfFileToProcess,
ReadClippingType clipping = ClipBack) = 0;
virtual ReadSupplierGenerator *createReadSupplierGenerator(const char *fileName, int numThreads,
const Genome *genome, ReadClippingType clipping = ClipBack) = 0;
virtual PairedReadSupplierGenerator *createPairedReadSupplierGenerator(const char *fileName,
int numThreads, const Genome *genome, ReadClippingType clipping = ClipBack) = 0;
// parse header and match against genome
virtual bool parseHeader(const char *fileName, char *firstLine, char *endOfBuffer,
const Genome *genome, _int64 *o_headerSize) = 0;
*/
protected:
static const char* RGLineToAux;
static void setupReaderContext(AlignerOptions* options, ReaderContext* readerContext, bool bam);
public:
virtual void setupReaderContext(AlignerOptions* options, ReaderContext* readerContext) const = 0;
//
// writing
//
virtual ReadWriterSupplier* getWriterSupplier(AlignerOptions* options, const Genome* genome) const = 0;
virtual bool writeHeader(
const ReaderContext& context, char *header, size_t headerBufferSize, size_t *headerActualSize,
bool sorted, int argc, const char **argv, const char *version, const char *rgLine, bool omitSQLines) const = 0;
virtual bool writePairs(
const ReaderContext& context, LandauVishkinWithCigar * lv, AffineGapVectorizedWithCigar * ag,
bool useAffineGap, char * buffer, size_t bufferSpace,
size_t * spaceUsed, size_t* qnameLen, Read ** reads, GenomeLocation* locations, PairedAlignmentResult* result,
bool isSecondary, bool emitInternalScore, char *internalScoreTag, bool attachAlignmentTime, int * writeOrder,
int* cumulativePositiveAddFrontClipping, bool * secondReadLocationChanged, bool * outOfSpace) const = 0;
virtual bool writeRead(
const ReaderContext& context, LandauVishkinWithCigar * lv, char * buffer, size_t bufferSpace,
size_t * spaceUsed, size_t qnameLen, Read * read, AlignmentResult result,
int mapQuality, GenomeLocation genomeLocation, Direction direction, bool secondaryAlignment, bool supplementaryAlignment, int* o_addFrontClipping,
int internalScore, bool emitInternalScore, char *internalScoreTag, bool attachAlignmentTime, _int64 alignmentTimeInNanoseconds,
int bpClippedBefore = 0, int bpClippedAfter = 0,
bool hasMate = false, bool firstInPair = false, Read * mate = NULL,
AlignmentResult mateResult = NotFound, GenomeLocation mateLocation = 0, Direction mateDirection = FORWARD,
bool alignedAsPair = false, int mateBpClippedBefore = 0, int mateBpClippedAfter = 0) const = 0;
virtual bool writeRead(
const ReaderContext& context, AffineGapVectorizedWithCigar * ag, char * buffer, size_t bufferSpace,
size_t * spaceUsed, size_t qnameLen, Read * read, AlignmentResult result,
int mapQuality, GenomeLocation genomeLocation, Direction direction, bool secondaryAlignment, bool supplementaryAlignment, int* o_addFrontClipping,
int score, int internalScore, bool emitInternalScore, char *internalScoreTag, bool attachAlignmentTime, _int64 alignmentTimeInNanoseconds,
int bpClippedBefore = 0, int bpClippedAfter = 0,
bool hasMate = false, bool firstInPair = false, Read * mate = NULL,
AlignmentResult mateResult = NotFound, GenomeLocation mateLocation = 0, Direction mateDirection = FORWARD,
bool alignedAsPair = false, int mateBpClippedBefore = 0, int mateBpClippedAfter = 0) const = 0;
//
// formats
//
static const FileFormat* SAM[2]; // 0 for =, 1 for M (useM flag)
static const FileFormat* BAM[2];
static const FileFormat* FASTQ;
static const FileFormat* FASTQZ;
};
|