# Path: dark/sam.py
# def samReferencesToStr(filenameOrSamfile, indent=0):
#     """
#     List SAM/BAM file reference names and lengths.
# 
#     @param filenameOrSamfile: Either a C{str} SAM/BAM file name or an
#         instance of C{pysam.AlignmentFile}.
#     @param indent: An C{int} number of spaces to indent each line.
#     @return: A C{str} describing known reference names and their lengths.
#     """
#     indent = ' ' * indent
# 
#     def _references(sam):
#         result = []
#         for i in range(sam.nreferences):
#             result.append('%s%s (length %d)' % (
#                 indent, sam.get_reference_name(i), sam.lengths[i]))
#         return '\n'.join(result)
# 
#     if isinstance(filenameOrSamfile, six.string_types):
#         with samfile(filenameOrSamfile) as sam:
#             return _references(sam)
#     else:
#         return _references(sam)


import argparse
from dark.sam import samReferencesToStr
#!/usr/bin/env python

from __future__ import print_function



parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Print SAM/BAM file reference names and lengths.')

parser.add_argument(
    'samfile', metavar='FILENAME',

# Path: dark/sam.py
# def samReferencesToStr(filenameOrSamfile, indent=0):
#     """
#     List SAM/BAM file reference names and lengths.
# 
#     @param filenameOrSamfile: Either a C{str} SAM/BAM file name or an
#         instance of C{pysam.AlignmentFile}.
#     @param indent: An C{int} number of spaces to indent each line.
#     @return: A C{str} describing known reference names and their lengths.
#     """
#     indent = ' ' * indent
# 
#     def _references(sam):
#         result = []
#         for i in range(sam.nreferences):
#             result.append('%s%s (length %d)' % (
#                 indent, sam.get_reference_name(i), sam.lengths[i]))
#         return '\n'.join(result)
# 
#     if isinstance(filenameOrSamfile, six.string_types):
#         with samfile(filenameOrSamfile) as sam:
#             return _references(sam)
#     else:
#         return _references(sam)


# Path: bin/sam-references.py
import argparse
from dark.sam import samReferencesToStr

#!/usr/bin/env python

from __future__ import print_function



parser = argparse.ArgumentParser(
    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    description='Print SAM/BAM file reference names and lengths.')

parser.add_argument(
    'samfile', metavar='FILENAME',

    help='The name of a SAM/BAM alignment file.')