RNA Detection

(nextflipdebug2) #1
Optionally, we can apply specificity scores also on the atlas
(symmetrical penalization,seeNote 8). For that, run the fol-
lowing script:

number_of_points_in_altas< 1000
atlas_specificity_score <1/apply(atlas,2,function(x){length(x[x> 0])/number_-
of_points_in_altas})


  1. If you decide to apply asymmetrical penalization, i.e., only
    penalize mismatches when the gene is expressed in the scRNA-
    seq and not in the atlas, set theatlas_specificity_score
    as a vector of 0’s:
    atlas_specificity_score<as.numeric(vector(length¼num-
    ber_of_points_in_altas))


3.3.5 Spatial Mapping:
Correspondence Score



  1. To map back each sequenced single cell to its localization in the
    reference ISH dataset, we use a scoring system where we calcu-
    late the correspondence between every cell-voxel combination.


The correspondence scores are calculated at the spatial
mapping script step:

results_scores¼sapply(seq_along(rna_seq[,1]),function(cell_num) {
print(paste("Mapping cell",cell_num))
cell¼rna_seq[cell_num,]
specificity_score<- specificity_matrix[cell_num,]

# Set the threshold for binarization of the RNA-seq counts # data
count_threshold<-10
binary_expression_cell<-sapply(cell,function(x){ifelse
(x>count_threshold,1,0)})

# Launch the mapping against the atlas for the cell
mapping_result_cell<-spatial_map_scoring(specificity_score,binary_
expression_cell, atlas_specificity_score,atlas)

# Create the folder for mapping results, if it doesn’t exist:
dir.create(file.path(".", "mapping_results"), showWarnings¼FALSE)

# Save the mapping results in a file in mapping_results folder:
write.table(file¼paste("mapping_results/mapping_result_cell_", cell_num,
sep¼""), mapping_result_cell)
mapping_result_cell
})

Spatial Transcriptomics 117
Free download pdf