Example #1
0
def tree_build():
    opts = {}
    # Hardcoded options, potentially expose
    opts["data_file"] = "data.nex"
    opts["seq_type"] = "dna"
    opts["fields"] = ["uuid"]
    opts["sort"] = ["uuid"]

    opts["rq"] = request.args.get("rq")
    opts["limit"] = request.args.get("limit", 10)

    # Generate a uuid job id
    opts["job_id"] = str(uuid.uuid4())

    idb = idigbio.json()
    results = idb.search_records(rq=opts["rq"], limit=opts["limit"], 
                                 fields=opts["fields"], sort=opts["sort"])

    idb_uuids = []
    for rec in results["items"]:
        idb_uuids.append(rec["indexTerms"]["uuid"])

    db = Database()
    opts["raw_seqs"] = {}
    for seq in db.sess.query(Sequence).filter(Sequence.idb_uuid.in_(idb_uuids)).filter(Sequence.can_use == True):
        # The "-" char messes up MrBayes even in the taxon name string field.
        # Change that here and it will percolate through the output without
        # affecting the data sources on the front end.
        opts["raw_seqs"][seq.idb_uuid.replace("-", "_")] = seq.seq

    pipeline.delay(opts)
    return jsonify({"job_id": opts["job_id"], "raw_seqs": opts["raw_seqs"], "rq": opts["rq"]})
Example #2
0
def tree_build():
    opts = {}
    # Hardcoded options, potentially expose
    opts["data_file"] = "data.nex"
    opts["seq_type"] = "dna"
    opts["fields"] = ["uuid"]
    opts["sort"] = ["uuid"]

    opts["rq"] = request.args.get("rq")
    opts["limit"] = request.args.get("limit", 10)

    # Generate a uuid job id
    opts["job_id"] = str(uuid.uuid4())

    idb = idigbio.json()
    results = idb.search_records(rq=opts["rq"],
                                 limit=opts["limit"],
                                 fields=opts["fields"],
                                 sort=opts["sort"])

    idb_uuids = []
    for rec in results["items"]:
        idb_uuids.append(rec["indexTerms"]["uuid"])

    db = Database()
    opts["raw_seqs"] = {}
    for seq in db.sess.query(Sequence).filter(
            Sequence.idb_uuid.in_(idb_uuids)).filter(Sequence.can_use == True):
        # The "-" char messes up MrBayes even in the taxon name string field.
        # Change that here and it will percolate through the output without
        # affecting the data sources on the front end.
        opts["raw_seqs"][seq.idb_uuid.replace("-", "_")] = seq.seq

    pipeline.delay(opts)
    return jsonify({
        "job_id": opts["job_id"],
        "raw_seqs": opts["raw_seqs"],
        "rq": opts["rq"]
    })
Example #3
0
idb = idigbio.json()
rq_ = {"genus": "acer"}
limit_ = 10
fields_ = ["uuid"]
sort_ = ["uuid"]
results = idb.search_records(rq=rq_, limit=limit_, fields=fields_, sort=sort_)
#print len(results["items"])
#print results["items"][0]["indexTerms"]["genus"]
#exit(0)
idb_uuids = []
for rec in results["items"]:
    idb_uuids.append(rec["indexTerms"]["uuid"])

print idb_uuids

db = Database()
opts["raw_seqs"] = {}
for seq in db.sess.query(Sequence).filter(Sequence.idb_uuid.in_(idb_uuids)):
    # The "-" char messes up MrBayes even in the taxon name string field.
    # Change that here and it will percolate through the output without
    # affecting the data sources on the front end.
    opts["raw_seqs"][seq.idb_uuid.replace("-", "_")] = seq.seq

opts["seq_type"] = "dna"
print opts

#msa.delay(opts)
#build.delay(opts)

pipeline.delay(opts)
Example #4
0
fields_ = ["uuid"]
sort_ = ["uuid"]
results = idb.search_records(rq=rq_, limit=limit_, fields=fields_, sort=sort_)
#print len(results["items"])
#print results["items"][0]["indexTerms"]["genus"]
#exit(0)
idb_uuids = []
for rec in results["items"]:
    idb_uuids.append(rec["indexTerms"]["uuid"])

print idb_uuids

db = Database()
opts["raw_seqs"] = {}
for seq in db.sess.query(Sequence).filter(Sequence.idb_uuid.in_(idb_uuids)):
    # The "-" char messes up MrBayes even in the taxon name string field.
    # Change that here and it will percolate through the output without
    # affecting the data sources on the front end.
    opts["raw_seqs"][seq.idb_uuid.replace("-", "_")] = seq.seq



opts["seq_type"] = "dna"
print opts

#msa.delay(opts)
#build.delay(opts)


pipeline.delay(opts)