Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bedtools2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R3
legacy
bedtools2
Commits
2b1df940
Commit
2b1df940
authored
10 years ago
by
arq5x
Browse files
Options
Downloads
Patches
Plain Diff
right, the actual spacing code.
parent
3bea2a71
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/spacingFile/Makefile
+44
-0
44 additions, 0 deletions
src/spacingFile/Makefile
src/spacingFile/SpacingFile.cpp
+81
-0
81 additions, 0 deletions
src/spacingFile/SpacingFile.cpp
src/spacingFile/SpacingFile.h
+35
-0
35 additions, 0 deletions
src/spacingFile/SpacingFile.h
with
160 additions
and
0 deletions
src/spacingFile/Makefile
0 → 100644
+
44
−
0
View file @
2b1df940
UTILITIES_DIR
=
../utils/
OBJ_DIR
=
../../obj/
BIN_DIR
=
../../bin/
# -------------------
# define our includes
# -------------------
INCLUDES
=
-I
$(
UTILITIES_DIR
)
/Contexts/
\
-I
$(
UTILITIES_DIR
)
/general/
\
-I
$(
UTILITIES_DIR
)
/fileType/
\
-I
$(
UTILITIES_DIR
)
/gzstream/
\
-I
$(
UTILITIES_DIR
)
/GenomeFile/
\
-I
$(
UTILITIES_DIR
)
/BamTools/include
\
-I
$(
UTILITIES_DIR
)
/BamTools/src
\
-I
$(
UTILITIES_DIR
)
/BlockedIntervals
\
-I
$(
UTILITIES_DIR
)
/BamTools-Ancillary
\
-I
$(
UTILITIES_DIR
)
/FileRecordTools/
\
-I
$(
UTILITIES_DIR
)
/FileRecordTools/FileReaders/
\
-I
$(
UTILITIES_DIR
)
/FileRecordTools/Records/
\
-I
$(
UTILITIES_DIR
)
/KeyListOps/
\
-I
$(
UTILITIES_DIR
)
/RecordOutputMgr/
\
-I
$(
UTILITIES_DIR
)
/version/
# ----------------------------------
# define our source and object files
# ----------------------------------
SOURCES
=
spacingMain.cpp SpacingFile.cpp SpacingFile.h
OBJECTS
=
spacingMain.o SpacingFile.o
BUILT_OBJECTS
=
$(
patsubst %,
$(
OBJ_DIR
)
/%,
$(
OBJECTS
))
PROGRAM
=
spacing
all
:
$(BUILT_OBJECTS)
.PHONY
:
all
$(BUILT_OBJECTS)
:
$(SOURCES)
@
echo
" * compiling"
$(
*
F
)
.cpp
@$(
CXX
)
-c
-o
$@
$(
*
F
)
.cpp
$(
LDFLAGS
)
$(
CXXFLAGS
)
$(
DFLAGS
)
$(
INCLUDES
)
clean
:
@
echo
"Cleaning up."
@
rm
-f
$(
OBJ_DIR
)
/sampleMain.o
$(
OBJ_DIR
)
/SpacingFile.o
.PHONY
:
clean
This diff is collapsed.
Click to expand it.
src/spacingFile/SpacingFile.cpp
0 → 100644
+
81
−
0
View file @
2b1df940
/*
* SpacingFile.cpp
*
* Created on: Nov 18, 2013
* Author: nek3d
*/
#include
"SpacingFile.h"
#include
"ContextSpacing.h"
#include
"FileRecordMgr.h"
#include
"RecordOutputMgr.h"
SpacingFile
::
SpacingFile
(
ContextSpacing
*
context
)
:
_context
(
context
),
_inputFile
(
NULL
),
_outputMgr
(
NULL
)
{}
SpacingFile
::~
SpacingFile
()
{
}
bool
SpacingFile
::
getSpacing
()
{
//we're only operating on one file, so the idx is zero.
_inputFile
=
_context
->
getFile
(
0
);
_outputMgr
=
new
RecordOutputMgr
();
_outputMgr
->
init
(
_context
);
Record
*
prev
=
NULL
;
Record
*
curr
=
NULL
;
QuickString
distance
;
while
(
!
_inputFile
->
eof
())
{
Record
*
curr
=
_inputFile
->
getNextRecord
();
// no more records
if
(
curr
==
NULL
)
{
continue
;
}
// first record in file.
if
(
prev
==
NULL
)
{
distance
.
append
(
"."
);
}
// the meat of the file
else
{
// current and previous records are on the same chromosome.
if
(
curr
->
getChrName
()
==
prev
->
getChrName
())
{
// do curr and prev overlap?
if
(
curr
->
sameChromIntersects
(
prev
,
false
,
false
,
1E-9
,
false
))
distance
.
append
(
0
);
else
distance
.
append
(
curr
->
getStartPos
()
-
prev
->
getEndPos
());
}
// we have changed chromosomes
else
if
(
curr
->
getChrName
()
!=
prev
->
getChrName
())
{
distance
.
append
(
"."
);
}
}
// report distance between current and previous intervals
_outputMgr
->
printRecord
(
curr
,
distance
);
// memory cleanup
_inputFile
->
deleteRecord
(
prev
);
distance
.
clear
();
// current become previous in prep for next record in file.
prev
=
curr
;
}
// cleanup
delete
_outputMgr
;
_inputFile
->
close
();
return
true
;
}
This diff is collapsed.
Click to expand it.
src/spacingFile/SpacingFile.h
0 → 100644
+
35
−
0
View file @
2b1df940
/*
* SpacingFile.h
*
* Created on: Nov 18, 2013
* Author: nek3d
*/
#ifndef SPACINGFILE_H_
#define SPACINGFILE_H_
#include
"ContextSpacing.h"
#include
"Record.h"
#include
<vector>
using
namespace
std
;
class
FileRecordMgr
;
class
Context
;
class
RecordOutputMgr
;
class
SpacingFile
{
public:
SpacingFile
(
ContextSpacing
*
context
);
~
SpacingFile
();
bool
getSpacing
();
private:
ContextSpacing
*
_context
;
FileRecordMgr
*
_inputFile
;
RecordOutputMgr
*
_outputMgr
;
};
#endif
/* SPACINGFILE_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment