def main():
    args = parser.parse_args()
    files, size = get_files(args.paths)
    print('Collected %s files with total size: %s' % (len(files), friendly_number(size)))
    try:
        connection = get_connection(args)
    except GenestackVersionException as e:
        sys.stderr.write(str(e))
        sys.stderr.write('\n')
        exit(13)
    new_folder, folder_name, accessions = upload_files(connection, files, args.folder_name)
    print('%s files were uploaded to %s / %s' % (len(accessions), new_folder, folder_name))
    if args.no_recognition:
        exit(0)
    try:
        recognize_files(connection, accessions, new_folder)
    except GenestackServerException as e:
        sys.stderr.write("Recognition failed: %s\n" % e)
        exit(1)
def main():
    args = parser.parse_args()
    files, size = get_files(args.paths)
    print('Collected %s files with total size: %s' %
          (len(files), friendly_number(size)))
    try:
        connection = get_connection(args)
    except GenestackVersionException as e:
        sys.stderr.write(str(e))
        sys.stderr.write('\n')
        exit(13)
    new_folder, folder_name, accessions = upload_files(connection, files,
                                                       args.folder_name,
                                                       args.upload_to)
    print('%s files were uploaded to %s / %s' %
          (len(accessions), new_folder, folder_name))
    if args.no_recognition:
        exit(0)
    try:
        recognize_files(connection, accessions, new_folder)
    except GenestackServerException as e:
        sys.stderr.write("Recognition failed: %s\n" % e)
        exit(1)
Beispiel #3
0
parser.add_argument(
    'csv_file',
    help='Path to the local comma-delimited CSV file containing the data')
parser.add_argument('--name',
                    help='Name of the experiment to create in Genestack')
parser.add_argument(
    '--description',
    help='Description of the experiment to display in Genestack')

args = parser.parse_args()
csv_input = args.csv_file

print "Connecting to Genestack..."

# get connection and application handlers
connection = get_connection(args)
importer = DataImporter(connection)

# file format of the reads to import
file_format = UnalignedReads.compose_format_map(UnalignedReads.Space.BASESPACE,
                                                UnalignedReads.Format.PHRED33,
                                                UnalignedReads.Type.SINGLE)

# create the experiment where we will store the data in Genestack
experiment = importer.create_experiment(name=args.name
                                        or "Imported experiment",
                                        description=args.description
                                        or "No description provided")

print "Created a new experiment with accession %s..." % experiment
if __name__ == "__main__":
    # parse script arguments
    parser = make_connection_parser()
    parser.add_argument('csv_file', help='Path to the local comma-delimited CSV file containing the data')
    parser.add_argument('local_key', help='Name of the local key to match CSV records and Genestack files names')
    parser.add_argument('folder', help='Accession of the Genestack folder containing the files')

    args = parser.parse_args()
    csv_input = args.csv_file
    local_key = args.local_key

    print "Connecting to Genestack..."

    # get connection and application handlers
    connection = get_connection(args)
    files_util = FilesUtil(connection)

    print "Collecting files..."
    files = files_util.get_file_children(args.folder)
    print "Found %d files. Collecting metadata..." % len(files)
    infos = files_util.get_infos(files)

    identifier_map = {info['name']: info['accession'] for info in infos}

    # parse the CSV file
    with open(csv_input, 'r') as the_file:
        reader = csv.DictReader(the_file, delimiter=",")
        field_names = reader.fieldnames

        if args.local_key not in field_names:
Beispiel #5
0
def conn(args):
    if get_user(args).host != "internal-dev.genestack.com":
        sys.stderr.write("Tests must be run on internal-dev")
        sys.exit(1)
    connection = get_connection(args)
    return connection
Beispiel #6
0
def files_utils():
    connection = get_connection(make_connection_parser().parse_args([]))
    files_utils = FilesUtil(connection)
    return files_utils
def conn():
    conn = get_connection(make_connection_parser().parse_args())
    return conn
def conn(args):
    if get_user(args).host != "internal-dev.genestack.com":
        sys.stderr.write("Tests must be run on internal-dev")
        sys.exit(1)
    connection = get_connection(args)
    return connection
Beispiel #9
0
def conn():
    conn = get_connection(make_connection_parser().parse_args())
    return conn
Beispiel #10
0
def test_future_version():
    connection = get_connection()
    assert connection.check_version('99.99.99') == ''
Beispiel #11
0
def test_too_old():
    connection = get_connection()
    with pytest.raises(GenestackException):
        assert connection.check_version('0.0.1')
Beispiel #12
0
def test_current_version():
    connection = get_connection()
    assert connection.check_version(__version__) == ''
from builtins import *
from genestack_client import TaskLogViewer, get_connection, make_connection_parser

# add extra arguments to the Genestack arguments parser for this script
parser = make_connection_parser()
parser.add_argument('-f',
                    '--follow',
                    action='store_true',
                    help="Follow the logs' output if the task is not done")
parser.add_argument(
    '-t',
    '--type',
    metavar='<log_type>',
    choices=[TaskLogViewer.STDERR, TaskLogViewer.STDOUT],
    default=TaskLogViewer.STDOUT,
    help="Type of logs to display ('{0}' or '{1}' ; default is '{0}')".format(
        TaskLogViewer.STDOUT, TaskLogViewer.STDERR))
parser.add_argument('accession',
                    metavar='<accession>',
                    help='Accession of the file for which to display the logs')
arguments = parser.parse_args()

# connect to Genestack
connection = get_connection(arguments)
log_viewer = TaskLogViewer(connection)

# print task logs
log_viewer.print_log(arguments.accession,
                     log_type=arguments.type,
                     follow=arguments.follow)
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

from genestack_client import TaskLogViewer, get_connection, make_connection_parser

# add extra arguments to the Genestack arguments parser for this script
parser = make_connection_parser()
parser.add_argument('-f', '--follow', action='store_true', help="Follow the logs' output if the task is not done")
parser.add_argument('-t', '--type', metavar='<log_type>',
                    choices=[TaskLogViewer.STDERR, TaskLogViewer.STDOUT],
                    default=TaskLogViewer.STDOUT,
                    help="Type of logs to display ('{0}' or '{1}' ; default is '{0}')".format(
                        TaskLogViewer.STDOUT, TaskLogViewer.STDERR))
parser.add_argument('accession', metavar='<accession>', help='Accession of the file for which to display the logs')
arguments = parser.parse_args()

# connect to Genestack
connection = get_connection(arguments)
log_viewer = TaskLogViewer(connection)

# print task logs
log_viewer.print_log(arguments.accession, log_type=arguments.type, follow=arguments.follow)
def files_utils():
    connection = get_connection(make_connection_parser().parse_args([]))
    files_utils = FilesUtil(connection)
    return files_utils