This Wiki page is an edited version of Gos’s presentation
InterMine was developed as the generic underpinnings of the FlyMine Project
<items>
<item id="0_3" class=”” implements="http://www.flymine.org/model/genomic#Gene">
<attribute name="identifier" value="xfile" />
<attribute name="description" value="A test gene for GMOD meeting" />
<reference name="organism" ref_id="0_1" />
<collection name="transcripts">
<reference ref_id="0_9" />
</collection>
</item>
<item id="0_1" class="" implements="http://www.flymine.org/model/genomic#Organism">
<attribute name="taxonId" value="7227" />
</item>
...
public class BakeOff {
public static void main(String[] args) throws Exception {
// code to get the "xfile" gene
ObjectStore os = ObjectStoreFactory.getObjectStore("os.production");
Query q = new Query();
QueryClass qcObj = new QueryClass(Gene.class);
q.addFrom(qcObj);
QueryField qf = new QueryField(qcObj, "identifier");
q.addToSelect(qf);
SimpleConstraint sc = new SimpleConstraint(qf, ConstraintOp.EQUALS, new QueryValue("xfile"));
q.setConstraint(sc);
System.err.println("query: " + q);
Results res = os.execute(q);
// a Results object is a List of Lists
List rr = (List) res.get(0);
Gene gene = (Gene) rr.get(0);
System.err.println ("symbol: " + gene.getIdentifier());
// a BioEntity in FlyMine has a collection of Synonym objects -
// we need Synonym.value for each Synonym
System.err.print ("synonyms: ");
Iterator synIter = gene.getSynonyms().iterator();
while (synIter.hasNext()) {
Synonym syn = (Synonym) synIter.next();
System.err.print (syn.getValue() + ' ');
}
System.err.println ("description: " + gene.getDescription());
// get the class name, but we already know that the gene is a Gene
System.err.println ("type: " + gene.getClass().getName());
// make a List from a the Set of exons for this Gene
List exons = new ArrayList(gene.getExons());
Exon exon1 = (Exon) exons.get(0);
Exon exon2 = (Exon) exons.get(1);
// get the start and end via the Location object
System.err.println ("exon1 start: " + exon1.getChromosomeLocation().getStart());
System.err.println ("exon1 end: " + exon1.getChromosomeLocation().getEnd());
System.err.println ("exon2 start: " + exon2.getChromosomeLocation().getStart());
System.err.println ("exon2 end: " + exon2.getChromosomeLocation().getEnd());
// write out the first cds
List cdss = new ArrayList(gene.getCDSs());
FlyMineSequence flymineSequence = FlyMineSequenceFactory.make((CDS) cdss.get(0));
// use BioJava to output the sequence
Annotation annotation = flymineSequence.getAnnotation();
annotation.setProperty(FastaFormat.PROPERTY_DESCRIPTIONLINE,
gene.getIdentifier() + " cds");
SeqIOTools.writeFasta(System.err, flymineSequence);
}
}
Query q = new Query();
QueryClass qcObj = new QueryClass(Gene.class);
q.addFrom(qcObj);
q.addToSelect(qcObj);
QueryField qf = new QueryField(qcObj, "identifier");
SimpleConstraint sc = new SimpleConstraint(qf, ConstraintOp.MATCHES, new QueryValue("x-%"));
q.setConstraint(sc);
SELECT DISTINCT a1_.identifier AS a2_ FROM org.flymine.model.genomic.Gene AS a1_ WHERE a1_.identifier LIKE 'x-%'
my $genes = InterMine::Gene::Manager->get_genes(query => [
identifier => { like => 'x-%' },],);
Within FlyMine: For one or more genes report:
InterMine/FlyMine are funded by the Wellcome Trust (grant no. 067205), awarded to M. Ashburner, G. Micklem, S. Russell, K. Lilley and K. Mizuguchi.