# HG changeset patch # User galaxyp # Date 1664284924 0 # Node ID 8e637098a8ab8ac9684c1b0befb115fd201d2254 # Parent e9df53a75f3c3c304d25d52d6345cf4738538c9d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/dbbuilder commit 16ba4570b04301b774ee0420694f379cc640744b diff -r e9df53a75f3c -r 8e637098a8ab dbbuilder.xml --- a/dbbuilder.xml Wed Nov 25 17:43:51 2020 +0000 +++ b/dbbuilder.xml Tue Sep 27 13:22:04 2022 +0000 @@ -1,7 +1,9 @@ - + wget + python + requests @@ -14,8 +16,18 @@ '${output_database}' + #elif $type =="direct" wget -nv '$url' -O '${output_database}' --no-check-certificate #elif $type =="zip" wget -nv '$url' -O tmp.zip --no-check-certificate && zcat -c tmp.zip > '${output_database}' @@ -51,7 +65,8 @@ - + @@ -64,12 +79,14 @@ + + - - - + + + @@ -77,15 +94,16 @@ - - + + - + @@ -129,7 +147,9 @@ - + + + @@ -137,6 +157,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r e9df53a75f3c -r 8e637098a8ab uniprotkb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uniprotkb.py Tue Sep 27 13:22:04 2022 +0000 @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import argparse +import sys + +import requests + +uniprotkb_url = 'https://rest.uniprot.org/uniprotkb/stream?compressed=true&format=fasta&query=' + + +def __main__(): + parser = argparse.ArgumentParser( + description='Retrieve Uniprot data using streaming') + parser.add_argument('-u', '--url', help="Uniprot rest api URL") + parser.add_argument('-q', '--query', help="UniprotKB Query") + parser.add_argument('-o', '--output', type=argparse.FileType('wb'), default=sys.stdout, help='data') + parser.add_argument('-d', '--debug', action='store_true', help='Debug') + args = parser.parse_args() + if args.url: + url = args.url + else: + url = uniprotkb_url + args.query + with requests.get(url, stream=True) as request: + request.raise_for_status() + for chunk in request.iter_content(chunk_size=2**20): + args.output.write(chunk) + + +if __name__ == "__main__": + __main__()