Ejemplo n.º 1
0
def lift_single_feature(
    threshold,
    feature_order,
    features_to_lift,
    feature_hierarchy,
    previous_feature_start,
    previous_feature_ref_start,
    previous_gene_seq,
    unmapped_features,
    aligned_feature,
    seq_id_threshold,
    feature_locations,
    lifted_features_list,
    distance_factor,
):
    new_parent_name = aligned_feature[0].query_name
    original_parent_name = liftoff_utils.convert_id_to_original(
        new_parent_name)
    parent = features_to_lift[original_parent_name]
    if len(aligned_feature) > 0:
        lifted_children, alignment_coverage, seq_id = find_best_mapping.find_best_mapping(
            aligned_feature, parent.end - parent.start + 1, parent,
            feature_hierarchy, previous_feature_start,
            previous_feature_ref_start, previous_gene_seq, feature_locations,
            lifted_features_list, distance_factor)

        lifted_features = merge_lifted_features.merge_lifted_features(
            lifted_children, parent, unmapped_features, threshold,
            new_parent_name, feature_order, feature_hierarchy,
            alignment_coverage, seq_id, seq_id_threshold)
    else:
        unmapped_features.append(parent)
    return lifted_features, aligned_feature[0].query_name
Ejemplo n.º 2
0
def lift_features_subset(all_overlapping_features, threshold, feature_order,
                         parent_dict, children_dict, intermediate_dict,
                         previous_gene_start, unmapped_features,
                         aligned_feature, seq_id_threshold):
    new_parent_name = aligned_feature[0].query_name
    original_parent_name = liftoff_utils.convert_id_to_original(
        new_parent_name)
    copy_tag = liftoff_utils.get_copy_tag(new_parent_name)
    if new_parent_name in all_overlapping_features:
        overlapping_features = all_overlapping_features[new_parent_name]
    else:
        overlapping_features = []
    parent = parent_dict[original_parent_name]
    if len(aligned_feature) > 0:
        lifted_children, shortest_path_weight, alignment_coverage, seq_id = find_best_mapping.find_best_mapping(
            aligned_feature, parent.end - parent.start + 1, parent,
            overlapping_features, children_dict, previous_gene_start, copy_tag)
        lifted_feature_list, feature_start = merge_lifted_features.merge_lifted_features(
            lifted_children, parent, unmapped_features, threshold,
            new_parent_name, feature_order, parent_dict, intermediate_dict,
            alignment_coverage, seq_id, seq_id_threshold)
    else:
        unmapped_features.append(parent)
        feature_start = 0

    return lifted_feature_list, aligned_feature[0].query_name, feature_start
Ejemplo n.º 3
0
def lift_single_feature(all_overlapping_features, threshold, feature_order,
                        features_to_lift, feature_hierarchy,
                        previous_gene_start, unmapped_features,
                        aligned_feature, seq_id_threshold):
    new_parent_name = aligned_feature[0].query_name
    original_parent_name = liftoff_utils.convert_id_to_original(
        new_parent_name)
    overlapping_features = get_overlapping_features_list(
        new_parent_name, all_overlapping_features)
    parent = features_to_lift[original_parent_name]
    if len(aligned_feature) > 0:
        lifted_children, alignment_coverage, seq_id = find_best_mapping.find_best_mapping(
            aligned_feature, parent.end - parent.start + 1, parent,
            overlapping_features, feature_hierarchy.children,
            previous_gene_start)
        lifted_feature_list, feature_start = merge_lifted_features.merge_lifted_features(
            lifted_children, parent, unmapped_features, threshold,
            new_parent_name, feature_order, feature_hierarchy,
            alignment_coverage, seq_id, seq_id_threshold)
    else:
        unmapped_features.append(parent)
        feature_start = 0
    return lifted_feature_list, aligned_feature[0].query_name, feature_start