Exemplo n.º 1
0
def run(hg19Ref):
    getData()

    bam = "svviz-examples/chromEnds/begin.chr18.bam"
    command = "svviz -t del -b {bam} {ref} chr18 30 9500 --no-web".format(ref=hg19Ref, bam=bam)
    app.run(command.split())

    bam = "svviz-examples/chromEnds/end.chr18.bam"
    command = "svviz -t del -b {bam} {ref} chr18 78001429 78127146 --no-web".format(ref=hg19Ref, bam=bam)
    app.run(command.split())


    return True, ""
Exemplo n.º 2
0
def run(hg19Ref):
    getData()

    bam = "svviz-examples/chromEnds/begin.chr18.bam"
    command = "svviz -t del -b {bam} {ref} chr18 30 9500 --no-web".format(
        ref=hg19Ref, bam=bam)
    app.run(command.split())

    bam = "svviz-examples/chromEnds/end.chr18.bam"
    command = "svviz -t del -b {bam} {ref} chr18 78001429 78127146 --no-web".format(
        ref=hg19Ref, bam=bam)
    app.run(command.split())

    return True, ""
Exemplo n.º 3
0
def run():
    commands = [
        "svviz demo 1 -a --no-web", "svviz demo 2 -a --no-web",
        "svviz demo 2 -a --no-web --auto-export", "svviz demo 3 -a --no-web"
    ]
    times = []

    for command in commands:
        t0 = time.time()
        app.run(command.split(" "))
        times.append(time.time() - t0)

    print(pandas.DataFrame({"command": commands, "time (s)": times}))

    return (True, "")
Exemplo n.º 4
0
def run():
    commands = ["svviz demo 1 -a --no-web",
                "svviz demo 2 -a --no-web",
                "svviz demo 2 -a --no-web --auto-export",
                "svviz demo 3 -a --no-web"]
    times = []

    for command in commands:
        t0 = time.time()
        app.run(command.split(" "))
        times.append(time.time() - t0)

    print pandas.DataFrame({"command":commands, "time (s)":times})

    return (True, "")
Exemplo n.º 5
0
def run(genome, vcfs, bams, previousSummaryPath):
    timings = {}
    summaries = pandas.DataFrame()
    totalTime = 0

    for vcf in vcfs:
        name = os.path.basename(vcf)
        print(">", name, "<")

        args = []
        args.append("test_script")
        args.append("-t batch")
        args.append("--pair-min-mapq 50")
        args.append(" ".join("-b {}".format(bam) for bam in bams))
        args.append(genome)
        args.append(vcf)

        args = " ".join(args).split()

        print(args)
        t0 = time.time()
        curSummary = app.run(args)
        t1 = time.time()

        timings[name] = t1 - t0
        totalTime += t1 - t0

        curSummary = pandas.read_table(StringIO(six.text_type(curSummary)))
        summaries = pandas.concat([curSummary, summaries])

    if not os.path.exists(previousSummaryPath) or "-f" in sys.argv:
        print("=" * 30, "SAVING", "=" * 30)
        summaries.to_csv(previousSummaryPath, sep="\t")
        print(summaries)
        return (True, "")
    else:
        print("=" * 30, "COMPARING", "=" * 30)
        previousSummary = pandas.read_table(previousSummaryPath, index_col=0)

        combined = pandas.merge(previousSummary,
                                summaries,
                                how="outer",
                                on=["variant", "sample", "allele", "key"],
                                suffixes=["_prev", "_new"])
        combined = combined.set_index(["variant", "sample", "allele",
                                       "key"])  #.fillna(0)

        combined["diff"] = combined["value_new"] - combined["value_prev"]
        diff = combined.loc[~numpy.isclose(combined["diff"], 0), "diff"]

        if diff.shape[0] == 0:
            print("--- same as previous run ---")

            # return [True, "", totalTime]
            return (True, "")
        else:
            print(combined.loc[diff.index])
            return (False, "not equal to previous")
