<commit_before>
import os
import sys
import shutil
import traceback
import uuid
import urllib2

from urlparse import urlparse
from pprint import pprint, pformat

from biokbase.workspace.client import Workspace
from DataFileUtil.DataFileUtilClient import DataFileUtil

from GenomeFileUtil.core.GenbankUploaderScript import upload_genome

class GenbankToGenome:

    def __init__(self, sdk_config):
        self.cfg = sdk_config;

    def import_file(self, ctx, params):

        # 1) validate parameters and extract defaults
        self.validate_params(params)

        # 2) construct the input directory staging area
        input_directory = self.stage_input(params)


        # 3) extract out the parameters
        workspace_name = params['workspace_name']
        genome_name = params['genome_name']
        source = 'Genbank'
        if 'source' in params:
            source = source;
        taxon_wsname = 'ReferenceTaxons'
        if 'taxon_wsname' in params:
            taxon_wsname = params['taxon_wsname']

        if 'release' in params:
            release = params['release']

        if 'genetic_code' in params:
            genetic_code = params['genetic_code']

        if 'generate_ids_if_needed' in params:
            generate_ids_if_needed = params['generate_ids_if_needed']

        if 'type' in params:
            type = params['type']
        else:
            type = "User upload"

        # other options to handle
        # release
        # taxon_reference
        # exclude_feature_types
        # type<commit_msg>fixed a source bug<commit_after>
import os
import sys
import shutil
import traceback
import uuid
import urllib2

from urlparse import urlparse
from pprint import pprint, pformat

from biokbase.workspace.client import Workspace
from DataFileUtil.DataFileUtilClient import DataFileUtil

from GenomeFileUtil.core.GenbankUploaderScript import upload_genome

class GenbankToGenome:

    def __init__(self, sdk_config):
        self.cfg = sdk_config;

    def import_file(self, ctx, params):

        # 1) validate parameters and extract defaults
        self.validate_params(params)

        # 2) construct the input directory staging area
        input_directory = self.stage_input(params)


        # 3) extract out the parameters
        workspace_name = params['workspace_name']
        genome_name = params['genome_name']
        source = 'Genbank'
        if 'source' in params:
            source = params['source'];
        taxon_wsname = 'ReferenceTaxons'
        if 'taxon_wsname' in params:
            taxon_wsname = params['taxon_wsname']

        if 'release' in params:
            release = params['release']

        if 'genetic_code' in params:
            genetic_code = params['genetic_code']

        if 'generate_ids_if_needed' in params:
            generate_ids_if_needed = params['generate_ids_if_needed']

        if 'type' in params:
            type = params['type']
        else:
            type = "User upload"

        # other options to handle
        # release
        # taxon_reference
        # exclude_feature_types
        # type
{'fraction_non_alphanumeric': 0.0688324220006433, 'fraction_numerical': 0.002573174654229656, 'mean_word_length': 2.574712643678161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '401438', 'n_tokens_mistral': 892, 'n_tokens_neox': 853, 'n_words': 246}