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

add getChadoGeneByAnyCurrentName()

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@11694 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent c9e97a52
No related branches found
No related tags found
No related merge requests found
......@@ -999,7 +999,7 @@ public class DatabaseDocument extends Document
final List schema_search,
GmodDAO dao,
final boolean readChildren)
throws SQLException, ReadFormatException, ConnectException
throws SQLException, ReadFormatException, ConnectException, IOException
{
CvTermThread cvThread = null;
if(DatabaseDocument.cvterms == null)
......@@ -1028,8 +1028,11 @@ public class DatabaseDocument extends Document
else
reset((String)getLocation(), (String)schema_search.get(0));
dao = getDAO();
Feature chadoFeature =
(Feature)(dao.getFeaturesByUniqueName(search_gene).get(0));
List features = dao.getFeaturesByUniqueName(search_gene);
if(features == null || features.size() == 0)
throw new IOException();
Feature chadoFeature = (Feature)(features.get(0));
ChadoCanonicalGene chado_gene = new ChadoCanonicalGene();
id_store.put(Integer.toString(chadoFeature.getFeatureId()),
......@@ -2099,6 +2102,31 @@ public class DatabaseDocument extends Document
return feature;
}
/**
* Find the gene by the ID or synonym on the gene or transcript.
* @param id
* @return
*/
public Feature getChadoGeneByAnyCurrentName(String id)
{
Feature chadoFeature =
(Feature)(getDAOOnly().getFeaturesByAnyCurrentName(id).get(0));
if(!chadoFeature.getCvTerm().equals("gene"))
{
Iterator<FeatureRelationship> parents =
chadoFeature.getFeatureRelationshipsForSubjectId().iterator();
while(parents.hasNext())
{
FeatureRelationship fr = parents.next();
Feature parent = fr.getFeatureByObjectId();
if(parent.getCvTerm().getName().equals("gene"))
chadoFeature = parent;
}
}
return chadoFeature;
}
/**
* Get the sequence for a feature.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment