Commit 36fe98b0 authored by Robin Engler's avatar Robin Engler
Browse files

Fix bug in threshold.txt file checking

parent 325ce288
......@@ -20,7 +20,7 @@ AUTHORIZED_STROMA_VALUES <<- c('DAPI', 'stroma', 'other')
AUTHORIZED_MARKERS <<- c('CAL', 'CD3', 'CD4', 'CD8', 'CD11c', 'CD15', 'CD20', 'CD56', 'CD68',
'CD103', 'CD163', 'CD206', 'FOXP3', 'GB', 'gH2AX', 'gH2AXN', 'IDO',
'IL10R', 'Keratin', 'Ki67', 'PD1', 'PDL1', 'PERFORIN', 'SOX10',
'IL10R', 'Keratin', 'KI67', 'PD1', 'PDL1', 'PERFORIN', 'SOX10',
'WT1', 'CK', 'VISTA')
......@@ -144,6 +144,15 @@ standardize_and_split_cell_data <- function(input_file,
file_name = input_file)
# Remove any duplicated rows in the input data. Note that for computing speed reasons, we
# first check on a subset of the input table whether there are potentially any duplicates,
# before expanding the search to the entire data. Since duplicates are rare, this will save
# time in most cases.
if(any(duplicated(input_table[,c('cell_id', 'cell_x_position', 'cell_y_position')]))){
input_table = input_table[!duplicated(input_table),]
# Extract sample names and filter to keep only rows matching samples names present in the
# input parameters.
sample_names = extract_sample_name(input_table[,'sample_name'], input_file=input_file)
......@@ -259,6 +268,9 @@ standardize_and_split_tissue_data <- function(input_file,
actual_columns = colnames(input_table),
file_name = input_file)
# Remove any duplicated rows in the input data.
if(any(duplicated(input_table))) input_table = input_table[!duplicated(input_table),]
# Extract sample name and "image ID" values.
# *****************************************
......@@ -279,7 +279,7 @@ load_thresholds_file <- function(input_file,
if(col_names[1] != 'sample_name') raise_error(
msg = "The first column of the threshold file must be 'sample_name'.",
file = input_file)
if('tissue_type' %in% col_names & col_names[2] != 'sample_name') raise_error(
if('tissue_type' %in% col_names & col_names[2] != 'tissue_type') raise_error(
msg = "If present, the 'tissue_type' column must be the second column of the file.",
file = input_file)
Supports Markdown
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