/*****************************************************************************/ /* */ /* UNIT: NTL3_Abs_To_Human (Level 3 library routine) */ /* */ /* Author: Nikola Stojanovic */ /* */ /* Revision: 07 SEP 94 Version 1.0 */ /* */ /* Function: */ /* */ /* Procedure determines the corresponding positions in the human sequence */ /* for the given list of "absolute" intervals, with respect to the received */ /* alignment file (name provided as an input parameter); returns the */ /* "standard" error structure, NULL if there were no errors */ /* */ /*****************************************************************************/ #include #include #include #include "ntl3.h" /*****************************************************************************/ /* */ /* Definitions section */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* Definitions of global (static) variables of the unit */ /*****************************************************************************/ static int alignment_loaded = 0; /* No alignment initially loaded */ static header_ptr file_data = NULL; /* Contents of the alignment file */ static align_ptr alignment = NULL; /* Partially unpacked alignment */ /*****************************************************************************/ /* */ /* Code section */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* */ /* PROCEDURE: NTL3_Abs_To_Human */ /* */ /* Central procedure for the unit; returns NULL if the alternative offset */ /* has been found and returned, diagnostic string otherwise */ /* */ /* Procedure abs_to_human determines offsets of pairs of positions specified */ /* as absolute within the alignment, with respect to "humhbb_orig"; */ /* positions are calculated as close as possible, and error made (if any) */ /* is returned together with offsets */ /* */ /* ASSUMPTION: Only one sequence in the alignment is "human" */ errind NTL3_Abs_To_Human (char *alignment_file, twoint_ptr absolutes, fourint_ptr *offsets) { errind load_status; /* Check whether this is the first invocation of this routine: */ /* Check whether the current alignment has already been loaded internally */ if (alignment_loaded == 0) { /* No alignment loaded yet */ /* Load the contents of the specified alignment file in appropriate format */ /* into internal structure first */ if ((load_status = NTL2_Load_AlignFile (alignment_file, &file_data)) != NULL) return load_status; else { /* Data from the file loaded, now partially expand alignment 1 */ if ((load_status = NTL1_Load_Alignment (1, file_data, &alignment)) != NULL) return load_status; else alignment_loaded = 1; /* Record that alignment data is now loaded */ } } /* Now when it is guaranteed that both origins and alignments are loaded, */ /* proceed to determine the desired corresponding positions in "human" */ return NTL1_Abs_To_Human (absolutes, file_data, alignment, offsets); }