+ added read structure for new parser
[qpalma.git] / qpalma / tools / parseGff.py
index b01bbdc..8baabc6 100644 (file)
@@ -34,7 +34,7 @@ def parse(gff_fid):
             allGenes[currentGene.id] = currentGene
          
          desc = rx.search(desc).group()[3:-1]
-         print desc
+         #print desc
          currentGene = Gene(chr,start,stop,strand,desc)
 
       elif id == 'five_prime_UTR':
@@ -88,6 +88,15 @@ def parse(gff_fid):
       allGenes[currentGene.id] = currentGene
 
    return allGenes
+
+
+def createGffPickle(annotFile,pickleFile):
+   gff_fid = open(annotFile)
+   pickle_fid = open(pickleFile,'w+')
+   allGenes = parse(gff_fid)
+   #for key,val in allGenes.iteritems():
+      #print key
+   cPickle.dump(allGenes,pickle_fid)
       
 if __name__ == '__main__':
    assert len(sys.argv) >= 3
@@ -96,9 +105,4 @@ if __name__ == '__main__':
    assert os.path.exists(annotFile)
    assert not os.path.exists(pickleFile)
 
-   gff_fid = open(annotFile)
-   pickle_fid = open(pickleFile,'w+')
-   allGenes = parse(gff_fid)
-   for key,val in allGenes.iteritems():
-      print key
-   cPickle.dump(allGenes,pickle_fid)
+   createGffPickle(annotFile,pickleFile)