# HG changeset patch # User galaxyp # Date 1664284888 0 # Node ID 3f6354b7eb942aa9d026b590e7f486d5084fa84f # Parent 8e263cd38da12e481329433d2762e79791c997d7 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/dbbuilder commit 16ba4570b04301b774ee0420694f379cc640744b diff -r 8e263cd38da1 -r 3f6354b7eb94 dbbuilder.xml --- a/dbbuilder.xml Wed Nov 25 17:43:27 2020 +0000 +++ b/dbbuilder.xml Tue Sep 27 13:21:28 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 8e263cd38da1 -r 3f6354b7eb94 uniprotkb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uniprotkb.py Tue Sep 27 13:21:28 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__()