# Path: inmembrane/helpers.py
# def log_stderr(s, width=76, comment=True):
#     """
#     Wrapper for all stderr out. Allows future customization.
#     """
#     if LOG_SILENT:
#         return
#     if s and s[-1] != "\n":
#         s += "\n"
#     if not s.startswith("#"):
#         s = "# " + s
#     sys.stderr.write(s)
# 
# def print_proteins(proteins):
#     """
#     Prints out the proteins dictionary in a formatted
#     manner that is also Python-eval compatible.
#     """
#     print "{"
#     for seqid in proteins:
#         print "  '%s': {" % seqid
#         for key, value in proteins[seqid].items():
#             print "    '%s': %s, " % (key, repr(value))
#         print "  },"
#     print "}"
#     # Standard Library alternative
#     # import pprint
#     # pp = pprint.PrettyPrinter(indent=4)
#     # print pp.pformat(proteins)


import sys, os, time, json, re
import logging
from suds.client import Client
from suds.bindings import binding
from inmembrane.helpers import log_stderr, print_proteins

        citation["name"] = result[0].method + " " + result[0].version

        for res in result.ann:
            # seqid = res.sequence.id
            seqid = tmhmm_seq_id_mapping[res.sequence.id]
            if 'tmhmm_helices' not in proteins[seqid]:
                proteins[seqid].update({
                    'tmhmm_helices': [],
                    'tmhmm_inner_loops': [],
                    'tmhmm_outer_loops': []
                })
            if len(res.annrecords) > 0:
                for segment in res.annrecords.annrecord:
                    if segment.comment in mapping:
                        tmhmmkey = mapping[segment.comment]
                        proteins[seqid][tmhmmkey].append( \
                            (segment.range.begin, segment.range.end))

            # for caching in the outfile
            if seqid not in tmhmm_dict:
                tmhmm_dict[seqid] = {}

            # extract a copy of results from proteins dictionary
            # ready to we written to cache file
            for k in mapping.values():
                tmhmm_dict[seqid][k] = proteins[seqid][k]

            tmhmm_dict[seqid]['program_name'] = citation['name']


# Path: inmembrane/helpers.py
# def log_stderr(s, width=76, comment=True):
#     """
#     Wrapper for all stderr out. Allows future customization.
#     """
#     if LOG_SILENT:
#         return
#     if s and s[-1] != "\n":
#         s += "\n"
#     if not s.startswith("#"):
#         s = "# " + s
#     sys.stderr.write(s)
# 
# def print_proteins(proteins):
#     """
#     Prints out the proteins dictionary in a formatted
#     manner that is also Python-eval compatible.
#     """
#     print "{"
#     for seqid in proteins:
#         print "  '%s': {" % seqid
#         for key, value in proteins[seqid].items():
#             print "    '%s': %s, " % (key, repr(value))
#         print "  },"
#     print "}"
#     # Standard Library alternative
#     # import pprint
#     # pp = pprint.PrettyPrinter(indent=4)
#     # print pp.pformat(proteins)


# Path: inmembrane/plugins/tmhmm_web.py
import sys, os, time, json, re
import logging
from suds.client import Client
from suds.bindings import binding
from inmembrane.helpers import log_stderr, print_proteins


        citation["name"] = result[0].method + " " + result[0].version

        for res in result.ann:
            # seqid = res.sequence.id
            seqid = tmhmm_seq_id_mapping[res.sequence.id]
            if 'tmhmm_helices' not in proteins[seqid]:
                proteins[seqid].update({
                    'tmhmm_helices': [],
                    'tmhmm_inner_loops': [],
                    'tmhmm_outer_loops': []
                })
            if len(res.annrecords) > 0:
                for segment in res.annrecords.annrecord:
                    if segment.comment in mapping:
                        tmhmmkey = mapping[segment.comment]
                        proteins[seqid][tmhmmkey].append( \
                            (segment.range.begin, segment.range.end))

            # for caching in the outfile
            if seqid not in tmhmm_dict:
                tmhmm_dict[seqid] = {}

            # extract a copy of results from proteins dictionary
            # ready to we written to cache file
            for k in mapping.values():
                tmhmm_dict[seqid][k] = proteins[seqid][k]

            tmhmm_dict[seqid]['program_name'] = citation['name']


    if __DEBUG__: print_proteins(proteins)