Skip to content

Restructuring #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

AdityaPandeyCN
Copy link

This PR restructures the project directory following our ROOT project. The benchmark folder and other files will be updated continuously to make it a proper package.

Signed-off-by: AdityaPandeyCN <[email protected]>

restructured the directory

Signed-off-by: AdityaPandeyCN <[email protected]>

changed folder names

Signed-off-by: AdityaPandeyCN <[email protected]>

restructuring the project

Signed-off-by: AdityaPandeyCN <[email protected]>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as draft July 23, 2025 15:12
Signed-off-by: AdityaPandeyCN <[email protected]>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review July 23, 2025 15:41
Signed-off-by: AdityaPandeyCN <[email protected]>
Signed-off-by: AdityaPandeyCN <[email protected]>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as draft July 23, 2025 16:16
Signed-off-by: AdityaPandeyCN <[email protected]>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review July 24, 2025 03:56
#include "utils.h"

#include "ramrecord.C"
#include "../inc/ttree/Utils.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the tools folder is where the executables are we need to find a better solution to this. The CMakeLists in tools should start depending on ttree and then it will need to automatically adjust the include paths so that you do not need to type ../inc.

@@ -1,8 +1,9 @@
// samtoramntuple.C
// SAM to RAM converteR

#include "RAMntuplerecord.C"
#include "RAMNTupleRecord.h"
#include "../src/rntuple/RAMNTupleRecord.cxx"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have to include the cxx file here?

Signed-off-by: AdityaPandeyCN <[email protected]>
CMakeLists.txt Outdated

add_library(ramtools_tree STATIC
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/ttree)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use target_include_directories. include_directories is not recommended unless there is a good reason for it.

CMakeLists.txt Outdated
Comment on lines 20 to 28
ROOT_GENERATE_DICTIONARY(G__ramtools_tree
RAMRecord.h
Utils.h
CigarOps.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/inc/ttree/LinkDef.h
MODULE ramtools_tree
)

