seismicrna.align.tests package

Submodules

class seismicrna.align.tests.write_test.TestCalcFlags(methodName='runTest')

Bases: TestCase

test_f1r2_paired_mixed()
test_f1r2_paired_unmixed()
test_f1r2_single()
test_f2r1_paired_mixed()
test_f2r1_paired_unmixed()
test_f2r1_single()
class seismicrna.align.tests.xamgen_test.TestAlignmentScoreParams(methodName='runTest')

Bases: TestCase

Test that the bonuses and penalties satisfy both inequalities described in the docstring of fqutil.py and repeated below.

parse_all_scores()

Parse all scores.

static parse_scores(scores: str)

Parse Bowtie2 scores (strings of comma-separated integers) into tuples of integers.

test_inequality_min_num_edits()

Test that alignments with two closely separated deletions would score better than alignments with two consecutive deletions and one substitution.

Consider this example: Ref = ACGT, Read = AG

Assume that we want to minimize the number of edits needed to convert the reference into the read sequence. The smallest number of edits is two, specifically these two deletions (/) from the reference: [A/G/] which gets an alignment score of (2 * match - 2 * gap_open - 2 * gap_extend).

But there are two alternative alignments, each with 3 edits: [Ag//] and [A//g] (substitutions in lowercase). Each scores (match - substitution - gap_open - 2 * gap_extend).

In order to favor the simpler alignment with two edits, (2 * match - 2 * gap_open - 2 * gap_extend) must be greater than (match - substitution - gap_open - 2 * gap_extend). Simplifying: (substitution > gap_open - match).

test_inequality_subst_vs_indel()

Test that alignments with two adjacent substitutions would score better than alignments with an insertion and a deletion flanking a match.

Consider this example: Ref = ATAT, Read = ACTT

The alignment ActT has two mutations (two substitutions) and an alignment score of (2 * match - 2 * substitution). The alignment A{C}T/T (where {C} means a C was inserted into the and / means an A deleted from the read). This alignment would get a score of (3 * match - 2 * gap_open - 2 * gap_extend).

Because mutational profiling causes many more substitutions than indels, the alignment with two substitutions should be preferred over the alignment with one insertion and one deletion (although both have two mutations).

Thus, (2 * match - 2 * substitution) must be greater than (3 * match - 2 * gap_open - 2 * gap_extend), which simplifies to (2 * gap_open + 2 * gap_extend > match + 2 * substitution).

test_score_consistency()

Test the self-consistency of the scores.

class seismicrna.align.tests.xamops_test.TestFlagsCmds(methodName='runTest')

Bases: TestCase

TMP_PFX = PosixPath('x/y/z')
XAM_INP = PosixPath('a/b/c.bam')
XAM_OUT = PosixPath('x/y/z.bam')
test_0_flags_bam()
test_0_flags_none()
test_1_flag_bam()
test_1_flag_none()
test_2_flags_bam()
test_2_flags_none()