Mercurial > repos > aaronquinlan > multi_intersect
diff BEDTools-Version-2.14.3/src/utils/bedFilePE/bedFilePE.h @ 0:dfcd8b6c1bda
Uploaded
author | aaronquinlan |
---|---|
date | Thu, 03 Nov 2011 10:25:04 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BEDTools-Version-2.14.3/src/utils/bedFilePE/bedFilePE.h Thu Nov 03 10:25:04 2011 -0400 @@ -0,0 +1,93 @@ +#ifndef BEDFILEPE_H +#define BEDFILEPE_H + +#include <vector> +#include <map> +#include <string> +#include <iostream> +#include <fstream> +#include <sstream> +#include <cstring> +#include <algorithm> +#include "bedFile.h" +#include "lineFileUtilities.h" + +using namespace std; + + +/* + Structure for paired-end records +*/ +struct BEDPE { + + // UCSC BED fields + string chrom1; + CHRPOS start1; + CHRPOS end1; + + string chrom2; + CHRPOS start2; + CHRPOS end2; + + string name; + string score; + + string strand1; + string strand2; + + vector<string> otherFields; +}; + + + + +//************************************************ +// BedFile Class methods and elements +//************************************************ +class BedFilePE { + +public: + + // Constructor + BedFilePE(string &); + + // Destructor + ~BedFilePE(void); + + // Open a BEDPE file for reading (creates an istream pointer) + void Open(void); + + // Close an opened BEDPE file. + void Close(void); + + // Get the next BED entry in an opened BED file. + BedLineStatus GetNextBedPE (BEDPE &bedpe, int &lineNum); + + + // Methods + + void reportBedPETab(const BEDPE &a); + void reportBedPENewLine(const BEDPE &a); + void loadBedPEFileIntoMap(); + void splitBedPEIntoBeds(const BEDPE &a, const int &lineNum, MATE *bedEntry1, MATE *bedEntry2); + + + void FindOverlapsPerBin(int bEnd, string chrom, CHRPOS start, CHRPOS end, string name, string strand, + vector<MATE> &hits, float overlapFraction, bool forceStrand, bool enforceDiffNames); + + + string bedFile; + unsigned int bedType; + + masterMateMap bedMapEnd1; + masterMateMap bedMapEnd2; + +private: + istream *_bedStream; + + // methods + BedLineStatus parseLine (BEDPE &bedpe, const vector<string> &lineVector, int &lineNum); + bool parseBedPELine (BEDPE &bed, const vector<string> &lineVector, const int &lineNum); +}; + +#endif /* BEDFILEPE_H */