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

ID fixed and id_range_store fix

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4602 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 12b02edc
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFDocumentEntry.java,v 1.30 2006-07-28 08:34:30 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFDocumentEntry.java,v 1.31 2006-08-01 15:34:22 tjc Exp $
*/ */
package uk.ac.sanger.artemis.io; package uk.ac.sanger.artemis.io;
...@@ -38,7 +38,7 @@ import java.sql.Timestamp; ...@@ -38,7 +38,7 @@ import java.sql.Timestamp;
* A DocumentEntry that can read an GFF entry from a Document. * A DocumentEntry that can read an GFF entry from a Document.
* *
* @author Kim Rutherford * @author Kim Rutherford
* @version $Id: GFFDocumentEntry.java,v 1.30 2006-07-28 08:34:30 tjc Exp $ * @version $Id: GFFDocumentEntry.java,v 1.31 2006-08-01 15:34:22 tjc Exp $
**/ **/
public class GFFDocumentEntry extends SimpleDocumentEntry public class GFFDocumentEntry extends SimpleDocumentEntry
...@@ -354,30 +354,24 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -354,30 +354,24 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
RangeVector new_range_vector; RangeVector new_range_vector;
QualifierVector qualifier_vector; QualifierVector qualifier_vector;
Hashtable id_range_store = new Hashtable(); Hashtable id_range_store;
Timestamp lasttimemodified = null; Timestamp lasttimemodified = null;
Hashtable new_exon_set = new Hashtable(); Hashtable new_exon_set = new Hashtable();
for(int i=0; i<transcripts.size(); i++) for(int i=0; i<transcripts.size(); i++)
{ {
id_range_store = new Hashtable();
new_range_vector = new RangeVector(); new_range_vector = new RangeVector();
qualifier_vector = new QualifierVector(); qualifier_vector = new QualifierVector();
Feature transcript = (Feature)transcripts.get(i); GFFStreamFeature transcript = (GFFStreamFeature)transcripts.get(i);
String transcript_id = null; String transcript_id = null;
try transcript_id = (String)(transcript.getQualifierByName("ID").getValues().get(0));
{
transcript_id = (String)(transcript.getQualifierByName("ID").getValues().get(0));
}
catch(InvalidRelationException e1)
{
e1.printStackTrace();
}
Vector v_exons = (Vector)gene.getExonsOfTranscript(transcript_id); Vector v_exons = (Vector)gene.getExonsOfTranscript(transcript_id);
if(v_exons == null) if(v_exons == null)
continue; continue;
for(int j=0; j<v_exons.size(); j++) for(int j=0; j<v_exons.size(); j++)
{ {
...@@ -405,7 +399,7 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -405,7 +399,7 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
if(id_qualifier != null) if(id_qualifier != null)
{ {
String id = (String)(id_qualifier.getValues()).elementAt(0); String id = (String)(id_qualifier.getValues()).elementAt(0);
id_range_store.put(new_range, id); id_range_store.put(id, new_range);
} }
...@@ -433,7 +427,14 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -433,7 +427,14 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
if(lasttimemodified != null) if(lasttimemodified != null)
new_feature.setLastModified(lasttimemodified); new_feature.setLastModified(lasttimemodified);
new_feature.setSegmentRangeStore(id_range_store); new_feature.setSegmentRangeStore(id_range_store);
// set the ID
String ID = new_feature.getSegmentID(new_feature.getLocation().getRanges() );
Qualifier id_qualifier = new_feature.getQualifierByName("ID");
id_qualifier.removeValue( (String)(id_qualifier.getValues()).elementAt(0) );
id_qualifier.addValue(ID);
try try
{ {
new_feature.setLocation(new_location); new_feature.setLocation(new_location);
...@@ -477,6 +478,7 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -477,6 +478,7 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
} }
// now merge the exons in the ChadoCanonicalGene feature // now merge the exons in the ChadoCanonicalGene feature
Enumeration enum_exon_set = new_exon_set.keys(); Enumeration enum_exon_set = new_exon_set.keys();
int num = 0; int num = 0;
...@@ -640,14 +642,10 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -640,14 +642,10 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
else if(!qual.getName().equals("ID") && else if(!qual.getName().equals("ID") &&
!qual.getName().equals("Alias")) !qual.getName().equals("Alias"))
merge_qualifier_vector.setQualifier(qual); merge_qualifier_vector.setQualifier(qual);
else else if(qual.getName().equals("Alias"))
{ {
final Qualifier id_qualifier; final Qualifier id_qualifier =
merge_qualifier_vector.getQualifierByName("Alias");
if(qual.getName().equals("ID"))
id_qualifier = merge_qualifier_vector.getQualifierByName("ID");
else
id_qualifier = merge_qualifier_vector.getQualifierByName("Alias");
if(id_qualifier == null) if(id_qualifier == null)
merge_qualifier_vector.addElement(qual); merge_qualifier_vector.addElement(qual);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment