Esempio n. 1
0
def test_pacbio():
    b = PacbioSubreads(sequana_data("test_pacbio_subreads.bam"))
    assert len(b) == 130
    b.df
    #assert b.nb_pass[1] == 130


    with TempFile() as fh:
        b.filter_length(fh.name, threshold_min=500)

    print(b)   #  check length

    assert b.stats['mean_GC'] > 62.46
    assert b.stats['mean_GC'] < 65.47

    b.summary()

    b = PacbioSubreads(sequana_data("test_pacbio_subreads.bam"))

    # test hist_snr from scratch
    b._df = None
    b.hist_snr()

    # test hist_len from scratch
    b._df = None
    b.hist_read_length()
    b.hist_nb_passes()
    b.get_mean_nb_passes()

    # test from scratch
    b._df = None
    b.hist_GC()

    # test from scratch
    b._df = None
    b.plot_GC_read_len()

    # test from scratch
    b._df = None

    with TempFile() as fh:
        b.to_fasta(fh.name, threads=1)
    with TempFile() as fh:
        b.to_fastq(fh.name, threads=1)
    with TempFile() as fh:
        b.save_summary(fh.name)
Esempio n. 2
0
def test_pacbio():
    b = PacbioSubreads(sequana_data("test_pacbio_subreads.bam"))
    assert len(b) == 130
    b.df
    #assert b.nb_pass[1] == 130


    with TempFile() as fh:
        b.filter_length(fh.name, threshold_min=500)

    print(b)   #  check length

    assert b.stats['mean_GC'] > 62.46
    assert b.stats['mean_GC'] < 65.47

    b.summary()

    b = PacbioSubreads(sequana_data("test_pacbio_subreads.bam"))

    # test hist_snr from scratch
    b._df = None
    b.hist_snr()

    # test hist_len from scratch
    b._df = None
    b.hist_read_length()
    b.hist_nb_passes()
    b.get_mean_nb_passes()

    # test from scratch
    b._df = None
    b.hist_GC()

    # test from scratch
    b._df = None
    b.plot_GC_read_len()

    # test from scratch
    b._df = None

    with TempFile() as fh:
        b.to_fasta(fh.name, threads=1)
    with TempFile() as fh:
        b.to_fastq(fh.name, threads=1)
    with TempFile() as fh:
        b.save_summary(fh.name)
Esempio n. 3
0
"""
read length histograms pacbio data
=====================================

QC pacbio example

"""

########################################
# First, let us get a data set example.
# Note the .bam extension
from sequana import sequana_data
dataset = sequana_data("test_pacbio_subreads.bam")

#############################################
# Create a :class:`sequana.pacbio.BAMPacbio` instance
from sequana.pacbio import PacbioSubreads
qc = PacbioSubreads(dataset)

#########################################
# plot the histogram of read length
qc.hist_read_length()

#################################################
# plot the histogram of the SNRs for each base
qc.hist_snr()