コード例 #1
0
def from_analysis(context, database_connection, analysis_connection,
                  analysis_identifier, reduction, derivatization, name):
    database_connection = DatabaseBoundOperation(database_connection)
    if name is not None:
        name = validate_glycan_hypothesis_name(
            context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)

    analysis_connection = DatabaseBoundOperation(analysis_connection)
    analysis = get_by_name_or_id(analysis_connection.session, Analysis,
                                 analysis_identifier)
    if analysis.analysis_type == AnalysisTypeEnum.glycan_lc_ms:
        job = GlycanAnalysisHypothesisSerializer(
            analysis_connection._original_connection,
            analysis.id,
            name,
            output_connection=database_connection._original_connection)
        job.display_header()
        job.start()
    elif analysis.analysis_type == AnalysisTypeEnum.glycopeptide_lc_msms:
        job = GlycopeptideAnalysisGlycanCompositionExtractionHypothesisSerializer(
            analysis_connection._original_connection,
            analysis.id,
            name,
            output_connection=database_connection._original_connection)
        job.display_header()
        job.start()
    else:
        click.secho("Analysis Type %r could not be converted" %
                    (analysis.analysis_type.name, ),
                    fg='red')
コード例 #2
0
def from_analysis(context, database_connection, analysis_connection, analysis_identifier,
                  reduction, derivatization, name):
    database_connection = DatabaseBoundOperation(database_connection)
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)

    analysis_connection = DatabaseBoundOperation(analysis_connection)
    analysis = get_by_name_or_id(analysis_connection.session, Analysis, analysis_identifier)
    if analysis.analysis_type == AnalysisTypeEnum.glycan_lc_ms:
        job = GlycanAnalysisHypothesisSerializer(
            analysis_connection._original_connection, analysis.id, name,
            output_connection=database_connection._original_connection)
        job.display_header()
        job.start()
    elif analysis.analysis_type == AnalysisTypeEnum.glycopeptide_lc_msms:
        job = GlycopeptideAnalysisGlycanCompositionExtractionHypothesisSerializer(
            analysis_connection._original_connection, analysis.id, name,
            output_connection=database_connection._original_connection)
        job.display_header()
        job.start()
    else:
        click.secho("Analysis Type %r could not be converted" % (
            analysis.analysis_type.name,), fg='red')
コード例 #3
0
def prebuilt_glycan(context, database_connection, recipe_name, name, reduction, derivatization):
    database_connection = DatabaseBoundOperation(database_connection)
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    if name is not None:
        name = validate_glycan_hypothesis_name(
            context, database_connection._original_connection, name)
    recipe = prebuilt_hypothesis_register[recipe_name]()
    recipe(database_connection._original_connection,
           hypothesis_name=name, reduction=reduction,
           derivatization=derivatization)
コード例 #4
0
def glycan_combinatorial(context, rule_file, database_connection, reduction, derivatization, name):
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    builder = CombinatorialGlycanHypothesisSerializer(
        rule_file, database_connection, reduction=reduction, derivatization=derivatization,
        hypothesis_name=name)
    builder.display_header()
    builder.start()
コード例 #5
0
def prebuilt_glycan(context, database_connection, recipe_name, name, reduction,
                    derivatization):
    database_connection = DatabaseBoundOperation(database_connection)
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    if name is not None:
        name = validate_glycan_hypothesis_name(
            context, database_connection._original_connection, name)
    recipe = prebuilt_hypothesis_register[recipe_name]()
    recipe(database_connection._original_connection,
           hypothesis_name=name,
           reduction=reduction,
           derivatization=derivatization)
コード例 #6
0
def merge_glycan_hypotheses(context, database_connection, hypothesis_specification, name):
    database_connection = DatabaseBoundOperation(database_connection)
    hypothesis_ids = []
    for connection, ident in hypothesis_specification:
        hypothesis = get_by_name_or_id(DatabaseBoundOperation(connection), GlycanHypothesis, ident)
        hypothesis_ids.append((connection, hypothesis.id))

    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')

    task = GlycanCompositionHypothesisMerger(
        database_connection._original_connection, hypothesis_ids, name)
    task.display_header()
    task.start()
コード例 #7
0
def glycan_text(context, text_file, database_connection, reduction,
                derivatization, name):
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection,
                                               name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    builder = TextFileGlycanHypothesisSerializer(text_file,
                                                 database_connection,
                                                 reduction=reduction,
                                                 derivatization=derivatization,
                                                 hypothesis_name=name)
    builder.display_header()
    builder.start()
コード例 #8
0
def merge_glycan_hypotheses(context, database_connection,
                            hypothesis_specification, name):
    database_connection = DatabaseBoundOperation(database_connection)
    hypothesis_ids = []
    for connection, ident in hypothesis_specification:
        hypothesis = get_by_name_or_id(DatabaseBoundOperation(connection),
                                       GlycanHypothesis, ident)
        hypothesis_ids.append((connection, hypothesis.id))

    if name is not None:
        name = validate_glycan_hypothesis_name(
            context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')

    task = GlycanCompositionHypothesisMerger(
        database_connection._original_connection, hypothesis_ids, name)
    task.display_header()
    task.start()
コード例 #9
0
def glyspace_glycan_hypothesis(context, database_connection, motif_class, reduction, derivatization, name,
                               target_taxon=None, include_children=False, detatch_substituent=None):
    database_connection = DatabaseBoundOperation(database_connection)
    if name is not None:
        name = validate_glycan_hypothesis_name(context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    filter_funcs = []

    if target_taxon is not None:
        filter_funcs.append(TaxonomyFilter(target_taxon, include_children))

    serializer_type = None
    if motif_class == "n-linked":
        serializer_type = NGlycanGlyspaceHypothesisSerializer
    elif motif_class == "o-linked":
        serializer_type = OGlycanGlyspaceHypothesisSerializer

    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    job = serializer_type(
        database_connection._original_connection, name, reduction, derivatization, filter_funcs,
        simplify=True, substituents_to_detatch=detatch_substituent)
    job.display_header()
    job.start()
コード例 #10
0
def glyspace_glycan_hypothesis(context,
                               database_connection,
                               motif_class,
                               reduction,
                               derivatization,
                               name,
                               target_taxon=None,
                               include_children=False,
                               detatch_substituent=None):
    database_connection = DatabaseBoundOperation(database_connection)
    if name is not None:
        name = validate_glycan_hypothesis_name(
            context, database_connection._original_connection, name)
        click.secho("Building Glycan Hypothesis %s" % name, fg='cyan')
    filter_funcs = []

    if target_taxon is not None:
        filter_funcs.append(TaxonomyFilter(target_taxon, include_children))

    serializer_type = None
    if motif_class == "n-linked":
        serializer_type = NGlycanGlyspaceHypothesisSerializer
    elif motif_class == "o-linked":
        serializer_type = OGlycanGlyspaceHypothesisSerializer

    reduction = validate_reduction(context, reduction)
    derivatization = validate_derivatization(context, derivatization)
    job = serializer_type(database_connection._original_connection,
                          name,
                          reduction,
                          derivatization,
                          filter_funcs,
                          simplify=True,
                          substituents_to_detatch=detatch_substituent)
    job.display_header()
    job.start()