Exemplo n.º 6
0
def run(genome, vcfs, bams, previousSummaryPath):
    timings = {}
    summaries = pandas.DataFrame()
    totalTime = 0

    for vcf in vcfs:
        name = os.path.basename(vcf)
        print ">", name, "<"

        args = []
        args.append("test_script")
        args.append("-t batch")
        args.append("--pair-min-mapq 50")
        args.append(" ".join("-b {}".format(bam) for bam in bams))
        args.append(genome)
        args.append(vcf)

        args = " ".join(args).split()

        print args
        t0 = time.time()
        curSummary = app.run(args)
        t1 = time.time()

        timings[name] = t1-t0
        totalTime += t1-t0

        curSummary = pandas.read_table(StringIO(curSummary))
        summaries = pandas.concat([curSummary, summaries])



    if not os.path.exists(previousSummaryPath) or "-f" in sys.argv:
        print "="*30, "SAVING", "="*30
        summaries.to_csv(previousSummaryPath, sep="\t")
        print summaries
        return (True, "")
    else:
        print "="*30, "COMAPRING", "="*30
        previousSummary = pandas.read_table(previousSummaryPath, index_col=0)

        combined = pandas.merge(previousSummary, summaries, how="outer", 
                                on=["variant", "sample","allele","key"],
                                suffixes=["_prev", "_new"])
        combined = combined.set_index(["variant", "sample","allele","key"])#.fillna(0)

        combined["diff"] = combined["value_new"] - combined["value_prev"]
        diff = combined.loc[~numpy.isclose(combined["diff"], 0), "diff"]

        if diff.shape[0] == 0:
            print "--- same as previous run ---"

            # return [True, "", totalTime]
            return (True, "")
        else:
            print combined.loc[diff.index]
            return (False, "not equal to previous")
Exemplo n.º 7
0
    curSummaryPath = summaryPath.format(name)

    args = []
    args.append("test_script")
    args.append("-t batch")
    args.append("--summary {}".format(curSummaryPath))
    args.append(" ".join("-b {}".format(bam) for bam in bams))
    args.append(genome)
    args.append(vcf)

    args = " ".join(args).split()

    print args
    t0 = time.time()
    app.run(args)
    t1 = time.time()

    timings[name] = t1-t0

    curSummary = pandas.read_table(curSummaryPath)
    summaries = pandas.concat([curSummary, summaries])

previousSummaryPath = "/Users/nspies/Projects/svviz/tests/previousSummary.tsv"

if not os.path.exists(previousSummaryPath) or "-f" in sys.argv:
    print "="*30, "SAVING", "="*30
    summaries.to_csv(previousSummaryPath, sep="\t")
    print summaries
else:
    print "="*30, "COMAPRING", "="*30
Exemplo n.º 8
0
    curSummaryPath = summaryPath.format(name)

    args = []
    args.append("test_script")
    args.append("-t batch")
    args.append("--summary {}".format(curSummaryPath))
    args.append(" ".join("-b {}".format(bam) for bam in bams))
    args.append(genome)
    args.append(vcf)

    args = " ".join(args).split()

    print args
    t0 = time.time()
    app.run(args)
    t1 = time.time()

    timings[name] = t1 - t0

    curSummary = pandas.read_table(curSummaryPath)
    summaries = pandas.concat([curSummary, summaries])

previousSummaryPath = "/Users/nspies/Projects/svviz/tests/previousSummary.tsv"

if not os.path.exists(previousSummaryPath) or "-f" in sys.argv:
    print "=" * 30, "SAVING", "=" * 30
    summaries.to_csv(previousSummaryPath, sep="\t")
    print summaries
else:
    print "=" * 30, "COMAPRING", "=" * 30
Exemplo n.º 9
0
import pandas
import time
from svviz import app

commands = ["svviz demo 1 -a --no-web",
            "svviz demo 2 -a --no-web",
            "svviz demo 2 -a --no-web --auto-export"]
times = []

for command in commands:
    t0 = time.time()
    app.run(command.split(" "))
    times.append(time.time() - t0)

print pandas.DataFrame({"command":commands, "time (s)":times})
Exemplo n.º 10
0
import pandas
import time
from svviz import app

commands = [
    "svviz demo 1 -a --no-web", "svviz demo 2 -a --no-web",
    "svviz demo 2 -a --no-web --auto-export"
]
times = []

for command in commands:
    t0 = time.time()
    app.run(command.split(" "))
    times.append(time.time() - t0)

print pandas.DataFrame({"command": commands, "time (s)": times})