コード例 #1
0
def test_normalise_tsv():
    '''
    No conversion, just copies the file
    '''
    with tempfile.TemporaryDirectory() as tmpd:
        normalise(setup_args(data_dir, 'tsv', tmpd))
    pass
コード例 #2
0
def test_normalise_no_output():
    infile = os.path.join(data_dir, 'SimplifiedManifest_v1.0.xlsx')
    with tempfile.TemporaryDirectory() as tmpd:
        shutil.copy(infile, tmpd)
        infile = os.path.join(tmpd, os.path.basename(infile))
        args = Namespace(input=infile, output=None)
        normalise(args)
    pass
コード例 #3
0
def test_normalise_same_in_out_tsv():
    '''
    In and out are the same so no action taken (warning produced)
    '''
    infile = os.path.join(data_dir, 'SimplifiedManifest_v1.0.tsv')
    args = Namespace(input=infile, output=infile)
    normalise(args)
    pass
コード例 #4
0
#!/usr/bin/env python3

"""Converts manifests from various types to TSV"""

# python builtin
import argparse
import pkg_resources  # part of setuptools

# this project
from cgp_seq_input_val import constants, cliutil
from cgp_seq_input_val.manifest import normalise

version = pkg_resources.require("cgp_seq_input_val")[0].version

## read variables, auto help text
parser = argparse.ArgumentParser(description='Convert manifest files to common denominator (tsv)',
                                 epilog='Input can be [xls|xlsx|csv|tsv].  "tsv" is just copied to maintain tool-chain')
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + version)
parser.add_argument('-i', '--input', dest='input', metavar='FILE',
                    help='Input manifest in friendly formats', required=True,
                    type=lambda s: cliutil.extn_check(parser, constants.MANIFEST_EXTNS, s, readable=True))
parser.add_argument('-o', '--output', dest='output', metavar='FILE',
                    help='Output file *.tsv [default: sub. extension]', required=False,
                    type=lambda s: cliutil.extn_check(parser, ('tsv'), s))
args = parser.parse_args()

normalise(args)
コード例 #5
0
def test_normalise_tsv_no_output():
    infile = os.path.join(data_dir, 'SimplifiedManifest_v1.0.tsv')
    args = Namespace(input=infile, output=None)
    normalise(args)
    pass
コード例 #6
0
def test_normalise_csv():
    with tempfile.TemporaryDirectory() as tmpd:
        normalise(setup_args(data_dir, 'csv', tmpd))
    pass