예제 #1
0
void ensKaryotypebandDel(EnsPKaryotypeband *Pkb)
{
    EnsPKaryotypeband pthis = NULL;
    
    if(!Pkb)
        return;
    
    if(!*Pkb)
        return;

    pthis = *Pkb;
    
    pthis->Use--;
    
    if(pthis->Use)
    {
	*Pkb = NULL;
	
	return;
    }
    
    ensFeatureDel(&pthis->Feature);
    
    ajStrDel(&pthis->Name);
    
    ajStrDel(&pthis->Stain);
    
    AJFREE(pthis);

    *Pkb = NULL;
    
    return;
}
예제 #2
0
AjBool ensKaryotypebandSetFeature(EnsPKaryotypeband kb, EnsPFeature feature)
{
    if(!kb)
        return ajFalse;
    
    ensFeatureDel(&kb->Feature);
    
    kb->Feature = ensFeatureNewRef(feature);
    
    return ajTrue;
}
예제 #3
0
void ensIntronDel(EnsPIntron *Pintron)
{
    EnsPIntron pthis = NULL;
    
    if(!Pintron)
        return;
    
    if(!*Pintron)
        return;

    pthis = *Pintron;
    
    /*
     ajDebug("ensIntronDel\n"
	     "  *Pintron %p\n",
	     *Pintron);
     
     ensIntronTrace(*Pintron, 1);
     */
    
    pthis->Use--;
    
    if(pthis->Use)
    {
	*Pintron = NULL;
	
	return;
    }
    
    ensFeatureDel(&pthis->Feature);
    
    ensExonDel(&pthis->PreviousExon);
    
    ensExonDel(&pthis->NextExon);
    
    AJFREE(pthis);

    *Pintron = NULL;
    
    return;
}
예제 #4
0
static AjBool karyotypeBandadaptorFetchAllBySQL(EnsPDatabaseadaptor dba,
                                                const AjPStr statement,
                                                EnsPAssemblymapper am,
                                                EnsPSlice slice,
                                                AjPList kblist)
{
    ajuint identifier = 0;
    
    ajuint srid    = 0;
    ajuint srstart = 0;
    ajuint srend   = 0;
    
    AjPStr name  = NULL;
    AjPStr stain = NULL;
    
    AjPSqlstatement sqls = NULL;
    AjISqlrow sqli       = NULL;
    AjPSqlrow sqlr       = NULL;
    
    EnsPCoordsystemadaptor csa = NULL;
    
    EnsPFeature feature = NULL;
    
    EnsPKaryotypeband kb         = NULL;
    EnsPKaryotypebandadaptor kba = NULL;
    
    EnsPSlice srslice   = NULL;
    EnsPSliceadaptor sa = NULL;
    
    if(!dba)
	return ajFalse;
    
    if(!statement)
	return ajFalse;
    
    (void) am;
    
    (void) slice;
    
    if(!kblist)
	return ajFalse;
    
    csa = ensRegistryGetCoordsystemadaptor(dba);

    /*
    ** AJB: The variable kba, set below, is not used elsewhere
    ** in the function. Needs fixing appropriately.
    */
    
    kba = ensRegistryGetKaryotypebandadaptor(dba);
    
    sa = ensRegistryGetSliceadaptor(dba);
    
    sqls = ensDatabaseadaptorSqlstatementNew(dba, statement);
    
    sqli = ajSqlrowiterNew(sqls);
    
    while(!ajSqlrowiterDone(sqli))
    {
	identifier = 0;
	srid       = 0;
	srstart    = 0;
	srend      = 0;
	name       = ajStrNew();
	stain      = ajStrNew();
	
	sqlr = ajSqlrowiterGet(sqli);
	
	ajSqlcolumnToUint(sqlr, &identifier);
	ajSqlcolumnToUint(sqlr, &srid);
	ajSqlcolumnToUint(sqlr, &srstart);
	ajSqlcolumnToUint(sqlr, &srend);
        ajSqlcolumnToStr(sqlr, &name);
        ajSqlcolumnToStr(sqlr, &stain);
	
	/* Need to get the internal Ensembl Sequence Region identifier. */
	
	srid = ensCoordsystemadaptorGetInternalSeqregionIdentifier(csa, srid);
	
	/*
	** FIXME: karyotype.seq_region_start and karyotype.seq_region_end are
	** defined as signed in the tables.sql file.
	** All other features use unsigned start and end coordinates.
	*/
	
	ensSliceadaptorFetchBySeqregionIdentifier(sa, srid, 0, 0, 0, &srslice);
	
	feature = ensFeatureNewS((EnsPAnalysis) NULL,
				 srslice,
				 srstart,
				 srend,
				 1);
	
	kb = ensKaryotypebandNew(identifier, feature, name, stain);
	
	ajListPushAppend(kblist, (void *) kb);
	
	ensFeatureDel(&feature);
	
	ensSliceDel(&srslice);
	
	ajStrDel(&name);
	ajStrDel(&stain);
    }
    
    ajSqlrowiterDel(&sqli);
    
    ajSqlstatementDel(&sqls);
    
    return ajTrue;
}