Skip to content
Snippets Groups Projects
Commit 4157708f authored by tjc's avatar tjc
Browse files

added methods to chado-14-interface

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@5173 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 880aa309
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -42,7 +42,10 @@ import org.gmod.schema.sequence.FeatureCvTermProp;
import org.gmod.schema.sequence.FeatureCvTermPub;
import org.gmod.schema.sequence.FeatureDbXRef;
public abstract class GmodDAO implements SequenceDaoI, SchemaDaoI, OrganismDaoI, CvDaoI
import uk.ac.sanger.artemis.util.DatabaseDocument;
public abstract class GmodDAO
implements SequenceDaoI, SchemaDaoI, OrganismDaoI, CvDaoI, PubDaoI
{
public abstract void merge(Object obj);
......@@ -50,44 +53,6 @@ public abstract class GmodDAO implements SequenceDaoI, SchemaDaoI, OrganismDaoI,
public abstract void delete(Object obj);
/**
* Return a list of FeatureCvterm's for a Feature, or a list
* of all FeatureCvTerm's if Feature is null.
* @param feature the Feature to retrieve associated FeatureCvTerm's
* @return the FeatureCvTerm's
*/
public abstract List getFeatureCvTermsByFeature(Feature feature);
/**
* Get a list of all PubDbXRef's
* @return list of PubDbXRef's
*/
public abstract List getPubDbXRef();
/**
* Get a list of all FeatureCvTermDbXRef's for a Feature, or a list
* of all FeatureCvTermDbXRef's if Feature is null.
* @param feature the Feature to retrieve associated FeatureCvTermDbXRef's
* @return the FeatureCvTermDbXRef's
*/
public abstract List getFeatureCvTermDbXRefByFeature(Feature feature);
/**
* Get a list of all FeatureCvTermPub's for a Feature, or a list
* of all FeatureCvTermPub's if Feature is null.
* @param feature the Feature to retrieve associated FeatureCvTermPub's
* @return the FeatureCvTermPub's
*/
public abstract List getFeatureCvTermPubByFeature(Feature feature);
/**
* Return the list of all feature_synonyms as Feature.featureSynonyms
*
* @return a (possibly empty) List<Features> of matching synonyms
*/
public abstract List getAllFeatureSynonymsAsFeature();
/**
* Return a list of features that have this particular cvterm
* @param cvTermName the CvTerm name
......@@ -255,7 +220,34 @@ public abstract class GmodDAO implements SequenceDaoI, SchemaDaoI, OrganismDaoI,
//
//
// PubDaoI
//
public Pub getPubByDbXRef(DbXRef arg0)
{
// TODO Auto-generated method stub
return null;
}
public Pub getPubById(int arg0)
{
// TODO Auto-generated method stub
return null;
}
public Pub getPubByUniqueName(String arg0)
{
// TODO Auto-generated method stub
return null;
}
public List getPubPropByPubAndCvTerm(Pub arg0, CvTerm arg1)
{
// TODO Auto-generated method stub
return null;
}
//
//
......@@ -306,8 +298,11 @@ public abstract class GmodDAO implements SequenceDaoI, SchemaDaoI, OrganismDaoI,
if(pubResult == null)
{
// define the pub.type_id !!!!!!! TODO !!!!!!!!!
// define the pub.type_id
//
CvTerm cvTerm = DatabaseDocument.getCvTermByCvAndCvTerm("Journal", "genedb_literature");
pub.setCvTerm(cvTerm);
insertPub(pub);
pubResult = getPubByUniqueName(pub);
}
......@@ -315,6 +310,11 @@ public abstract class GmodDAO implements SequenceDaoI, SchemaDaoI, OrganismDaoI,
return pubResult;
}
/**
* Insert a feature_cvterm and associated feature_cvtermprop's,
* feature_cvterm_dbxref's and feature_cvterm_pub.
* @param feature_cvterm
*/
protected void insertAllFeatureCvTerm(final FeatureCvTerm feature_cvterm)
{
// get the pub_id and create a new Pub if necessary
......
......@@ -693,7 +693,7 @@ public class DatabaseDocument extends Document
parent = dao.getFeatureById(src_id); //.getLazyFeature(parent);
chado_gene.setSeqlen(parent.getSeqLen().intValue());
chado_gene.setSeqlen(parent.getSeqLen());
chado_gene.setSrcfeature_id(src_id);
ByteBuffer buff = new ByteBuffer();
......@@ -1236,6 +1236,20 @@ public class DatabaseDocument extends Document
return null;
}
public static CvTerm getCvTermByCvAndCvTerm(final String cvterm_name,
final String cvName)
{
Enumeration enum_cvterm = cvterms.elements();
while(enum_cvterm.hasMoreElements())
{
CvTerm cvterm = (CvTerm)enum_cvterm.nextElement();
if(cvName.equals( cvterm.getCv().getName() ) &&
cvterm_name.equals( cvterm.getName() ))
return cvterm;
}
return null;
}
/**
* Look up cvterms names and id and return in a hashtable.
* @param dao the data access object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment