示例#1
0
def main(argv):
    parser = argparse.ArgumentParser(
        description='Upload a hub to display on Apollo.')
    parser.add_argument('-j',
                        '--data_json',
                        help='JSON file containing the metadata of the inputs')
    parser.add_argument('-o', '--output', help='HTML output')

    #parser.add_argument('-e', '--extra_file_path', help='Extra file path for generated jbrowse hub')
    #parser.add_argument('-d', '--jbrowsehub', help='Name of the HTML summarizing the content of the JBrowse Hub Archive')

    # Get the args passed in parameter
    args = parser.parse_args()
    json_inputs_data = args.data_json
    outputFile = args.output
    #outputFile = args.jbrowsehub

    ##Parse JSON file with Reader
    reader = Reader(json_inputs_data)

    # Begin init variables
    extra_files_path = reader.getExtFilesPath()
    #user_email = reader.getUserEmail()
    species_name = reader.getSpeciesName()
    #apollo_host = reader.getApolloHost()
    apollo_port = reader.getPortNum()
    apollo_host = "http://localhost:" + apollo_port + "/apollo"
    #apollo_host = "http://localhost:8080/apollo"
    #apollo_user = reader.getApolloUser()
    apollo_admin_user = reader.getAdminUser()
    toolDirectory = reader.getToolDir()
    #jbrowse_hub = reader.getJBrowseHubDir()
    debug_mode = reader.getDebugMode()

    #### Logging management ####
    # If we are in Debug mode, also print in stdout the debug dump
    log = Logger(tool_directory=toolDirectory,
                 debug=debug_mode,
                 extra_files_path=extra_files_path)
    log.setup_logging()

    logging.info(
        "#### JBrowseArchiveCreator: Start to upload JBrowse Hub to Apollo instance: %s #### ",
        apollo_host)
    logging.debug('JSON parameters: %s\n\n', json.dumps(reader.args))

    # Set up apollo
    apollo = ApolloInstance(apollo_host, apollo_admin_user, toolDirectory)
    jbrowse_hub_dir = _getHubDir(extra_files_path)
    apollo.loadHubToApollo(apollo_admin_user,
                           species_name,
                           jbrowse_hub_dir,
                           admin=True)
    outHtml(outputFile, apollo_host, species_name)

    logging.info(
        '#### JBrowseArchiveCreator: Congratulation! JBrowse Hub is uploaded! ####\n'
    )
def main(argv):
    parser = argparse.ArgumentParser(description='Upload a hub to display on Apollo.')
    parser.add_argument('-j', '--data_json', help='JSON file containing the metadata of the inputs')
    parser.add_argument('-o', '--output', help='HTML output')
    
    # Get the args passed in parameter
    args = parser.parse_args()
    json_inputs_data = args.data_json
    outputFile = args.output
    
    ##Parse JSON file with Reader
    reader = Reader(json_inputs_data)

    # Begin init variables
    
    apollo_port = reader.getPortNum()
    apollo_host = "http://localhost:"+ apollo_port + "/apollo"
    apollo_admin_user = reader.getAdminUser()
    toolDirectory = reader.getToolDir()
    extra_files_path = reader.getExtFilesPath()
    debug_mode = reader.getDebugMode()
    operations_dictionary = reader.getOperationList()
    

    
        
    #### Logging management ####
    # If we are in Debug mode, also print in stdout the debug dump
    log = Logger(tool_directory=toolDirectory, debug=debug_mode, extra_files_path=extra_files_path)
    log.setup_logging()

    logging.info("#### Apollo User Manager: Start on Apollo instance: %s #### ", apollo_host)
    logging.debug('JSON parameters: %s\n\n', json.dumps(reader.args))

    # Set up apollo
    apollo = ApolloInstance(apollo_host, apollo_admin_user, toolDirectory) 
    apollo.manageApolloUser(operations_dictionary)
    outHtml(outputFile, apollo_host)
    logging.info('#### Apollo User Manager: Congratulation! ####\n')
示例#3
0
def main(argv):
    parser = argparse.ArgumentParser(
        description='Create a hub to display in jbrowse.')
    parser.add_argument('-j',
                        '--data_json',
                        help='JSON file containing the metadata of the inputs')
    parser.add_argument(
        '-o',
        '--output',
        help=
        'Name of the HTML summarizing the content of the JBrowse Hub Archive')

    # Get the args passed in parameter
    args = parser.parse_args()
    json_inputs_data = args.data_json
    outputFile = args.output

    ##Parse JSON file with Reader
    reader = Reader(json_inputs_data)

    # Begin init variables
    extra_files_path = reader.getExtFilesPath()
    toolDirectory = reader.getToolDir()
    #outputFile = reader.getOutputDir()
    user_email = reader.getUserEmail()
    reference_genome = reader.getRefGenome()
    debug_mode = reader.getDebugMode()
    track_type = reader.getTrackType()

    #### Logging management ####
    # If we are in Debug mode, also print in stdout the debug dump
    log = Logger(tool_directory=toolDirectory,
                 debug=debug_mode,
                 extra_files_path=extra_files_path)
    log.setup_logging()
    logging.info('#### JBrowseArchiveCreator: Start ####\n')
    logging.debug('---- Welcome in JBrowseArchiveCreator Debug Mode ----\n')
    logging.debug('JSON parameters: %s\n\n', json.dumps(reader.args))
    #### END Logging management ####

    # Create the Track Hub folder
    logging.info(
        '#### JBrowseArchiveCreator: Creating the Track Hub folder ####\n')
    trackHub = TrackHub(reference_genome, outputFile, extra_files_path,
                        toolDirectory, track_type)

    # Create Ordered Dictionary to add the tracks in the tool form order
    logging.info('#### JBrowseArchiveCreator: Preparing track data ####\n')
    all_datatype_dictionary = reader.getTracksData()
    all_datatype_ordered_dictionary = collections.OrderedDict(
        all_datatype_dictionary)

    logging.debug("----- End of all_datatype_dictionary processing -----")
    #logging.debug("all_datatype_ordered_dictionary are: %s", json.dumps(all_datatype_ordered_dictionary))

    logging.info(
        '#### JBrowseArchiveCreator: Adding tracks to Track Hub ####\n')
    logging.debug("----- Beginning of Track adding processing -----")

    for index, datatypeObject in all_datatype_ordered_dictionary.iteritems():
        trackHub.addTrack(datatypeObject.track.track_db)

    logging.debug("----- End of Track adding processing -----")

    # We terminate the process and so create a HTML file summarizing all the files
    logging.info('#### JBrowseArchiveCreator: Creating the HTML file ####\n')
    trackHub.terminate(debug_mode)

    logging.debug('---- End of JBrowseArchiveCreator Debug Mode: Bye! ----\n')
    logging.info(
        '#### JBrowseArchiveCreator: Congratulation! Assembly Hub is created! ####\n'
    )

    sys.exit(0)