Mercurial > repos > eric-rasche > apollo
diff export.py @ 5:7610987e0c48 draft
planemo upload for repository https://github.com/TAMU-CPT/galaxy-webapollo commit 29795b77c0d5c7894219b018a92c5ee7818096c3
author | eric-rasche |
---|---|
date | Wed, 01 Mar 2017 22:39:58 -0500 |
parents | d4ae83dedb14 |
children | f9a6e151b3b4 |
line wrap: on
line diff
--- a/export.py Thu Jan 12 11:53:44 2017 -0500 +++ b/export.py Wed Mar 01 22:39:58 2017 -0500 @@ -1,6 +1,10 @@ #!/usr/bin/env python import sys -import StringIO +try: + import StringIO as io +except ImportError: + import io + import json import argparse from Bio import SeqIO @@ -11,7 +15,7 @@ def export(org_cn, seqs): org_data = wa.organisms.findOrganismByCn(org_cn) - data = StringIO.StringIO() + data = io.StringIO() kwargs = dict( exportType='GFF3', @@ -40,11 +44,12 @@ records = list(GFF.parse(data)) if len(records) == 0: - print "Could not find any sequences or annotations for this organism + reference sequence" + print("Could not find any sequences or annotations for this organism + reference sequence") sys.exit(2) else: for record in records: record.annotations = {} + record.features = sorted(record.features, key=lambda x: x.location.start) if args.gff: GFF.write([record], args.gff) record.description = "" @@ -53,6 +58,7 @@ return org_data + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Sample script to add an attribute to a feature via web services') WAAuth(parser)