Skip to content

Commit

Permalink
Merge pull request #64 from sharonsun1999/master
Browse files Browse the repository at this point in the history
Merging branches
  • Loading branch information
sa501428 committed Mar 10, 2021
2 parents 686f7db + 1921471 commit 4045991
Show file tree
Hide file tree
Showing 7 changed files with 2,281 additions and 1,998 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions C++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.13) # CMake version check
project(strawC) # Create project "simple_example"
set(CMAKE_CXX_STANDARD 14) # Enable c++14 standard

# g++ -std=c++0x -o straw main.cpp straw.cpp -lcurl -lz
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -lcurl -lz")

# Add main.cpp file of project root directory as source file
set(SOURCE_FILES main.cpp straw.cpp)
add_executable(straw ${SOURCE_FILES})

target_link_libraries(straw curl z)
46 changes: 25 additions & 21 deletions C++/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,29 @@ using namespace std;

int main(int argc, char *argv[])
{
if (argc != 8) {
cerr << "Not enough arguments" << endl;
cerr << "Usage: straw <observed/oe> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize>" << endl;
exit(1);
}

string matrix=argv[1];
string norm=argv[2];
string fname=argv[3];
string chr1loc=argv[4];
string chr2loc=argv[5];
string unit=argv[6];
string size=argv[7];
int binsize=stoi(size);
vector<contactRecord> records;

records = straw(matrix, norm, fname, chr1loc, chr2loc, unit, binsize);
int length=records.size();
for (int i=0; i<length; i++) {
printf("%d\t%d\t%.14g\n", records[i].binX, records[i].binY, records[i].counts);
}
if (argc != 7 && argc != 8) {
cerr << "Incorrect arguments" << endl;
cerr << "Usage: straw <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize>" << endl;
cerr << "Usage: straw <oe> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize>" << endl;
exit(1);
}
int offset = 0;
string matrix = "observed";
if(argc == 8){
offset = 1;
matrix = argv[1];
}
string norm = argv[1 + offset];
string fname = argv[2 + offset];
string chr1loc = argv[3 + offset];
string chr2loc = argv[4 + offset];
string unit = argv[5 + offset];
string size = argv[6 + offset];
int binsize = stoi(size);
vector<contactRecord> records;
records = straw(matrix, norm, fname, chr1loc, chr2loc, unit, binsize);
long length = records.size();
for (long i = 0; i < length; i++) {
printf("%d\t%d\t%.14g\n", records[i].binX, records[i].binY, records[i].counts);
}
}
Loading

0 comments on commit 4045991

Please sign in to comment.