# HG changeset patch # User iuc # Date 1465584532 14400 # Node ID 3ebc86b520d7bd153dfd4e44f784855a9054c9e0 # Parent de108f838cb0710137e73f550dd2d56c87714685 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 041f11d6eb83568deda382857b121274dffe9825 diff -r de108f838cb0 -r 3ebc86b520d7 __efetch_build_options.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/__efetch_build_options.py Fri Jun 10 14:48:52 2016 -0400 @@ -0,0 +1,267 @@ +#!/usr/bin/env python +# Daniel Blankenberg +# Creates the options for tool interface +import re + +# http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi +db_list = ''' +annotinfo +assembly +bioproject +biosample +biosystems +blastdbinfo +books +cdd +clinvar +clone +dbvar +gap +gapplus +gds +gencoll +gene +genome +geoprofiles +grasp +gtr +homologene +medgen +mesh +ncbisearch +nlmcatalog +nuccore +nucest +nucgss +nucleotide +omim +orgtrack +pcassay +pccompound +pcsubstance +pmc +popset +probe +protein +proteinclusters +pubmed +pubmedhealth +seqannot +snp +sra +structure +taxonomy +unigene'''.replace( "", "").replace( "", "").split("\n") + + +help = ''' (all) + docsum xml Document Summary + docsum json Document Summary + full text Full Document + uilist xml Unique Identifier List + uilist text Unique Identifier List + full xml Full Document + + bioproject + native BioProject Report + native xml RecordSet + + biosample + native BioSample Report + native xml BioSampleSet + + biosystems + native xml Sys-set + + gds + native xml RecordSet + summary text Summary + + gene + gene_table xml Gene Table + native text Gene Report + native asn.1 Entrezgene + native xml Entrezgene-Set + tabular tabular Tabular Report + + homologene + alignmentscores text Alignment Scores + fasta fasta FASTA + homologene text Homologene Report + native text Homologene List + native asn.1 HG-Entry + native xml Entrez-Homologene-Set + + mesh + full text Full Record + native text MeSH Report + native xml RecordSet + + nlmcatalog + native text Full Record + native xml NLMCatalogRecordSet + + pmc + medline text MEDLINE + native xml pmc-articleset + + pubmed + abstract xml Abstract + medline text MEDLINE + native asn.1 Pubmed-entry + native xml PubmedArticleSet + + (sequences) + acc text Accession Number + est xml EST Report + fasta fasta FASTA + fasta xml TinySeq + fasta_cds_aa fasta CDS Products + fasta_cds_na fasta Coding Regions + ft text Feature Table + gb text GenBank Flatfile + gb xml GBSet + gbc xml INSDSet + gbwithparts text GenBank with Contig Sequences + gene_fasta fasta FASTA of Gene + gp text GenPept Flatfile + gp xml GBSet + gpc xml INSDSet + gss text GSS Report + ipg text Identical Protein Report + ipg xml IPGReportSet + native text Seq-entry + native xml Bioseq-set + seqid asn.1 Seq-id + + snp + chr text Chromosome Report + docset text Summary + fasta fasta FASTA + flt text Flat File + native asn.1 Rs + native xml ExchangeSet + rsr tabular RS Cluster Report + ssexemplar text SS Exemplar List + + sra + native xml EXPERIMENT_PACKAGE_SET + runinfo xml SraRunInfo + + structure + mmdb asn.1 Ncbi-mime-asn1 strucseq + native text MMDB Report + native xml RecordSet + + taxonomy + native text Taxonomy List + native xml TaxaSet'''.split("\n") + + +db = {} +for db_name in db_list: + db[db_name] = [] + +section = None +for line in help: + line = re.split('\s{2,}', line.strip()) + # Ignore empties + if len(line) == 0: + continue + # Section headers have one item + elif len(line) == 1: + section = line[0] + db[section] = [] + # Format lines have 2+ + elif len(line) == 2: + parent_format = line[0] + description = line[1] + + if parent_format not in db[section]: + db[section].append((parent_format, None, description)) + elif len(line) == 3: + parent_format = line[0] + format_modifier = line[1] + description = line[2] + + if parent_format not in db[section]: + db[section].append((parent_format, format_modifier, description)) + + +all_formats = db['(all)'] +del db['(all)'] +sequences_formats = db['(sequences)'] +del db['(sequences)'] +del db[''] + +for key in db: + db[key] += all_formats + +for key in ('nuccore', 'nucest', 'nucgss', 'nucleotide'): + db[key] += sequences_formats + +MACRO_TPL = ''' + +''' + +WHEN_TPL = ''' + + {format_options} + + ''' + +FORMAT_OPTION_TPL = '''''' + +format_names = {} + +print ''' + + ''' +for key in sorted(db): + format_options = [] + + for (parent_format, format_modifier, description) in sorted(db[key]): + name_human = description + if format_modifier: + name_human += ' (%s)' % format_modifier + format_string = '%s-%s' % (parent_format, format_modifier) + + format_options.append(FORMAT_OPTION_TPL.format( + name_type=format_string, + name_type_human=name_human, + )) + + format_names[format_string] = format_modifier + + print WHEN_TPL.format( + format=key, + format_options='\n '.join(format_options) + ) + +print ''' + ''' + +CHANGE_FORMAT_TPL = ''' + + + {formats} + + +''' + +CHANGE_FORMAT_WHEN_TPL = '''''' +# Format options + + +whens = [] +for (k, v) in format_names.items(): + if v is None: + v = 'text' + elif v == 'asn.1': + v = 'asn1' + + whens.append(CHANGE_FORMAT_WHEN_TPL.format( + key=k, value=v + )) + +print CHANGE_FORMAT_TPL.format(formats='\n '.join(whens)) diff -r de108f838cb0 -r 3ebc86b520d7 elink.py --- a/elink.py Thu Apr 07 17:36:58 2016 -0400 +++ b/elink.py Fri Jun 10 14:48:52 2016 -0400 @@ -1,7 +1,8 @@ #!/usr/bin/env python import argparse +import json + import eutils -import json if __name__ == '__main__': @@ -9,8 +10,8 @@ parser.add_argument('db', help='Database to use, sometimes "none" (e.g. *check)') parser.add_argument('dbfrom', help='Database containing input UIDs') parser.add_argument('cmd', choices=['neighbor', 'neighbor_score', - 'neighbor_history', 'acheck', 'ncheck', 'lcheck', - 'llinks', 'llinkslib', 'prlinks'], + 'neighbor_history', 'acheck', 'ncheck', 'lcheck', + 'llinks', 'llinkslib', 'prlinks'], help='ELink command mode') # Only used in case of neighbor_history parser.add_argument('--history_out', type=argparse.FileType('w'), diff -r de108f838cb0 -r 3ebc86b520d7 eutils.py --- a/eutils.py Thu Apr 07 17:36:58 2016 -0400 +++ b/eutils.py Fri Jun 10 14:48:52 2016 -0400 @@ -27,6 +27,7 @@ if history_file is not None: with open(history_file, 'r') as handle: data = json.loads(handle.read()) + print data self.query_key = data['QueryKey'] self.webenv = data['WebEnv'] self.using_history = True diff -r de108f838cb0 -r 3ebc86b520d7 eutils.pyc Binary file eutils.pyc has changed diff -r de108f838cb0 -r 3ebc86b520d7 macros.xml --- a/macros.xml Thu Apr 07 17:36:58 2016 -0400 +++ b/macros.xml Fri Jun 10 14:48:52 2016 -0400 @@ -1,6 +1,6 @@ - 1.0 + 1.1 --user_email "$__user_email__" #set admin_emails = ';'.join(str($__admin_users__).split(',')) @@ -90,6 +90,7 @@ token_label="NCBI Database to Use" > + @@ -100,23 +101,26 @@ - + + + - - + + + @@ -127,403 +131,665 @@ + - - - + + + + + + + + + + - - - + + + + + + - - - - + + + + + + + + - - - - - + + + + + + + + - - - - + + + + + + + - - - + + + + + + - - - + + + + + + - - - + + + + + + - - - + + + + + + - - - + + + + + + - - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + - - - + + + + + + - - - + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + + + + - - - - + + + + + + + + + - - - + + + + + + - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - - - + + + + + + - - - + + + + + + - - - + + + + + + - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + - - - + + + + + + - - - - - - - - + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + + + + + - - - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #if $query_source.qss == "history": --history_file $query_source.history_file @@ -576,5 +842,5 @@ - +