Skip to content

Commit

Permalink
Merge pull request #3 from Ensembl/feature/merge_refine_genes
Browse files Browse the repository at this point in the history
Feature/merge refine genes

Tested with zmap 2.11.6-252-g3d0e574
  • Loading branch information
Gemma Guest committed Nov 11, 2016
2 parents 1bc66cb + e9e0bc1 commit 8a0feab
Show file tree
Hide file tree
Showing 8 changed files with 872 additions and 477 deletions.
40 changes: 16 additions & 24 deletions src/DataAdaptors/GeneAdaptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ char *Gene_cols[] = {
"g.source",
"g.is_current",
"g.canonical_transcript_id",
//"g.canonical_annotation",
"g.stable_id",
"g.version",
"UNIX_TIMESTAMP(g.created_date)",
Expand Down Expand Up @@ -1435,8 +1434,6 @@ IDType GeneAdaptor_store(GeneAdaptor *ga, Gene *gene, int ignoreRelease) {
//"status = '%s',"
"is_current = %d,"
"canonical_transcript_id = 0",
//"canonical_annotation = '%s'",
//"canonical_annotation = %%s",
analysisId,
seqRegionId,
Gene_getSeqRegionStart((SeqFeature*)gene),
Expand All @@ -1447,7 +1444,6 @@ IDType GeneAdaptor_store(GeneAdaptor *ga, Gene *gene, int ignoreRelease) {
//Gene_getSource(gene),
//Gene_getStatus(gene),
isCurrent);
//Gene_getCanonicalAnnotation(gene));

char descQStr[1024];
Gene_getDescription(gene) ? sprintf(descQStr,"'%s'", Gene_getDescription(gene)) : sprintf(descQStr, "NULL");
Expand Down Expand Up @@ -1781,8 +1777,7 @@ sub update {
status = ?,
description = ?,
is_current = ?,
canonical_transcript_id = ?,
canonical_annotation = ?
canonical_transcript_id = ?
WHERE gene_id = ?
);
Expand Down Expand Up @@ -1810,8 +1805,7 @@ sub update {
$sth->bind_param(7, 0, SQL_INTEGER);
}
$sth->bind_param(8, $gene->canonical_annotation(), SQL_VARCHAR);
$sth->bind_param(9, $gene->dbID(), SQL_INTEGER);
$sth->bind_param(8, $gene->dbID(), SQL_INTEGER);
$sth->execute();
Expand Down Expand Up @@ -1905,23 +1899,22 @@ Vector *GeneAdaptor_objectsFromStatementHandle(GeneAdaptor *ga,
char *source = row->getStringAt(row,10);
int isCurrent = row->getIntAt(row,11);
IDType canonicalTranscriptId = row->getLongLongAt(row,12);
char *canonicalAnnotation = row->getStringAt(row,13);
char *stableId = row->getStringAt(row,14);
int version = row->getIntAt(row,15);
int createdDate = row->getIntAt(row,16);
int modifiedDate = row->getIntAt(row,17);
char *stableId = row->getStringAt(row,13);
int version = row->getIntAt(row,14);
int createdDate = row->getIntAt(row,15);
int modifiedDate = row->getIntAt(row,16);
// Changed from perl xrefDisplayId to xrefDisplayLabel to match Transcript version
char *xrefDisplayLabel = row->getStringAt(row,18);
char *xrefPrimaryAcc = row->getStringAt(row,19);
char *xrefDesc = row->getStringAt(row,20);
char *xrefVersion = row->getStringAt(row,21);
char *externalDb = row->getStringAt(row,22);
char *externalStatus = row->getStringAt(row,23);
char *externalRelease = row->getStringAt(row,24);
char *externalDbName = row->getStringAt(row,25);
char *xrefDisplayLabel = row->getStringAt(row,17);
char *xrefPrimaryAcc = row->getStringAt(row,18);
char *xrefDesc = row->getStringAt(row,19);
char *xrefVersion = row->getStringAt(row,20);
char *externalDb = row->getStringAt(row,21);
char *externalStatus = row->getStringAt(row,22);
char *externalRelease = row->getStringAt(row,23);
char *externalDbName = row->getStringAt(row,24);
// Added xref prefix to info* var names to match Transcript version
char *xrefInfoType = row->getStringAt(row,26);
char *xrefInfoText = row->getStringAt(row,27);
char *xrefInfoType = row->getStringAt(row,25);
char *xrefInfoText = row->getStringAt(row,26);

// get the analysis object
Analysis *analysis = AnalysisAdaptor_fetchByDbID(aa, analysisId);
Expand Down Expand Up @@ -2122,7 +2115,6 @@ Vector *GeneAdaptor_objectsFromStatementHandle(GeneAdaptor *ga,
Gene_setSource (gene, source);
Gene_setIsCurrent (gene, isCurrent);
Gene_setCanonicalTranscriptId(gene, canonicalTranscriptId);
Gene_setCanonicalAnnotation(gene, canonicalAnnotation);

Vector_addElement(genes, gene);
}
Expand Down
7 changes: 5 additions & 2 deletions src/DataAdaptors/MysqlStatementHandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ IDType MysqlStatementHandle_getInsertId(StatementHandle *sth) {
insertId = mysql_insert_id(m_sth->dbc->mysql);

if (insertId == 0) {
fprintf(stderr, "Warning: Insert id was 0\n");
//ProcUtil_showBacktrace(EnsC_progName);
//If we do a INSERT IGNORE and insertId equals 0, it just means that the row already exists
if (strncmp(sth->statementFormat, "INSERT IGNORE", sizeof(char)*13)) {
fprintf(stderr, "Warning: Insert id was 0\n%s\n", sth->statementFormat);
//ProcUtil_showBacktrace(EnsC_progName);
}
}

return insertId;
Expand Down
6 changes: 3 additions & 3 deletions src/DataModel/DNAAlignFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ int DNAAlignFeature_getQueryUnit(void);
#define DNAAlignFeature_transformToRawContig(fp) BaseAlignFeature_transformToRawContig((fp))
#define DNAAlignFeature_transformToSlice(fp,slice) BaseAlignFeature_transformToSlice((fp),(slice))

#define DNAAlignFeature_getSeqRegionStart(daf) SeqFeature_getSeqRegionStart((daf))
#define DNAAlignFeature_getSeqRegionEnd(daf) SeqFeature_getSeqRegionEnd((daf))
#define DNAAlignFeature_getSeqRegionStrand(daf) SeqFeature_getSeqRegionStrand((daf))
#define DNAAlignFeature_getSeqRegionStart(daf) SeqFeature_getSeqRegionStart((SeqFeature *)(daf))
#define DNAAlignFeature_getSeqRegionEnd(daf) SeqFeature_getSeqRegionEnd((SeqFeature *)(daf))
#define DNAAlignFeature_getSeqRegionStrand(daf) SeqFeature_getSeqRegionStrand((SeqFeature *)(daf))

#define DNAAlignFeature_free(fp) BaseAlignFeature_free((fp))
// Why go down the inheritance tree here??
Expand Down
6 changes: 3 additions & 3 deletions src/DataModel/Exon.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ struct ExonStruct {
#define Exon_getFlags(exon) SeqFeature_getFlags(exon)
#define Exon_removeFlag(exon, f) SeqFeature_removeFlag((exon), (f))

#define Exon_getSeqRegionStart(exon) SeqFeature_getSeqRegionStart((exon))
#define Exon_getSeqRegionEnd(exon) SeqFeature_getSeqRegionEnd((exon))
#define Exon_getSeqRegionStrand(exon) SeqFeature_getSeqRegionStrand((exon))
#define Exon_getSeqRegionStart(exon) SeqFeature_getSeqRegionStart((SeqFeature *)(exon))
#define Exon_getSeqRegionEnd(exon) SeqFeature_getSeqRegionEnd((SeqFeature *)(exon))
#define Exon_getSeqRegionStrand(exon) SeqFeature_getSeqRegionStrand((SeqFeature *)(exon))

#define Exon_setIsCurrent(exon,isC) StableIdInfo_setIsCurrent(&((exon)->si),(isC))
#define Exon_getIsCurrent(exon) StableIdInfo_getIsCurrent(&((exon)->si))
Expand Down
10 changes: 2 additions & 8 deletions src/DataModel/Gene.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,8 @@ char *Gene_setDescription(Gene *g, char *description) {
}

char *Gene_setCanonicalAnnotation(Gene *g, char *canonicalAnnotation) {
if ((g->canonicalAnnotation = (char *)malloc(strlen(canonicalAnnotation)+1)) == NULL) {
fprintf(stderr,"ERROR: Failed allocating space for canonicalAnnotation\n");
return NULL;
}

strcpy(g->canonicalAnnotation,canonicalAnnotation);

return g->canonicalAnnotation;
fprintf(stderr, "DEPRECATED: This column has been removed in 74.\n It does not set anything and it just returns NULL\n");
return NULL;
}


Expand Down
6 changes: 3 additions & 3 deletions src/DataModel/IntronSupportingEvidence.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ char *IntronSupportingEvidence_setHitName(IntronSupportingEvidence *ise, char *s

void IntronSupportingEvidence_freeImpl(IntronSupportingEvidence *ise);

#define IntronSupportingEvidence_getSeqRegionStart(ise) SeqFeature_getSeqRegionStart((ise))
#define IntronSupportingEvidence_getSeqRegionEnd(ise) SeqFeature_getSeqRegionEnd((ise))
#define IntronSupportingEvidence_getSeqRegionStrand(ise) SeqFeature_getSeqRegionStrand((ise))
#define IntronSupportingEvidence_getSeqRegionStart(ise) SeqFeature_getSeqRegionStart((SeqFeature *)(ise))
#define IntronSupportingEvidence_getSeqRegionEnd(ise) SeqFeature_getSeqRegionEnd((SeqFeature *)(ise))
#define IntronSupportingEvidence_getSeqRegionStrand(ise) SeqFeature_getSeqRegionStrand((SeqFeature *)(ise))

IntronSupportingEvidence *IntronSupportingEvidence_shallowCopyImpl(IntronSupportingEvidence *ise);
#define IntronSupportingEvidence_shallowCopy(ise) SeqFeature_shallowCopy((ise))
Expand Down
Loading

0 comments on commit 8a0feab

Please sign in to comment.