Ejemplo n.º 1
0
def sniffer(filename):

    try:
        if is_sam(filename): return "SAM"
    except:
        pass

    try:
        if is_bam(filename): return "BAM"
    except:
        pass

    try:
        if is_cram(filename): return "CRAM"
    except:
        pass

    try:
        if is_fastq(filename): return "FASTQ"
    except:
        pass

    try:
        if is_fasta(filename): return "FASTA"
    except:
        pass
Ejemplo n.º 2
0
def sniffer(filename):

    try:
        if is_sam(filename): return "SAM"
    except:
        pass

    try:
        if is_bam(filename): return "BAM"
    except:
        pass

    try:
        if is_cram(filename): return "CRAM"
    except:
        pass

    try:
        if is_fastq(filename): return "FASTQ"
    except:
        pass

    try:
        if is_fasta(filename): return "FASTA"
    except:
        pass
Ejemplo n.º 3
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)