aboutsummaryrefslogtreecommitdiff
path: root/bh20sequploader/main.py
diff options
context:
space:
mode:
authorPeter Amstutz2020-04-08 17:41:19 -0400
committerPeter Amstutz2020-04-08 17:46:12 -0400
commit9458ed33da08c787c4bb20af7b4108c93334b351 (patch)
treee4db1d5dbc8d653e05d612dc1229cef181bf68b3 /bh20sequploader/main.py
parent7140367bd832294c1756fe2369e91e7acc305083 (diff)
downloadbh20-seq-resource-9458ed33da08c787c4bb20af7b4108c93334b351.tar.gz
bh20-seq-resource-9458ed33da08c787c4bb20af7b4108c93334b351.tar.lz
bh20-seq-resource-9458ed33da08c787c4bb20af7b4108c93334b351.zip
Fastq now runs through fastq2fasta pipeline
then gets added to pangenome analysis.
Diffstat (limited to 'bh20sequploader/main.py')
-rw-r--r--bh20sequploader/main.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py
index 8b8fefe..56cbe22 100644
--- a/bh20sequploader/main.py
+++ b/bh20sequploader/main.py
@@ -20,12 +20,18 @@ def main():
api = arvados.api(host=ARVADOS_API_HOST, token=ARVADOS_API_TOKEN, insecure=True)
- qc_metadata(args.metadata.name)
+ if not qc_metadata(args.metadata.name):
+ print("Failed metadata qc")
+ exit(1)
col = arvados.collection.Collection(api_client=api)
- print("Reading FASTA")
- with col.open("sequence.fasta", "w") as f:
+ if args.sequence.name.endswith("fasta") or args.sequence.name.endswith("fa"):
+ target = "sequence.fasta"
+ elif args.sequence.name.endswith("fastq") or args.sequence.name.endswith("fq"):
+ target = "reads.fastq"
+
+ with col.open(target, "w") as f:
r = args.sequence.read(65536)
print(r[0:20])
while r:
@@ -52,5 +58,7 @@ def main():
(properties['upload_user'], properties['upload_ip']),
properties=properties, ensure_unique_name=True)
+ print("Done")
+
if __name__ == "__main__":
main()