R/get_column_indices.R

Defines functions get_column_indices

get_column_indices <- function(target_path,
                               chrom_col,
                               start_col,
                               end_col=start_col){
    #### Get indices of each required column ####
    cDict <- echodata::column_dictionary(path = target_path)
    ### Check column exist ####
    if(!chrom_col %in% names(cDict)) stop("chrom_col not found in file.")
    if(!start_col %in% names(cDict)) stop("start_col not found in file.")
    if(!end_col %in% names(cDict)) stop("end_col not found in file.")
    chrom_i <- cDict[[chrom_col]]
    start_i <-  cDict[[start_col]]
    end_i <- cDict[[end_col]] 
    return(list(
        chrom_i=chrom_i,
        start_i=start_i,
        end_i=end_i
    ))
}
RajLabMSSM/echotabix documentation built on Nov. 21, 2023, 8:02 a.m.