def main(filename, opt=6, label=None, n=0, opts=None, colorlist=[],
         stylelist=None):
    '''loads file and invokes makegraphs and printstats.
    Appends graphics from each file onto the figure.
    opt is a symbol for the graph type;
    n is the serial number of successful traces.'''
    logfh = open(opts["logfile"], "a")
    if opts["filetype"].upper() == "MGM":
        spectrum = getmgrkmerspectrum(filename, mgrkey=MGRKEY)
    elif opts["filetype"] == "file":
        spectrum = loadfile(filename)
    else:
        raise ValueError(
            "%s is invalid type (valid types are mgm and file)"
            % opts.filetype)
    if spectrum == []:   # Abort this trace--but try to graph the others
        return n
    if label is None:
        label = filename
    if spectrum.shape[1] > 0:
        spectrum = spectrum[np.lexsort((spectrum[:, 1], spectrum[:, 0]))]
        sys.stderr.write("Making graphs for %s\n" % filename)
        try:
            makegraphs(
                spectrum, filename, option=opt, label=label, n=n,
                dump=opts["dump"], opts=opts, colorlist=colorlist,
                stylelist=stylelist)
#            sys.stderr.write("Printing stats in logfile %s %d\n" %
#                (opts.logfile, n))
            printstats(spectrum, filename, filehandle=logfh, n=n)
            n += 1
        except ValueError as err:   # This catches no data or defective data
            sys.stderr.write("Error printing stats for %s\n" % filename)
    else:
        sys.stderr.write("Error with dataset %s\n" % filename)
    return n
def main(filename, opt=6, label=None, n=0, opts=None, colorlist=[],
         stylelist=None):
    '''loads file and invokes makegraphs and printstats.
    Appends graphics from each file onto the figure.
    opt is a symbol for the graph type;
    n is the serial number of successful traces.'''
    logfh = open(opts.logfile, "a")
    if opts.filetype.upper() == "MGM":
        spectrum = getmgrkmerspectrum(filename, mgrkey=MGRKEY)
    elif opts.filetype == "file":
        spectrum = loadfile(filename)
    else:
        raise ValueError(
            "%s is invalid type (valid types are mgm and file)"
            % opts.filetype)
    if spectrum == []:   # Abort this trace--but try to graph the others
        return n
    if label is None:
        label = filename
    if spectrum.shape[1] > 0:
        spectrum = spectrum[np.lexsort((spectrum[:, 1], spectrum[:, 0]))]
        sys.stderr.write("Making graphs for %s\n" % filename)
        try:
            makegraphs(
                spectrum, filename, option=opt, label=label, n=n,
                dump=opts.dump, opts=opts, colorlist=colorlist,
                stylelist=stylelist)
#            sys.stderr.write("Printing stats in logfile %s %d\n" %
#                (opts.logfile, n))
            printstats(spectrum, filename, filehandle=logfh, n=n)
            n += 1
        except ValueError as err:   # This catches no data or defective data
            sys.stderr.write("Error printing stats for %s\n" % filename)
    else:
        sys.stderr.write("Error with dataset %s\n" % filename)
    return n
Esempio n. 3
0
def test_makegraphs_list_5():
    p = makegraphs([FIXTURE1, FIXTURE2], ["FIXTURE1", "SRR000331"], option=5)
Esempio n. 4
0
def test_makegraphs_list():
    p = makegraphs([FIXTURE1, FIXTURE2], ["FIXTURE1", "SRR000331"])
Esempio n. 5
0
def test_makegraphs_30():
    p = makegraphs(FIXTURE1, "tempfilename", option=30)
Esempio n. 6
0
def test_makegraphs_name():
    p = makegraphs(FIXTURE1, "tempfilename", option=6,
                   label="ridiculouslabel", name="graph title")
Esempio n. 7
0
def test_makegraphs_label():
    p = makegraphs(FIXTURE1, "tempfilename", option=6, label="ridiculouslabel")
Esempio n. 8
0
def test_makegraphs_m2d():
    p = makegraphs(FIXTURE1, "tempfilename", option=-
                   2, dump=True, suppress=True)
Esempio n. 9
0
def test_makegraphs_labels():
    p = makegraphs(FIXTURE1, "tempfilename",
                   ylabel="Y label", xlabel="X label")
Esempio n. 10
0
def test_makegraphs_6d(capsys):
    p = makegraphs(FIXTURE1, "tempfilename", option=6, dump=True)
    out, err = capsys.readouterr()
    assert len(out) < 30
Esempio n. 11
0
def test_makesgraphs():
    for i in range(-3, 29):
        print("testing visualization {:d}".format(i))
        p = makegraphs(FIXTURE1, "tempfilename", option=i)