source: trunk/bio/sources/flymine/long-oligo/main/src/org/intermine/bio/dataconversion/LongOligoGFF3RecordHandler.java @ 24567

Revision 24567, 2.1 KB checked in by julie, 17 months ago (diff)

update copyright notice

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1package org.intermine.bio.dataconversion;
2
3/*
4 * Copyright (C) 2002-2011 FlyMine
5 *
6 * This code may be freely distributed and modified under the
7 * terms of the GNU Lesser General Public Licence.  This should
8 * be distributed with the code.  See the LICENSE file for more
9 * information or http://www.gnu.org/copyleft/lesser.html.
10 *
11 */
12
13import java.util.Iterator;
14import java.util.List;
15
16import org.intermine.bio.io.gff3.GFF3Record;
17import org.intermine.metadata.Model;
18import org.intermine.xml.full.Item;
19
20/**
21 * A converter/retriever for the long oligo dataset.
22 *
23 * @author Kim Rutherford
24 */
25
26public class LongOligoGFF3RecordHandler extends GFF3RecordHandler
27{
28    /**
29     * Create a new LongOligoGFF3RecordHandler for the given target model.
30     * @param tgtModel the model for which items will be created
31     */
32    public LongOligoGFF3RecordHandler (Model tgtModel) {
33        super(tgtModel);
34    }
35
36    /**
37     * {@inheritDoc}
38     */
39    public void process(GFF3Record record) {
40        Item oligo = getFeature();
41
42        String olen = (String) ((List<?>) record.getAttributes().get("olen")).get(0);
43        oligo.setAttribute("length", olen);
44        String oaTm = (String) ((List<?>) record.getAttributes().get("oaTm")).get(0);
45        oligo.setAttribute("tm", oaTm);
46
47        Item transcript = getSequence();
48        if (transcript != null) {
49            oligo.setReference("transcript", transcript.getIdentifier());
50        }
51
52        String residues = (String) ((List<?>) record.getAttributes().get("sequence")).get(0);
53        if (residues != null) {
54            Item seqItem = converter.createItem("Sequence");
55            seqItem.setAttribute("residues", residues);
56            seqItem.setAttribute("length", "" + residues.length());
57            addItem(seqItem);
58            oligo.setReference("sequence", seqItem.getIdentifier());
59        }
60        List<?> aliases =  record.getAttributes().get("Alias");
61        Iterator<?> aliasIter = aliases.iterator();
62        while (aliasIter.hasNext()) {
63            addItem(converter.getSynonym(oligo, (String) aliasIter.next()));
64        }
65    }
66}
Note: See TracBrowser for help on using the repository browser.