API

Import MERQuaCo as:

import merquaco as mqc

Experiment

read_transcripts(transcripts_path)

Reads and returns transcripts table dataframe

remove_blanks(transcripts)

Filters transcripts DataFrame to remove 'Blank' codewords

read_codebook(codebook_input)

Reads codebook for use with data loss module

scale_transcripts_xy(transcripts)

Scales transcripts (x,y) locations based on min (x,y) values

find_fovs(transcripts)

Group transcripts by FOV and stores per-FOV information, including coordinates and transcript counts

get_fov_neighbors(fovs)

Find neighbors for each FOV using grid coordinates

get_fovs_dataframe(transcripts)

Creates FOVs DataFrame including coordinates, transcript counts, z-ratio, neighbors

get_transcript_density(...)

Calculates transcript density per on-tissue micron

run_dropout_pipeline()

Runs entire dropout pipeline, including false positive correction

run_full_pixel_classification([...])

Runs entire pixel classification workflow:

run_all_qc([run_pixel_classification, ...])

Runs all standard QC functions and prints results

Data Loss

FOVDropout.find_on_tissue_fovs(transcripts, fovs)

Use ilastik transcripts mask to detemine on- and off-tissue FOVs FOV is considered on-tissue if at least 50% of its area is on-tissue

FOVDropout.detect_dropouts(transcripts, fovs)

Compares cardinal neighbors for each FOV to detect dropout

FOVDropout.compare_codebook_fov_genes(fovs, ...)

Compares genes in FOVs and codebook dataframes and removes mismatched genes from consideration.

FOVDropout.detect_false_positives(fovs, codebook)

Detects false positive FOV dropouts by evaluating codebook rounds in which the genes dropped for a target FOV

FOVDropout.save_fov_tsv(fovs, output_dir)

Save FOVs dataframe as .txt.gz file

DropoutResult.get_dropout_count()

Get total number of dropped FOVs

DropoutResult.get_dropped_genes([fov, dic])

Get a list of dropped genes.

DropoutResult.get_dropped_gene_counts([fov, dic])

Gets number of dropped genes.

DropoutResult.get_dropped_fovs([gene, dic])

Get a list of dropped FOV names.

DropoutResult.get_dropped_fov_counts([gene, dic])

Gets number of unique dropped FOVs.

DropoutResult.get_considered_genes([fov, dic])

Gets a list of all genes with at least 1 FOV considered for dropout.

DropoutResult.get_considered_gene_counts([...])

Gets number of genes with at least 1 FOV considered for dropout.

DropoutResult.get_considered_fovs()

Gets a list of all on-tissue FOVs

DropoutResult.get_considered_fov_counts()

Gets number of on-tissue FOVs

DropoutResult.get_false_positive_fovs([...])

Get list of all FOVs not considered dropped due to false positive correction.

DropoutResult.get_false_positive_fov_counts([...])

Get number of FOVs not considered dropped due to false positive correction.

DropoutResult.dropout_summary([return_summary])

Prints a summary of FOV dropout for the experiment

DropoutResult.draw_genes_dropped_per_fov([...])

Draws heatmap of number of genes dropped per FOV

Periodicity

get_periodicity_list(transcripts[, ...])

Performs periodicity analysis across z-planes

get_chunk_values(transcripts, image_dimensions)

Calculates histogram and periodicity chunk values for transcripts DataFrame

get_image_dimensions(transcripts)

Helper method to calculate dimensions for image based on max (x,y) values

get_periodicity_vals_all_z(transcripts[, ...])

Performs periodicity analysis in all z-planes collapsed

Z-Axis Nonuniformity

get_transcripts_per_z(transcripts[, num_planes])

Iterates through z-planes and returns array of transcript counts per plane

compute_z_ratio(transcripts[, num_planes, ...])

Returns ratio of transcript counts between highest and lowest planes

Perfusion

analyze_flow(log_file_path)

Extract and analyze flow rate information from log file

Figures

transcripts_overview(transcripts[, ...])

Plots transcripts overview, subsampling 0.1% by default.

plot_periodicity_hist(transcripts[, ...])

Plot transcripts overview with histogram of counts along each axis.

plot_every_z_plane(transcripts[, subsample, ...])

Plots transcripts overview for each z plane in a row

plot_transcripts_per_z(transcripts_per_z[, ...])

Plot transcript counts for each z plane

plot_perfusion_figure(flow_data[, title, ...])

Plot (and save) figure of extracted fluidics log file data

plot_pixel_percentages(transcripts_percent, ...)

Plots proportion of 'ideal tissue area' for each classified category

plot_pixel_classification(pixel_classification)

Plots pixel classification of an experiment

plot_full_pixel_fig(pixel_classification, ...)

Plots full pixel classification figure with pixel classification, pixel percentages, and all binary masks.

plot_mask(mask_input[, ax, title, out_file, dpi])

Processes and plots binary msk

plot_masks(dapi_mask_input, dapi_mask_ax, ...)

Pixel Classification

generate_mask(ilastik_program_path, ...[, ...])

Runs pixel and object classification workflows to create and save binary mask

create_transcripts_image(transcripts[, ...])

Creates transcripts image from transcripts via 2D histogram

generate_transcripts_mask(...[, transcripts])

Return transcripts mask, either from image path (if exists), or by generating from transcripts table

create_dapi_image(high_res_dapi_image_path, ...)

Creates a lower-resolution DAPI image by binning, normalizing, and removing off-tissue pixels.

generate_dapi_mask(dapi_image_path, ...[, ...])

Generate binary DAPI mask from compressde DAPI image or high-res DAPI output image

generate_detachment_mask(...)

Generate and save gel detachment mask by subtracting transcript mask from DAPI mask

create_ventricle_genes_image(...[, ...])

Creates and saves image of ventricle genes superimposed on DAPI image

generate_ventricle_mask(...[, ventricle_genes])

Creates and saves binary ventricle marker genes mask from transcripts dataframe and ventricle gene list

generate_damage_mask(damage_mask_path, ...)

Generate and save binary tissue damage mask

classify_pixels(transcripts_mask_input, ...)

Combine all masks and classify each pixel as either damage, tissue, detachment, ventricle, or off-tissue

calculate_class_areas(pixel_classification)

Calculates class areas in microns

calculate_class_percentages(damage_area, ...)

Computes and uses "ideal" tissue area as denominator for pixel percentage calculations