# Path: crumbs/utils/file_utils.py
# def get_input_fhand(in_fhand):
#     in_fhand = wrap_in_buffered_reader(in_fhand, buffering=DEF_FILE_BUFFER)
# 
#     in_compressed = _vcf_is_gz(in_fhand)
#     if in_compressed and not _fhand_is_tellable(in_fhand):
#         msg = 'The given input has no tell member and it is compressed. '
#         msg += 'You cannot use gzip file through stdin, try to pipe it '
#         msg += 'uncompressed with zcat |'
#         raise RuntimeError(msg)
# 
#     if in_compressed:
#         mod_in_fhand = GzipFile(fileobj=in_fhand)
#     else:
#         mod_in_fhand = in_fhand
# 
#     return mod_in_fhand


import argparse
import sys
from crumbs.utils.file_utils import get_input_fhand
    in_help = 'Input VCF file (default STDIN)'
    parser.add_argument('input', help=in_help, nargs='?',
                        type=argparse.FileType('rb'), default=sys.stdin)
    parser.add_argument('-o', '--output', default=sys.stdout,
                        help='Output VCF file (default STDOUT)',
                        type=argparse.FileType('w'))
    msg = 'File to print some statistics (default STDERR)'
    parser.add_argument('-l', '--log', help=msg, type=argparse.FileType('w'),
                        default=sys.stderr)

    return parser


def setup_filter_argparse(**kwargs):
    'It prepares the command line argument parsing.'
    parser = setup_basic_argparse(**kwargs)
    parser.add_argument('-f', '--filtered',
                        help='Output for filtered SNVs',
                        type=argparse.FileType('w'))
    parser.add_argument('-s', '--samples', action='append',
                        help='samples to use')
    parser.add_argument('-p', '--samples_file',
                        help='File with samples to use. One per line',
                        type=argparse.FileType('r'))
    return parser


def parse_basic_args(parser):
    parsed_args = parser.parse_args()


# Path: crumbs/utils/file_utils.py
# def get_input_fhand(in_fhand):
#     in_fhand = wrap_in_buffered_reader(in_fhand, buffering=DEF_FILE_BUFFER)
# 
#     in_compressed = _vcf_is_gz(in_fhand)
#     if in_compressed and not _fhand_is_tellable(in_fhand):
#         msg = 'The given input has no tell member and it is compressed. '
#         msg += 'You cannot use gzip file through stdin, try to pipe it '
#         msg += 'uncompressed with zcat |'
#         raise RuntimeError(msg)
# 
#     if in_compressed:
#         mod_in_fhand = GzipFile(fileobj=in_fhand)
#     else:
#         mod_in_fhand = in_fhand
# 
#     return mod_in_fhand


# Path: crumbs/vcf/utils/bin_utils.py
import argparse
import sys
from crumbs.utils.file_utils import get_input_fhand

    in_help = 'Input VCF file (default STDIN)'
    parser.add_argument('input', help=in_help, nargs='?',
                        type=argparse.FileType('rb'), default=sys.stdin)
    parser.add_argument('-o', '--output', default=sys.stdout,
                        help='Output VCF file (default STDOUT)',
                        type=argparse.FileType('w'))
    msg = 'File to print some statistics (default STDERR)'
    parser.add_argument('-l', '--log', help=msg, type=argparse.FileType('w'),
                        default=sys.stderr)

    return parser


def setup_filter_argparse(**kwargs):
    'It prepares the command line argument parsing.'
    parser = setup_basic_argparse(**kwargs)
    parser.add_argument('-f', '--filtered',
                        help='Output for filtered SNVs',
                        type=argparse.FileType('w'))
    parser.add_argument('-s', '--samples', action='append',
                        help='samples to use')
    parser.add_argument('-p', '--samples_file',
                        help='File with samples to use. One per line',
                        type=argparse.FileType('r'))
    return parser


def parse_basic_args(parser):
    parsed_args = parser.parse_args()


    in_fhand = get_input_fhand(parsed_args.input)