+ cleaning up code base
[qpalma.git] / ParaParser / simple_example.py
index 747e147..d267d03 100644 (file)
@@ -5,12 +5,39 @@ import sys
 from ParaParser import *
 
 def run(file):
-   parser = ParaParser("%d%s%s%d%d",["field0","field1","field2","field3","field4"],5)
+   parser = ParaParser("%d%s%s%d%d",["field0","field1","field2","field3","field4"],5,IN_MAP)
    parser.parseFile(file)
-   entry1_dict = parser.fetchEntry(101)
+   entry1_dict = parser.fetchEntry(1111)
    print entry1_dict
-   entry2_dict = parser.fetchEntry(102)
+   entry2_dict = parser.fetchEntry(2222)
    print entry2_dict
+   entry3_dict = parser.fetchEntry(3333)
+   print entry3_dict
+
+   del parser
+
+   parser2 = ParaParser("%d%s",["field0","field1"],2,IN_MAP)
+   file = 'test2.data'
+   parser2.parseFile(file)
+   entry1_dict = parser2.fetchEntry(1111)
+   print entry1_dict
+
+   parser2 = ParaParser("%lu%s",["field0","field1"],2,IN_MAP)
+   file = 'test3.data'
+   parser2.parseFile(file)
+   entry1_dict = parser2.fetchEntry(1000100000503)
+   print entry1_dict
+
+   fields = ['id', 'chr', 'pos', 'strand', 'mismatches', 'length',\
+   'offset', 'seq', 'prb', 'cal_prb', 'chastity']
+
+   parser2 = ParaParser("%lu%d%d%s%d%d%d%s%s%s%s",fields,len(fields),IN_VECTOR)
+   file = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/MAP3'
+   parser2.parseFile(file)
+   entry1_dict = parser2.fetchEntry(0)
+   print entry1_dict
+   entry1_dict = parser2.fetchEntry(1)
+   print entry1_dict
 
 if __name__ == '__main__':
    run('test.data')