コード例 #1
0
def test_others():
    filename = sequana_data("test_fasta.fasta")
    ff = FastA(filename)
    assert len(ff) == 16
    assert len(ff.comments) == 16
    assert len(ff.names) == 16
    assert len(ff.sequences) == 16
    assert is_fasta(filename) == True
    ff.get_lengths_as_dict()
    with TempFile(suffix='.fasta') as fh:
        ff.select_random_reads(4, output_filename=fh.name)
        ff.select_random_reads([1, 2, 3], output_filename=fh.name)
        ff.select_random_reads({1, 2, 3}, output_filename=fh.name)
    assert ff.get_stats()['N'] == 16
    assert ff.get_stats()['mean_length'] > 454
    with TempFile(suffix='.fasta') as fh:
        ff.reverse_and_save(fh.name)
        ff.to_fasta(fh.name)
        ff.to_igv_chrom_size(fh.name)
コード例 #2
0
def get_fasta_stats(filename, sample=1e16):
    from sequana import FastA
    ff = FastA(filename)
    stats = ff.get_stats()
    return stats