source: trunk/bio/sources/flymine/drosdel-gff/main/src/org/intermine/bio/dataconversion/DrosDelGFF3RecordHandler.java @ 24567

Revision 24567, 2.3 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.Collection;
14import java.util.HashMap;
15import java.util.Map;
16
17import org.intermine.bio.io.gff3.GFF3Record;
18import org.intermine.metadata.Model;
19import org.intermine.xml.full.Item;
20
21/**
22 * A converter/retriever for the DrosDel dataset via GFF files.
23 *
24 * @author Kim Rutherford
25 */
26
27public class DrosDelGFF3RecordHandler extends GFF3RecordHandler
28{
29    private Map<String, Item> elementsMap = new HashMap<String, Item>();
30
31    /**
32     * Create a new DrosDelGFF3RecordHandler for the given target model.
33     * @param tgtModel the model for which items will be created
34     */
35    public DrosDelGFF3RecordHandler (Model tgtModel) {
36        super(tgtModel);
37    }
38
39    /**
40     * {@inheritDoc}
41     */
42    @Override
43    public void process(GFF3Record record) {
44        Item feature = getFeature();
45
46        String note = record.getNote();
47        if ("ChromosomalDeletion".equals(record.getType())) {
48            if ("made".equals(note)) {
49                feature.setAttribute("available", "true");
50            } else {
51                feature.setAttribute("available", "false");
52            }
53            String identifier = feature.getAttribute("primaryIdentifier").getValue();
54            // don't need a primaryIdentifier
55            feature.removeAttribute("primaryIdentifier");
56            feature.setAttribute("secondaryIdentifier", identifier);
57        } else {
58            throw new RuntimeException("unknown type: " + record.getType());
59        }
60    }
61
62    /**
63     * Return false - get locations from FlyBase.
64     * {@inheritDoc}
65     */
66    @Override
67    protected boolean createLocations(@SuppressWarnings("unused") GFF3Record record) {
68        return false;
69    }
70
71    /**
72     * Return items that need extra processing that can only be done after all other GFF features
73     * have been read.  For this class TransposableElementInsertionSite items
74     * @return the final Items
75     */
76    @Override
77    public Collection<Item> getFinalItems() {
78        return elementsMap.values();
79    }
80}
Note: See TracBrowser for help on using the repository browser.