Commit c59ee118 authored by aknecht2's avatar aknecht2
Browse files

Updated import script, fixed progress utility.

parent b2f7f01d
......@@ -5,5 +5,4 @@ def progress(current, end):
hashes = "#" * int(round(percent * 20))
spaces = " " * (20 - len(hashes))
sys.stdout.write("\rProcessed %s / %s entries. [%s] %s%%" % (current, end, hashes + spaces, int(round(percent * 100))))
sys.stdout.flush()
......@@ -11,7 +11,7 @@ parser.add_argument("--host", dest="host", default="hcc-anvil-241-41.unl.edu", r
parser.add_argument("--drop", dest="drop", default=False, action="store_true", help="Drop data if it exists.")
args = parser.parse_args()
# Everything in a db named chipseq
# Everything in a db named chipseq
# Set up connection and authenticate
client = MongoClient(args.host)
......@@ -35,9 +35,9 @@ organism = {
# Loop through experiments to create samples
cursor = db.experiments.find({
"target": {"$exists": True},
"revoked_files.0": {"$exists": False},
"assembly.0": {"$exists": True},
"target": {"$exists": True},
"revoked_files.0": {"$exists": False},
"assembly.0": {"$exists": True},
"assembly.1": {"$exists": False}
})
......@@ -52,6 +52,8 @@ for i,document in enumerate(cursor):
if "/targets/H" in document["target"]:
doc["histone_modification"] = document["target"].split("/")[2][:2]
doc["transcription_factor"] = document["target"].split("/")[2][2:].split("-")[0]
elif document["target"].split("/")[2].split("-")[0].lower() == "control":
doc["control"] = True
else:
doc["transcription_factor"] = document["target"].split("/")[2].split("-")[0]
doc["cell_type"] = document["biosample_term_name"]
......@@ -61,4 +63,3 @@ for i,document in enumerate(cursor):
progress(total, total)
print
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment