seismicrna.core.mu.tests package

Submodules

class seismicrna.core.mu.tests.compare_test.TestCalcCoeffDeterm(methodName='runTest')

Bases: TestCase

classmethod calc_true(x, y)

Calculate the “true” coefficient using a trusted method.

test_array0d()
test_array1d()
test_dataframe()
class seismicrna.core.mu.tests.compare_test.TestCalcNRMSD(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d_allzero()
test_array1d_examples()
test_array1d_extremes()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.compare_test.TestCalcPearson(methodName='runTest')

Bases: TestCase

classmethod calc_true(x, y)

Calculate the “true” coefficient using a trusted method.

test_array0d()
test_array1d()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.compare_test.TestCalcSpearman(methodName='runTest')

Bases: TestCase

classmethod calc_true(x, y)

Calculate the “true” coefficient using a trusted method.

test_array0d()
test_array1d()
test_array1d_nan()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.compare_test.TestCompareWindows(methodName='runTest')

Bases: TestCase

test_contiguous()
class seismicrna.core.mu.tests.compare_test.TestGetComp(methodName='runTest')

Bases: TestCase

test_comps()
class seismicrna.core.mu.tests.dim_test.TestCountPos(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.dim_test.TestCountsPos(methodName='runTest')

Bases: TestCase

test_array1d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.dim_test.TestCountsPosConsensus(methodName='runTest')

Bases: TestCase

test_empty()
test_equal()
test_unequal()
class seismicrna.core.mu.tests.frame_test.TestAutoReframe(methodName='runTest')

Bases: TestCase

test_reduce_0()
test_reduce_0_and_1()
test_reduce_none()
class seismicrna.core.mu.tests.frame_test.TestReframe(methodName='runTest')

Bases: TestCase

test_array_index()
test_array_index_index()
test_array_ints()
test_array_none()
test_dataframe()
test_float_index()
test_float_index_index()
test_float_index_index_index()
test_float_index_index_int()
test_float_index_int()
test_float_int_index()
test_float_ints()
test_float_none()
test_series()
class seismicrna.core.mu.tests.frame_test.TestReframeLike(methodName='runTest')

Bases: TestCase

test_array_array()
test_array_dataframe()
test_array_series()
test_dataframe_array()
test_dataframe_dataframe()
test_drop_array()
test_drop_dataframe()
test_drop_series()
test_float_array()
test_float_dataframe()
test_float_float()
test_float_series()
test_series_array()
test_series_series()
seismicrna.core.mu.tests.frame_test.broadcast_regex(vshape: tuple[int, ...], tshape: tuple[int, ...])

Get the error regex that would result from trying to broadcast values in the shape of vshape to the target shape of tshape.

Parameters:
  • vshape (tuple[int, ]) – Shape of the values to broadcast.

  • tshape (tuple[int, ]) – Shape of the target to which the values should be broadcast.

Returns:

Regular expression that can match the error message.

Return type:

str

seismicrna.core.mu.tests.frame_test.broadcastable(vshape: tuple[int, ...], tshape: tuple[int, ...])

Check whether values in the shape of vshape can be broadcast to the target shape of tshape.

Parameters:
  • vshape (tuple[int, ]) – Shape of the values to broadcast.

  • tshape (tuple[int, ]) – Shape of the target to which the values should be broadcast.

Returns:

Whether the value shape can be broadcast to the target shape.

Return type:

bool

class seismicrna.core.mu.tests.measure_test.TestCalcGini(methodName='runTest')

Bases: TestCase

test_all_equal_1d()
test_all_equal_2d()
test_all_zero_1d()
test_all_zero_2d()
test_distributed_1d()
test_empty_1d()
test_monopoly_1d()
class seismicrna.core.mu.tests.measure_test.TestCalcSignalNoise(methodName='runTest')

Bases: TestCase

test_1d()
test_2d()
test_empty_1d()
class seismicrna.core.mu.tests.nan_test.TestAnyNaN(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array2d()
test_array3d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.nan_test.TestAutoRemoveNaN(methodName='runTest')

Bases: TestCase

test_array()
class seismicrna.core.mu.tests.nan_test.TestAutoRemovesNaN(methodName='runTest')

Bases: TestCase

test_array()
class seismicrna.core.mu.tests.nan_test.TestNoNaN(methodName='runTest')

Bases: TestCase

test_array1d()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.nan_test.TestRemoveNaNs(methodName='runTest')

Bases: TestCase

test_array1d()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.nan_test.TestRemovesNaNs(methodName='runTest')

Bases: TestCase

test_array1d()
test_array2d()
test_array_series_dataframe()
test_array_series_dataframe_mismatched()
test_dataframe()
test_empty()
test_series()
class seismicrna.core.mu.tests.scale_test.TestCalcQuantile(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array1d_all_nan()
test_array1d_empty()
test_array1d_some_nan()
test_array2d()
test_array2d_one_col_nan()
test_array2d_one_row_nan()
test_dataframe()
test_invalid_quantiles()
test_series()
class seismicrna.core.mu.tests.scale_test.TestCalcRMS(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array1d_nan()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.scale_test.TestCalcRanks(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array2d()
test_array3d()
test_dataframe()
test_nan()
test_series()
class seismicrna.core.mu.tests.scale_test.TestNormalize(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array1d_nan()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.scale_test.TestStandardize(methodName='runTest')

Bases: TestCase

test_array0d()
test_array1d()
test_array2d()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.scale_test.TestWinsorize(methodName='runTest')

Bases: TestCase

test_arrays()
test_dataframe()
test_series()
class seismicrna.core.mu.tests.unbias_test.TestAdjustMinGap(methodName='runTest')

Bases: TestCase

test_gap_le_zero_le_npos()
test_npos_le_zero_le_gap()
test_zero_le_gap_lt_npos()
test_zero_lt_npos_le_gap()
class seismicrna.core.mu.tests.unbias_test.TestCalcPClust(methodName='runTest')

Bases: TestCase

test_p_clust()
class seismicrna.core.mu.tests.unbias_test.TestCalcPClustGivenNoClose(methodName='runTest')

Bases: TestCase

test_ncls1()
test_ncls2()
class seismicrna.core.mu.tests.unbias_test.TestCalcPEnds(methodName='runTest')

Bases: TestCase

test_invert()

Test the inverse of calc_p_ends_given_noclose.

class seismicrna.core.mu.tests.unbias_test.TestCalcPEndsGivenNoClose(methodName='runTest')

Bases: TestCase

test_npos0_ncls1()
test_npos1_ncls0()
test_npos1_ncls1()
test_npos2_ncls1()
class seismicrna.core.mu.tests.unbias_test.TestCalcPEndsObserved(methodName='runTest')

Bases: TestCase

test_calc_p_ends_given_observed()
class seismicrna.core.mu.tests.unbias_test.TestCalcPMutGivenSpan(methodName='runTest')

Bases: TestCase

test_invert()

Test the inverse of _calc_p_mut_given_span_noclose.

class seismicrna.core.mu.tests.unbias_test.TestCalcPMutGivenSpanNoClose(methodName='runTest')

Bases: TestCase

test_clusters()
test_simulated()
class seismicrna.core.mu.tests.unbias_test.TestCalcPNoClose(methodName='runTest')

Bases: TestCase

test_p_noclose()
class seismicrna.core.mu.tests.unbias_test.TestCalcParams(methodName='runTest')

Bases: TestCase

test_infer()
class seismicrna.core.mu.tests.unbias_test.TestCalcRectangularSum(methodName='runTest')

Bases: TestCase

static calc_spanning_sum_slow(array: ndarray)
test_2d()
test_3d()
class seismicrna.core.mu.tests.unbias_test.TestClip(methodName='runTest')

Bases: TestCase

test_with_clip()
test_without_clip()
class seismicrna.core.mu.tests.unbias_test.TestFindSplitPositions(methodName='runTest')

Bases: TestCase

test_0()
test_gap0()
test_gap1_single_end3()
test_gap1_single_end5()
test_gap1_split0_quadruple()
test_gap1_split1_double()
test_gap1_split1_single_mid()
test_gap1_split1_triple()
test_gap1_split2()
test_gap2_single_end3()
test_gap2_single_end5()
test_gap2_split0()
test_gap2_split1()
test_gap3_single_end3()
test_gap3_single_end5()
test_gap4_split0()
test_gap4_split1()
test_generic_split()
test_thresh0()
test_thresh1()
class seismicrna.core.mu.tests.unbias_test.TestNoCloseMuts(methodName='runTest')

Bases: TestCase

test_more_muts()
test_no_muts()
test_one_mut()
class seismicrna.core.mu.tests.unbias_test.TestNormalize(methodName='runTest')

Bases: TestCase

test_sum_positive()
test_sum_zero()
class seismicrna.core.mu.tests.unbias_test.TestPrivateCalcPNoCloseGivenEnds(methodName='runTest')

Bases: TestCase

Test _calc_p_nomut_window and _calc_p_noclose_given_ends.

test_clusters()
test_length_0()
test_length_1()
test_length_2_min_gap_1()
test_length_3_min_gap_1()
test_length_3_min_gap_2()
test_length_4_min_gap_1()
test_length_4_min_gap_2()
test_length_4_min_gap_3()
test_min_gap_0()
class seismicrna.core.mu.tests.unbias_test.TestPublicCalcPNoCloseGivenEnds(methodName='runTest')

Bases: TestCase

test_1_dim()
test_2_dim()
test_invalid_dim()
class seismicrna.core.mu.tests.unbias_test.TestQuickUnbias(methodName='runTest')

Bases: TestCase

Test that the quick unbiasing algorithm produces results very similar to the exact algorithm.

ABS_TOL = 0.0005
REL_TOL = 0.03
static random_params(npos: int, ncls: int)
test_threshold_0()
test_threshold_0p001()
class seismicrna.core.mu.tests.unbias_test.TestSlicePEnds(methodName='runTest')

Bases: TestCase

test_0x0()
test_slice_3x3()
test_slice_5x5()
class seismicrna.core.mu.tests.unbias_test.TestTriuAllClose(methodName='runTest')

Bases: TestCase

test_equal()
test_tril()
test_triu()
class seismicrna.core.mu.tests.unbias_test.TestTriuCumSum(methodName='runTest')

Bases: TestCase

test_1x1x2()
test_2x2()
test_2x2x1()
test_2x2x2()
test_3x3()
test_all_0()
test_all_1()
test_explicit_sum()
class seismicrna.core.mu.tests.unbias_test.TestTriuDiv(methodName='runTest')

Bases: TestCase

test_1x1()
test_1x1x1()
test_2x2()
test_2x2x2()
class seismicrna.core.mu.tests.unbias_test.TestTriuDot(methodName='runTest')

Bases: TestCase

test_1x1()
test_1x1x1()
test_2x2()
test_2x2x2()
class seismicrna.core.mu.tests.unbias_test.TestTriuLog(methodName='runTest')

Bases: TestCase

compare(result: ndarray, expect: ndarray)
test_2d()
test_3d()
class seismicrna.core.mu.tests.unbias_test.TestTriuNorm(methodName='runTest')

Bases: TestCase

compare(result: ndarray, expect: ndarray)
test_0x0()
test_0x0x1()
test_1x1()
test_1x1x1()
test_1x1x2()
test_2x2()
test_2x2_zero()
test_2x2x1()
test_2x2x2()
test_2x2x2_zero()
test_2x2x2x2()
test_2x2x2x2_zero()
class seismicrna.core.mu.tests.unbias_test.TestTriuSum(methodName='runTest')

Bases: TestCase

test_1x1()
test_1x1x1()
test_1x1x2()
test_2x2()
test_2x2x1()
test_2x2x2()
test_2x2x2x2()
test_all_zero()
seismicrna.core.mu.tests.unbias_test.label_no_close_muts(muts: ndarray, min_gap: int)

Return a 1D vector that is True for every row in muts that has no two mutations that are too close, otherwise False.

seismicrna.core.mu.tests.unbias_test.no_close_muts(read: ndarray, min_gap: int)

Return True if the read has no two mutations separated by fewer than min_gap non-mutated positions, otherwise False.

seismicrna.core.mu.tests.unbias_test.simulate_params(n_pos: int, n_cls: int, p_mut_max: float = 1.0)

Return p_mut, p_ends, and p_cls parameters.

seismicrna.core.mu.tests.unbias_test.simulate_reads(n_reads: int, p_mut: ndarray, p_ends: ndarray)

Simulate n_reads reads based on the mutation rates (p_mut) and the distributions of end coordinates (p_ends).