Commit a6edcc84 authored by arq5x's avatar arq5x
Browse files

added new "spacing" tool to report distances between intervals in a single file.

parent 2d836be4
......@@ -53,7 +53,7 @@ SUBDIRS = $(SRC_DIR)/annotateBed \
$(SRC_DIR)/mergeFile \
$(SRC_DIR)/multiBamCov \
$(SRC_DIR)/multiIntersectBed \
$(SRC_DIR)/nekSandbox1 \
$(SRC_DIR)/nekSandbox1 \
$(SRC_DIR)/nucBed \
$(SRC_DIR)/pairToBed \
$(SRC_DIR)/pairToPair \
......@@ -64,6 +64,7 @@ SUBDIRS = $(SRC_DIR)/annotateBed \
$(SRC_DIR)/shuffleBed \
$(SRC_DIR)/slopBed \
$(SRC_DIR)/sortBed \
$(SRC_DIR)/spacingFile \
$(SRC_DIR)/split \
$(SRC_DIR)/subtractBed \
$(SRC_DIR)/tagBam \
......
......@@ -72,6 +72,7 @@ int shuffle_main(int argc, char* argv[]); //
int slop_main(int argc, char* argv[]); //
int split_main(int argc, char* argv[]); //
int sort_main(int argc, char* argv[]); //
int spacing_main(int argc, char* argv[]); //
int subtract_main(int argc, char* argv[]); //
int tagbam_main(int argc, char* argv[]);//
int unionbedgraphs_main(int argc, char* argv[]);//
......@@ -105,6 +106,7 @@ int main(int argc, char *argv[])
else if (sub_cmd == "sort") return sort_main(argc-1, argv+1);
else if (sub_cmd == "random") return random_main(argc-1, argv+1);
else if (sub_cmd == "shuffle") return shuffle_main(argc-1, argv+1);
else if (sub_cmd == "spacing") return spacing_main(argc-1, argv+1);
else if (sub_cmd == "annotate") return annotate_main(argc-1, argv+1);
// Multi-way file comparisonstools
......@@ -207,7 +209,8 @@ int bedtools_help(void)
cout << " sort " << "Order the intervals in a file.\n";
cout << " random " << "Generate random intervals in a genome.\n";
cout << " shuffle " << "Randomly redistrubute intervals in a genome.\n";
cout << " sample " << "Sample random records from file using reservoir sampling.\n";
cout << " sample " << "Sample random records from file using reservoir sampling.\n";
cout << " spacing " << "Report the spacing between intervals in a file.\n";
cout << " annotate " << "Annotate coverage of features from multiple files.\n";
cout << endl;
......@@ -253,6 +256,7 @@ int bedtools_help(void)
cout << " makewindows " << "Make interval \"windows\" across a genome.\n";
cout << " groupby " << "Group by common cols. & summarize oth. cols. (~ SQL \"groupBy\")\n";
cout << " expand " << "Replicate lines based on lists of values in columns.\n";
cout << " split " << "Split a file into multiple files with equal records or base pairs.\n";
cout << endl;
cout << "[ General help ]" << endl;
......
......@@ -64,6 +64,7 @@ ContextBase::ContextBase()
{
_programNames["intersect"] = INTERSECT;
_programNames["sample"] = SAMPLE;
_programNames["spacing"] = SPACING;
_programNames["map"] = MAP;
_programNames["merge"] = MERGE;
......
......@@ -38,7 +38,7 @@ public:
typedef enum {UNSPECIFIED_PROGRAM, INTERSECT, WINDOW, CLOSEST, COVERAGE, MAP, GENOMECOV, MERGE, CLUSTER,
COMPLEMENT, SUBTRACT, SLOP, FLANK, SORT, RANDOM, SAMPLE, SHUFFLE, ANNOTATE, MULTIINTER, UNIONBEDG, PAIRTOBED,
PAIRTOPAIR,BAMTOBED, BEDTOBAM, BEDTOFASTQ, BEDPETOBAM, BED12TOBED6, GETFASTA, MASKFASTA, NUC,
MULTICOV, TAG, JACCARD, OVERLAP, IGV, LINKS,MAKEWINDOWS, GROUPBY, EXPAND } PROGRAM_TYPE;
MULTICOV, TAG, JACCARD, OVERLAP, IGV, LINKS,MAKEWINDOWS, GROUPBY, EXPAND, SPACING } PROGRAM_TYPE;
PROGRAM_TYPE getProgram() const { return _program; }
FileRecordMgr *getFile(int fileIdx) { return _files[fileIdx]; }
......
......@@ -20,9 +20,9 @@ INCLUDES = -I$(UTILITIES_DIR)/general/ \
# define our source and object files
# ----------------------------------
SOURCES= ContextBase.cpp ContextBase.h ContextIntersect.cpp ContextIntersect.h ContextFisher.cpp ContextFisher.h ContextMap.cpp \
ContextMap.h ContextSample.cpp ContextSample.h ContextMerge.h ContextMerge.cpp ContextJaccard.h ContextJaccard.cpp \
ContextMap.h ContextSample.cpp ContextSpacing.cpp ContextSample.h ContextSpacing.h ContextMerge.h ContextMerge.cpp ContextJaccard.h ContextJaccard.cpp \
ContextClosest.cpp ContextClosest.h
OBJECTS= ContextBase.o ContextIntersect.o ContextFisher.o ContextMap.o ContextSample.o ContextMerge.o ContextJaccard.o ContextClosest.o
OBJECTS= ContextBase.o ContextIntersect.o ContextFisher.o ContextMap.o ContextSample.o ContextSpacing.o ContextMerge.o ContextJaccard.o ContextClosest.o
_EXT_OBJECTS=ParseTools.o QuickString.o
EXT_OBJECTS=$(patsubst %,$(OBJ_DIR)/%,$(_EXT_OBJECTS))
BUILT_OBJECTS= $(patsubst %,$(OBJ_DIR)/%,$(OBJECTS))
......@@ -42,6 +42,7 @@ clean:
$(OBJ_DIR)/ContextFisher.o \
$(OBJ_DIR)/ContextMap.o \
$(OBJ_DIR)/ContextSample.o \
$(OBJ_DIR)/ContextSpacing.o \
$(OBJ_DIR)/ContextMerge.o \
$(OBJ_DIR)/ContextJaccard.o \
$(OBJ_DIR)/ContextClosest.o \
......
......@@ -273,6 +273,10 @@ void RecordOutputMgr::printRecord(RecordKeyVector &keyList, RecordKeyVector *blo
printKeyAndTerminate(keyList);
_currBamBlockList = NULL;
return;
} else if (_context->getProgram() == ContextBase::SPACING) {
keyList.getKey()->print(_outBuf);
_currBamBlockList = NULL;
return;
}
}
......
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