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

fix for multiple transcripts

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4524 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 1aadea3e
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.27 2006-07-04 15:59:38 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFDocumentEntry.java,v 1.28 2006-07-06 15:08:58 tjc Exp $
*/ */
package uk.ac.sanger.artemis.io; package uk.ac.sanger.artemis.io;
...@@ -30,6 +30,7 @@ import uk.ac.sanger.artemis.util.*; ...@@ -30,6 +30,7 @@ import uk.ac.sanger.artemis.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Set;
import java.util.Vector; import java.util.Vector;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -37,7 +38,7 @@ import java.sql.Timestamp; ...@@ -37,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.27 2006-07-04 15:59:38 tjc Exp $ * @version $Id: GFFDocumentEntry.java,v 1.28 2006-07-06 15:08:58 tjc Exp $
**/ **/
public class GFFDocumentEntry extends SimpleDocumentEntry public class GFFDocumentEntry extends SimpleDocumentEntry
...@@ -199,9 +200,8 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -199,9 +200,8 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
Qualifier parent_qualifier = this_feature.getQualifierByName("Parent"); Qualifier parent_qualifier = this_feature.getQualifierByName("Parent");
Qualifier derives_qualifier = this_feature.getQualifierByName("Derives_from"); Qualifier derives_qualifier = this_feature.getQualifierByName("Derives_from");
if(parent_qualifier == null && derives_qualifier == null) if(parent_qualifier == null && derives_qualifier == null)
continue; continue;
// compare this features parent_id's to transcript id's in the // compare this features parent_id's to transcript id's in the
// chado gene hash to decide if it is part of it // chado gene hash to decide if it is part of it
final StringVector parent_id; final StringVector parent_id;
...@@ -215,9 +215,11 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -215,9 +215,11 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
for(int j=0; j<parent_id.size(); j++) for(int j=0; j<parent_id.size(); j++)
{ {
String parent = (String)parent_id.get(j); String parent = (String)parent_id.get(j);
if(transcripts_lookup.containsKey(parent)) if(transcripts_lookup.containsKey(parent))
{ {
ChadoCanonicalGene gene = (ChadoCanonicalGene)transcripts_lookup.get(parent); ChadoCanonicalGene gene = (ChadoCanonicalGene)transcripts_lookup.get(parent);
if(parent_qualifier == null) if(parent_qualifier == null)
gene.addProtein(parent, this_feature); gene.addProtein(parent, this_feature);
else else
...@@ -345,14 +347,17 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -345,14 +347,17 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
{ {
Vector transcripts = (Vector)gene.getTranscripts(); Vector transcripts = (Vector)gene.getTranscripts();
final RangeVector new_range_vector = new RangeVector(); RangeVector new_range_vector;
QualifierVector qualifier_vector = new QualifierVector(); QualifierVector qualifier_vector;
Hashtable id_range_store = new Hashtable(); Hashtable id_range_store = new Hashtable();
Timestamp lasttimemodified = null; Timestamp lasttimemodified = null;
Hashtable new_exon_set = new Hashtable();
for(int i=0; i<transcripts.size(); i++) for(int i=0; i<transcripts.size(); i++)
{ {
new_range_vector = new RangeVector();
qualifier_vector = new QualifierVector();
Feature transcript = (Feature)transcripts.get(i); Feature transcript = (Feature)transcripts.get(i);
String transcript_id = null; String transcript_id = null;
try try
...@@ -364,10 +369,11 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -364,10 +369,11 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
e1.printStackTrace(); 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++)
{ {
final GFFStreamFeature this_feature = final GFFStreamFeature this_feature =
...@@ -447,7 +453,9 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -447,7 +453,9 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
new_feature.setQualifier(old_codon_start_qualifier); new_feature.setQualifier(old_codon_start_qualifier);
} }
forcedAdd(new_feature); forcedAdd(new_feature);
gene.addExon(transcript_id, new_feature, true ); //gene.addExon(transcript_id, new_feature, true );
new_exon_set.put(transcript_id, new_feature);
} }
catch(ReadOnlyException e) catch(ReadOnlyException e)
{ {
...@@ -462,6 +470,28 @@ public class GFFDocumentEntry extends SimpleDocumentEntry ...@@ -462,6 +470,28 @@ public class GFFDocumentEntry extends SimpleDocumentEntry
throw new Error("internal error - unexpected exception: " + e); throw new Error("internal error - unexpected exception: " + e);
} }
} }
// now merge the exons in the ChadoCanonicalGene feature
Enumeration enum_exon_set = new_exon_set.keys();
int num = 0;
while(enum_exon_set.hasMoreElements())
{
String transcript_id = (String)enum_exon_set.nextElement();
try
{
if(num == 0)
gene.addExon(transcript_id, new_exon_set.get(transcript_id), true );
else
gene.addExon(transcript_id, new_exon_set.get(transcript_id));
num++;
}
catch(InvalidRelationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
/** /**
......
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