add_library(ramtools_tree SHARED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not combining these two by using ROOT_STANDARD_LIBRARY_PACKAGE?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting errors after implementing this
CMake Error at /home/aditya/root-6.35-ntuple/share/root/cmake/RootMacros.cmake:1237 (install): install DIRECTORY given no DESTINATION! Call Stack (most recent call first): /home/aditya/root-6.35-ntuple/share/root/cmake/RootMacros.cmake:1428 (ROOT_INSTALL_HEADERS) CMakeLists.txt:22 (ROOT_STANDARD_LIBRARY_PACKAGE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message says it all, right? We need to pass some install directory of the component..

@@ -15,8 +15,8 @@
#include <TTreeIndex.h>
#include <TTreePerfStats.h>

#include "../inc/ttree/Utils.h"
#include "../inc/ttree/RAMRecord.h"
#include "Utils.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally these should be ttree/Utils.h to be able to know what's where...

Signed-off-by: AdityaPandeyCN <[email protected]>
Signed-off-by: AdityaPandeyCN <[email protected]>
};

// CIGAR operation codes (from BAM format)
#include "../ttree/CigarOps.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "../ttree/CigarOps.h"
#include "ttree/CigarOps.h"

const UChar_t RAM_CIGAR_P = 6;
const UChar_t RAM_CIGAR_EQUAL = 7;
const UChar_t RAM_CIGAR_X = 8;
#include "CigarOps.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "CigarOps.h"
#include "ttree/CigarOps.h"

@@ -0,0 +1,749 @@
//
// RAMNTupleRecord.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RAMNTupleRecord.cpp
// RAMNTupleRecord.cxx

const auto &entries = index_view(0);
fgIndex->SetEntries(entries);
} catch (...) {
// Field doesn't exist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's something we should rework maybe not part of this PR. We should not rely on exceptions to check if a field exists or not...

@@ -0,0 +1,37 @@
include(FetchContent)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 4 to 18
if(${tool_name} MATCHES "ntuple")
target_link_libraries(${tool_name} PRIVATE
ramtools_ntuple
ROOT::Core
ROOT::RIO
ROOT::ROOTNTuple
ROOT::ROOTNTupleUtil
)
else()
target_link_libraries(${tool_name} PRIVATE
ramtools_tree
ROOT::Core
ROOT::RIO
ROOT::Tree
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependencies should come from the outside as LIBRARY or something like that. We can use ROOT_EXECUTABLE.

@AdityaPandeyCN
Copy link
Author

I have tried to address the suggestions also apologies for the foolish errors I have made.

Copy link

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some basic linux CI?

CMakeLists.txt Outdated
@@ -1,44 +1,75 @@
cmake_minimum_required(VERSION 3.16)
project(ramtools VERSION 1.0.0 LANGUAGES C CXX)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why C here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually build was failing with empty CMAKE_C_COMPILER variable error so added C to check, now have removed passing it explicitly.

CMakeLists.txt Outdated
SOURCES ramrecord.C
HEADERS ramrecord.h
LIBRARIES ROOT::Core ROOT::RIO ROOT::Tree
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't ROOT_STANDARD_LIBRARY_PACKAGE set this properly up?

CMakeLists.txt Outdated
INSTALL_OPTIONS
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
add_library(ramtools_ntuple SHARED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is a separate library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was better to separate them but now will make it one.

)

ROOT_EXECUTABLE(samtoramntuple

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why that did not work?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-used this in the tools cmake, there was no reason I was just trying to use other ways

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the ROOT_EXECUTABLE where possible.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping about this one.

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/ramtoolsTargets.cmake")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file needed?

Comment on lines 4 to 23
add_executable(CountEntriesTest CountEntriesTest.cxx)
target_link_libraries(CountEntriesTest PRIVATE
ramtools_tree
ramtools_ntuple
gtest
gtest_main
)
add_test(NAME CountEntriesTest COMMAND CountEntriesTest)
set_tests_properties(CountEntriesTest PROPERTIES
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tools
ENVIRONMENT "ROOT_INCLUDE_PATH=${CMAKE_SOURCE_DIR}/inc;LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}"
)

add_executable(RamviewCountsTest RamviewCountsTest.cxx)
target_link_libraries(RamviewCountsTest PRIVATE
ramtools_tree
ramtools_ntuple
gtest
gtest_main
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this into a cmake function? You can take a look at how it's done in clad...

CMakeLists.txt Outdated
set(CMAKE_INSTALL_LIBDIR lib)
set(CMAKE_INSTALL_INCLUDEDIR include)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/inc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the same as include_directories. Why do we need this to be set globally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still confused about this, not able to implement removing include directories.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need more information about that. Compiling which library fails if you remove that line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some changes, what do you think about it now?

Comment on lines 1 to 7
#include <gtest/gtest.h>
#include <TSystem.h>
#include <TFile.h>
#include <TTree.h>
#include <ROOT/RNTupleReader.hxx>
#include <iostream>
#include <string>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The includes are not ordered by component and then alphabetically.

}
};

TEST_F(CountEntriesTest, CompareEntryCountsFromSamFile) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I do not understand what is this intended to test. Nominally the content of samtoram.cxx should be turned into a test (or some library api that we call from within the test). Then in the benchmark folder we can do all sorts of benchmarks and comparisons...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intented to test count of reads for a genomic region from both the implementation rntuple one and the ttree one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some part of the test log to give you an overview
RAMRefs vector: 1: 0: chr1 1: RAMRefs vector: 1: 1: Processed 24 SAM headers 1: Processed 33711 SAM records 1: 1: Real time 0:00:01, CP time 1.800 1: 1: Processing samtoramntuple.cxx+("samexample.sam", "rntuple_test.root")... 1: 1: RAM file created: rntuple_test.root 1: Number of entries: 33711 1: RAMNTupleRefs vector: 1: 0: chr1 1: RAMNTupleRefs vector: 1: 1: Index entries: 34 1: 1: Processed 24 SAM headers 1: Processed 33711 SAM records

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I understood what you mean to say, I will implement that. Thankyou for this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I go on and create a library folder with the content of samtoram.cxx and samtoramntuple.cxx and use them to perform unit tests and move these two in the benchmark folder(with slight modifications)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a good idea. We will need to meditate on a name of that library though :)

}
};

TEST_F(RamviewCountsTest, CompareViewCountsForRegion) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

@AdityaPandeyCN
Copy link
Author

Hello @vgvassilev Do you want me to address anything more for this PR?

Signed-off-by: AdityaPandeyCN <[email protected]>
)

ROOT_EXECUTABLE(samtoramntuple

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the ROOT_EXECUTABLE where possible.

Signed-off-by: AdityaPandeyCN <[email protected]>
@@ -1,5 +1,5 @@
#ifndef RAMCORE_SAMTONTUPLE_H
#define RAMCORE_SAMTONTUPLE_H
#ifndef ramcore_SAMTONTUPLE_H

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header protectors should be all caps.

Signed-off-by: AdityaPandeyCN <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants