示例#1
0
def map_extra_copies(target_fasta, reference_fasta, ref_chroms, target_chroms,
                     processes, lifted_feature_list, parent_dict,
                     children_dict, feature_db, intermediate_dict,
                     parent_order, seq_threshold, minimap2_path, inter_files,
                     remap, max_alns):
    liftoff_utils.clear_scores(lifted_feature_list, parent_dict)
    unmapped_features = []
    liftover_type = "copies"
    extract_features.get_gene_sequences(parent_dict, ref_chroms,
                                        reference_fasta, processes,
                                        inter_files, liftover_type)
    aligned_segments = align_features.align_features_to_target(
        ref_chroms, target_chroms, processes, target_fasta, parent_dict,
        children_dict, liftover_type, unmapped_features, reference_fasta,
        minimap2_path, inter_files, remap, max_alns)

    print("lifting features")
    lift_features.lift_all_features(aligned_segments, {}, 0.0, feature_db,
                                    parent_dict, children_dict,
                                    intermediate_dict, unmapped_features,
                                    lifted_feature_list, seq_threshold)
    fix_overlapping_features.fix_incorrectly_overlapping_features(
        lifted_feature_list, lifted_feature_list, parent_dict,
        aligned_segments, unmapped_features, 0.0, intermediate_dict,
        children_dict, feature_db, parent_order, seq_threshold)
示例#2
0
def map_unplaced_genes(unmapped_features, target_fasta, reference_fasta,
                       ref_chroms, target_chroms, processes,
                       lifted_feature_list, feature_db, parent_dict,
                       intermediate_dict, children_dict, parent_order,
                       minimap2_path, inter_files, max_alns):
    liftoff_utils.clear_scores(lifted_feature_list, parent_dict)
    liftover_type = "unplaced"
    unplaced_dict = {}
    for feature_name in parent_dict:
        feature = parent_dict[feature_name]
        if feature.seqid in ref_chroms:
            unplaced_dict[feature.id] = feature
    extract_features.get_gene_sequences(unplaced_dict, ref_chroms,
                                        reference_fasta, processes,
                                        inter_files, liftover_type)
    aligned_segments = align_features.align_features_to_target(
        ref_chroms, target_chroms, processes, target_fasta, unplaced_dict,
        children_dict, liftover_type, unmapped_features, reference_fasta,
        minimap2_path, inter_files, True, max_alns)
    print("lifting features")
    lift_features.lift_all_features(aligned_segments, {}, 0.0, feature_db,
                                    unplaced_dict, children_dict,
                                    intermediate_dict, unmapped_features,
                                    lifted_feature_list, 0.0)

    fix_overlapping_features.fix_incorrectly_overlapping_features(
        lifted_feature_list, lifted_feature_list, parent_dict,
        aligned_segments, unmapped_features, 0.0, intermediate_dict,
        children_dict, feature_db, parent_order, 0.0)
示例#3
0
def map_extra_copies(ref_chroms, target_chroms, lifted_features_list, feature_hierarchy, feature_db, ref_parent_order,
                     args):
    liftoff_utils.clear_scores(lifted_features_list, feature_hierarchy.parents)
    unmapped_features = []
    liftover_type = "copies"
    extract_features.get_gene_sequences(feature_hierarchy.parents, ref_chroms, args, liftover_type)
    min_cov, min_seqid = 0, args.sc
    align_and_lift_features(ref_chroms, target_chroms, args, feature_hierarchy, liftover_type, unmapped_features,
                            feature_db, lifted_features_list, ref_parent_order, min_cov, min_seqid, args.overlap)
示例#4
0
def map_unplaced_genes(unmapped_features, ref_chroms, target_chroms,
                       lifted_features_list, feature_db, feature_hierarchy, ref_parent_order, args):
    liftoff_utils.clear_scores(lifted_features_list, feature_hierarchy.parents)
    liftover_type = "unplaced"
    unplaced_dict = get_features_from_unplaced_seq(ref_chroms, feature_hierarchy)
    extract_features.get_gene_sequences(unplaced_dict, ref_chroms, args, liftover_type)
    if args.exclude_partial:
        min_cov, min_seqid = args.a, args.s
    else:
        min_cov, min_seqid = 0.0, 0.0
    align_and_lift_features(ref_chroms, target_chroms, args, feature_hierarchy, liftover_type, unmapped_features,
                            feature_db, unplaced_dict, lifted_features_list, ref_parent_order, min_cov, min_seqid)
示例#5
0
def map_unmapped_genes_agaisnt_all(unmapped_features, ref_chroms, target_chroms, lifted_features_list, feature_db,
                                   feature_hierarchy, ref_parent_order, args):
    liftoff_utils.clear_scores(lifted_features_list, feature_hierarchy.parents)
    unmapped_dict = get_unmapped_genes(unmapped_features)
    if args.exclude_partial:
        min_cov, min_seqid = args.a, args.s
    else:
        min_cov, min_seqid = 0.05, 0.05
    liftover_type = "unmapped"
    extract_features.get_gene_sequences(unmapped_dict, ref_chroms, args, liftover_type)
    unmapped_features = []
    align_and_lift_features(ref_chroms, target_chroms, args, feature_hierarchy, liftover_type, unmapped_features,
                            feature_db, lifted_features_list, ref_parent_order, min_cov, min_seqid, args.overlap,)
    return unmapped_features