コード例 #1
0
ファイル: BaseAdaptor.c プロジェクト: Ensembl/ensc-core
SeqFeature *BaseAdaptor_uncachedFetchByDbID(BaseAdaptor *ba, IDType id) {
  SeqFeature *feat = NULL;
  char constraint[1024];

  //construct a constraint like 't1.table1_id = 123'
  NameTableType *tables = ba->getTables();
  char **t = (*tables)[0];
  sprintf(constraint, "%s.%s_id = "IDFMTSTR, t[SYN], t[NAME], id); 

  //Should only be one
  Vector *vec = BaseAdaptor_genericFetch(ba, constraint, NULL, NULL);

  if (Vector_getNumElement(vec) > 1) {
    fprintf(stderr, "Error: Got more than one feature back in fetch ID call\n");
  } else {
    if (Vector_getNumElement(vec) == 1) {
      feat = Vector_getElementAt(vec, 0);
      Object_incRefCount(feat);
    }
  }
  
// NIY May want to set a free func???
  Vector_free(vec);

  return feat;
}
コード例 #2
0
PredictionExon *PredictionExon_new() {
  PredictionExon *pe;

  if ((pe = (PredictionExon *)calloc(1,sizeof(PredictionExon))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for pe\n");
    return NULL;
  }

  pe->objectType = CLASS_PREDICTIONEXON;
  Object_incRefCount(pe);

  pe->funcs = &predictionExonFuncs;
 
  return pe;
}
コード例 #3
0
GenomeDB *GenomeDB_new() {
  GenomeDB *gdb;

  if ((gdb = (GenomeDB *)calloc(1,sizeof(GenomeDB))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for gdb\n");
    return NULL;
  }

  gdb->objectType = CLASS_GENOMEDB;

  gdb->funcs = &genomeDBFuncs;

  Object_incRefCount(gdb);
  return gdb;
}
コード例 #4
0
SyntenyRegion *SyntenyRegion_new() {
  SyntenyRegion *sr;

  if ((sr = (SyntenyRegion *)calloc(1,sizeof(SyntenyRegion))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for sr\n");
    return NULL;
  }

  sr->objectType = CLASS_SYNTENYREGION;

  sr->funcs = &syntenyRegionFuncs;

  Object_incRefCount(sr);
  return sr;
}
コード例 #5
0
SimpleFeature *SimpleFeature_new() {
  SimpleFeature *sf;

  if ((sf = (SimpleFeature *)calloc(1,sizeof(SimpleFeature))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for sf\n");
    return NULL;
  }

  sf->objectType = CLASS_SIMPLEFEATURE;
  Object_incRefCount(sf);

  sf->funcs = &simpleFeatureFuncs;
 
  return sf;
}
コード例 #6
0
Clone *Clone_new() {
  Clone *cl;

  if ((cl = (Clone *)calloc(1,sizeof(Clone))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for cl\n");
    return NULL;
  }

  cl->objectType = CLASS_CLONE;

  cl->funcs = &cloneFuncs;

  Object_incRefCount(cl);

  return cl;
}
コード例 #7
0
PredictionTranscript *PredictionTranscript_new() {
    PredictionTranscript *transcript;

    if ((transcript = (PredictionTranscript *)calloc(1,sizeof(PredictionTranscript))) == NULL) {
        fprintf(stderr,"ERROR: Failed allocating space for transcripe\n");
        return NULL;
    }

    transcript->objectType = CLASS_PREDICTIONTRANSCRIPT;
    Object_incRefCount(transcript);

    transcript->funcs = &predictionTranscriptFuncs;

    transcript->exons = Vector_new();
    return transcript;
}
コード例 #8
0
ファイル: Analysis.c プロジェクト: Ensembl/ensc-core
Analysis *Analysis_new() {
  Analysis *anal;

  if ((anal = (Analysis *)calloc(1,sizeof(Analysis))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for anal\n");
    return NULL;
  }

  anal->objectType = CLASS_ANALYSIS;

  anal->funcs = &analysisFuncs;

  Object_incRefCount(anal);

  return anal;
}
コード例 #9
0
ファイル: RawContig.c プロジェクト: Ensembl/ensc-core
RawContig *RawContig_new() {
  RawContig *rc;

  if ((rc = (RawContig *)calloc(1,sizeof(RawContig))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for rc\n");
    return NULL;
  }

  rc->length = rc->emblOffset = rc->cloneId = -1;

  rc->objectType = CLASS_RAWCONTIG;
  Object_incRefCount(rc);

  rc->funcs = &rawContigFuncs;

  return rc;
}
コード例 #10
0
Translation *Translation_new() {
  Translation *t;

  if ((t = (Translation *)calloc(1,sizeof(Translation))) == NULL) {
    fprintf(stderr,"ERROR: Failed allocating space for t\n");
    return NULL;
  }

  Translation_setVersion(t,-1);

  t->objectType = CLASS_TRANSLATION;

  t->funcs = &translationFuncs;

  Object_incRefCount(t);

  return t;
}
コード例 #11
0
ファイル: AssemblyMapper.c プロジェクト: Ensembl/ensc-core
AssemblyMapper *AssemblyMapper_new(AssemblyMapperAdaptor *adaptor, Vector *coordSystems) {
  AssemblyMapper *am;

  if ((am = (AssemblyMapper *)calloc(1, sizeof(AssemblyMapper))) == NULL) {
    fprintf(stderr, "ERROR: Failed allocating space for AssemblyMapper\n");
    return NULL;
  }

  am->objectType = CLASS_ASSEMBLYMAPPER;

  am->funcs = &assemblyMapperFuncs;

  Object_incRefCount(am);

  AssemblyMapper_setAdaptor(am, adaptor);

  AssemblyMapperAdaptor_cacheSeqIdsWithMultAssemblies(adaptor);

  if ( Vector_getNumElement(coordSystems) != 2 ) {
    fprintf(stderr, "Can only map between two coordinate systems %d were provided\n", Vector_getNumElement(coordSystems));
    exit(1);
  }

  // Set the component and assembled coordinate systems
  AssemblyMapper_setAssembledCoordSystem(am, Vector_getElementAt(coordSystems, 0));
  AssemblyMapper_setComponentCoordSystem(am, Vector_getElementAt(coordSystems, 1));

  AssemblyMapper_setAssembledRegister(am, IDHash_new(IDHASH_MEDIUM));
  AssemblyMapper_setComponentRegister(am, IDHash_new(IDHASH_MEDIUM));

  // We load the mapper calling the 'ASSEMBLED' the 'from' coord system
  // and the 'COMPONENT' the 'to' coord system.
  AssemblyMapper_setMapper(am, Mapper_new("assembled", "component", AssemblyMapper_getAssembledCoordSystem(am), 
                                                                    AssemblyMapper_getComponentCoordSystem(am)));

  AssemblyMapper_setMaxPairCount(am, AM_DEFAULT_MAX_PAIR_COUNT);

  return am;
}