Documented functions with links to source

Program to classify excised in-plane rotated segments using SPARX’s k-means clustering

class segmentclass.SegmentClassPar[source]

Class to initiate default dictionary with input parameters including help and range values and status dictionary

Methods

add_mask_dimension_to_features

define_parameters_and_their_properties

define_program_states

set_class_avg_out_stack

set_class_count

set_class_var_out_stack

set_eigenimg_out_stack

set_frc_based_filter_option

set_iteration_count

set_keep_intermediate_files_option

set_reference_option

set_refinement_option

set_spring_db_prep_rec

add_mask_dimension_to_features()[source]
define_parameters_and_their_properties()[source]
define_program_states()[source]
set_class_avg_out_stack(feature_set)[source]
set_class_var_out_stack(feature_set)[source]
set_eigenimg_out_stack(feature_set)[source]
set_class_count(feature_set)[source]
set_iteration_count(feature_set)[source]
set_keep_intermediate_files_option(feature_set)[source]
set_spring_db_prep_rec(feature_set)[source]
class segmentclass.SegmentClassPreparation(parset=None)[source]
  • Class that holds functions for examining segments from micrographs

  • __init__ Function to interpret multi-input parameters

Methods

apply_binfactor_if_required

define_helix_or_particle_dimensions

determine_minimal_segment_size

perform_binning_and_trimming_of_input_stack_if_required

perform_binning_and_trimming_of_reference_if_required

prepare_mask

prepare_mask_ori

setup_mask

setup_segmentalign_filter

setup_segmentalign_filter()[source]
define_helix_or_particle_dimensions()[source]
apply_binfactor_if_required()[source]
determine_minimal_segment_size()[source]
perform_binning_and_trimming_of_input_stack_if_required()[source]
perform_binning_and_trimming_of_reference_if_required()[source]
prepare_mask_ori()[source]
prepare_mask()[source]
setup_mask()[source]
class segmentclass.SegmentClassExternalPrograms[source]

Methods

divide_sx_kmeans_in_reasonable_chunks(…[, …])

>>> from spring.segment2d.segmentclass import SegmentClass

spring_align2d(infilestack, reference_stack)

  • Function to launch helical 2D alignment program segmentalign

sx_kmeans(alistack, maskfile, class_count[, …])

  • Function to launch SPARX’s k-means analysis

sx_kmeans_groups([alistack, maskfile, noclasses])

  • Function to launch SPARX’s k-means groups analysis (sx_kmeans_groups.py)

add_mask_dimensions_to_align2d_features

get_dir_name_for_classification

run_segmentalign2d_in_separate_process

sx_kmeans_wrap

add_mask_dimensions_to_align2d_features()[source]
run_segmentalign2d_in_separate_process(aligndict, align_directory, program_to_be_launched)[source]
spring_align2d(infilestack, reference_stack, reference_option=True, local_refinement=False)[source]
  • Function to launch helical 2D alignment program segmentalign

  1. Input: infilestack, reference stack

  2. Output: aligned stack

  3. Usage: alistack = spring_align2d(infilestack, reference_stack)

divide_sx_kmeans_in_reasonable_chunks(img_count, class_count, chunk_size=2000)[source]
>>> from spring.segment2d.segmentclass import SegmentClass
>>> SegmentClass().divide_sx_kmeans_in_reasonable_chunks(10, 3, 6)
([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], [3])
>>> SegmentClass().divide_sx_kmeans_in_reasonable_chunks(10, 4, 6)
([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]], [2, 2])
>>> SegmentClass().divide_sx_kmeans_in_reasonable_chunks(20, 6, 5)
([[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18, 19]], [2, 2, 2])
sx_kmeans_wrap(alistack, maskfile, class_count)[source]
get_dir_name_for_classification(program_to_be_launched, iteration_id, run_id=None)[source]
sx_kmeans(alistack, maskfile, class_count, run_id=None)[source]
  • Function to launch SPARX’s k-means analysis

  1. Input: aligned stack, mask file, number of classes

  2. Output: stack of averages, stack of variances

  3. Usage: avgstack, varstack = sx_kmeans(alistack, maskfile, class_count)

sx_kmeans_groups(alistack=None, maskfile=None, noclasses=None)[source]
  • Function to launch SPARX’s k-means groups analysis (sx_kmeans_groups.py)

  1. Input: aligned stack, mask file, number of classes

  2. Output: statistics data

  3. Usage: avgstack, varstack = sx_kmeans_groups(alistack, maskfile, noclasses)

class segmentclass.SegmentClassStatistics[source]

Methods

compute_eigen_images(stack, eigenstack, …)

Perform PCA on stack file and Get eigen images

compute_average_variance_and_eigenimages_on_orignal_stack

create_database_with_stack_id_entries

enter_class_assignment_in_database

finish_classification

get_alignment_info_from_stack

log_member_statistics_from_classes

make_align_named_tuple

compute_eigen_images(stack, eigenstack, mask, avg)[source]

Perform PCA on stack file and Get eigen images

log_member_statistics_from_classes(class_avg_stack, source_stack)[source]
enter_class_assignment_in_database(session, members_class)[source]
make_align_named_tuple()[source]
get_alignment_info_from_stack(aligned_stack, classes)[source]
compute_average_variance_and_eigenimages_on_orignal_stack(output_avgstack, output_varstack, classes, alignment_data)[source]
create_database_with_stack_id_entries(segment_count)[source]
finish_classification(avgstack, varstack, aligned_stack, output_avgstack, output_varstack)[source]
class segmentclass.SegmentClass(parset=None)[source]

Methods

compute_eigen_images(stack, eigenstack, …)

Perform PCA on stack file and Get eigen images

divide_sx_kmeans_in_reasonable_chunks(…[, …])

>>> from spring.segment2d.segmentclass import SegmentClass

spring_align2d(infilestack, reference_stack)

  • Function to launch helical 2D alignment program segmentalign

sx_kmeans(alistack, maskfile, class_count[, …])

  • Function to launch SPARX’s k-means analysis

sx_kmeans_groups([alistack, maskfile, noclasses])

  • Function to launch SPARX’s k-means groups analysis (sx_kmeans_groups.py)

add_mask_dimensions_to_align2d_features

apply_binfactor_if_required

classify

compute_average_variance_and_eigenimages_on_orignal_stack

create_database_with_stack_id_entries

define_helix_or_particle_dimensions

determine_minimal_segment_size

enter_class_assignment_in_database

finish_classification

get_alignment_info_from_stack

get_dir_name_for_classification

log_member_statistics_from_classes

make_align_named_tuple

perform_binning_and_trimming_of_input_stack_if_required

perform_binning_and_trimming_of_reference_if_required

prepare_mask

prepare_mask_ori

run_segmentalign2d_in_separate_process

setup_mask

setup_segmentalign_filter

sx_kmeans_wrap

classify()[source]
segmentclass.main()[source]