Beispiel #1
0
def test_anim_delta():
    """Test parsing of NUCmer delta file.
    """
    aln, sim = anim.parse_delta(
        os.path.join('test_ani_data', 'NC_002696_vs_NC_011916.delta'))
    assert_equal(aln, 4073917)
    assert_equal(sim, 2191)
    print("Alignment length: {0}\nSimilarity Errors: {1}".format(aln, sim))
Beispiel #2
0
def test_anim_delta():
    """Test parsing of NUCmer delta file.
    """
    aln, sim = anim.parse_delta(os.path.join('test_ani_data',
                                             'NC_002696_vs_NC_011916.delta'))
    assert_equal(aln, 4073917)
    assert_equal(sim, 2191)
    print("Alignment length: {0}\nSimilarity Errors: {1}".format(aln, sim))
Beispiel #3
0
def update_comparison_results(
    joblist: List[ComparisonJob],
    run,
    session,
    nucmer_version: str,
    args: Namespace,
) -> None:
    """Update the Comparison table with the completed result set.

    :param joblist:         list of ComparisonJob namedtuples
    :param run:             Run ORM object for the current ANIm run
    :param session:         active pyanidb session via ORM
    :param nucmer_version:  version of nucmer used for the comparison
    :param args:            command-line arguments for this run

    The Comparison table stores individual comparison results, one per row.
    """
    logger = logging.getLogger(__name__)

    # Add individual results to Comparison table
    for job in tqdm(joblist, disable=args.disable_tqdm):
        logger.debug("\t%s vs %s", job.query.description,
                     job.subject.description)
        aln_length, sim_errs = anim.parse_delta(job.outfile)
        qcov = aln_length / job.query.length
        scov = aln_length / job.subject.length
        try:
            pid = 1 - sim_errs / aln_length
        except ZeroDivisionError:  # aln_length was zero (no alignment)
            pid = 0
        run.comparisons.append(
            Comparison(
                query=job.query,
                subject=job.subject,
                aln_length=aln_length,
                sim_errs=sim_errs,
                identity=pid,
                cov_query=qcov,
                cov_subject=scov,
                program="nucmer",
                version=nucmer_version,
                fragsize=None,
                maxmatch=args.maxmatch,
            ))

    # Populate db
    logger.debug("Committing results to database")
    session.commit()
Beispiel #4
0
def test_anim_delta():
    """Test parsing of NUCmer delta file."""
    aln, sim = anim.parse_delta(DELTAFILE)
    assert_equal(aln, 4073917)
    assert_equal(sim, 2191)
    print("Alignment length: {0}\nSimilarity Errors: {1}".format(aln, sim))
Beispiel #5
0
 def test_deltafile_import(self):
     """parses NUCmer .delta/.filter file."""
     result = anim.parse_delta(self.deltafile)
     assert_equal(result, (4073917, 2191))
Beispiel #6
0
 def test_deltafile_import(self):
     """Parse test NUCmer .delta/.filter file."""
     result = anim.parse_delta(self.deltafile)
     self.assertEqual(result, (4074001, 2191))
Beispiel #7
0
def test_deltafile_parsing(deltafile_parsed):
    """Check parsing of test NUCmer .delta/.filter file."""
    result = anim.parse_delta(deltafile_parsed.filename)
    assert result == deltafile_parsed.data
Beispiel #8
0
 def test_deltafile_import(self):
     """parses NUCmer .delta/.filter file."""
     result = anim.parse_delta(self.deltafile)
     assert_equal(result, (4073917, 2191))
Beispiel #9
0
def test_anim_delta(dir_anim_in):
    """Test parsing of NUCmer delta file."""
    aln, sim = parse_delta(dir_anim_in / "NC_002696_vs_NC_011916.delta")
    assert (aln, sim) == (4074148, 2191)
Beispiel #10
0
def test_anim_delta():
    """Test parsing of NUCmer delta file."""
    aln, sim = anim.parse_delta(DELTAFILE)
    assert_equal(aln, 4073917)
    assert_equal(sim, 2191)
    print("Alignment length: {0}\nSimilarity Errors: {1}".format(aln, sim))