Ejemplo n.º 1
0
 def test_describe_derived_fields(self):
     desc = describe_fields(('dist_closest',
                             'dist_TSS','dist_TES',
                             'direction',
                             'overlap_feature',
                             'overlap_promoter',
                             'in_the_feature',
                             'order','number_of_results'))
     expected_fields = dict()
     for x in ('dist_closest',
               'dist_TSS','dist_TES',
               'direction',
               'overlap_feature',
               'overlap_promoter',
               'in_the_feature',
               'order','number_of_results'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature").\
                              replace("<SOURCE>","source").\
                              replace("<TARGET>","target")
     self.assertEqual(desc[0],('dist_closest',
                               expected_fields['dist_closest']))
     self.assertEqual(desc[1],('dist_TSS',expected_fields['dist_TSS']))
     self.assertEqual(desc[2],('dist_TES',expected_fields['dist_TES']))
     self.assertEqual(desc[3],('direction',expected_fields['direction']))
     self.assertEqual(desc[4],('overlap_feature',
                               expected_fields['overlap_feature']))
     self.assertEqual(desc[5],('overlap_promoter',
                               expected_fields['overlap_promoter']))
     self.assertEqual(desc[6],('in_the_feature',
                               expected_fields['in_the_feature']))
     self.assertEqual(desc[7],('order',expected_fields['order']))
     self.assertEqual(desc[8],('number_of_results',
                               expected_fields['number_of_results']))
 def test_describe_derived_fields(self):
     desc = describe_fields(('dist_closest',
                             'dist_TSS','dist_TES',
                             'direction',
                             'overlap_feature',
                             'overlap_promoter',
                             'in_the_feature',
                             'order','number_of_results'))
     expected_fields = dict()
     for x in ('dist_closest',
               'dist_TSS','dist_TES',
               'direction',
               'overlap_feature',
               'overlap_promoter',
               'in_the_feature',
               'order','number_of_results'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature").\
                              replace("<SOURCE>","source").\
                              replace("<TARGET>","target")
     self.assertEqual(desc[0],('dist_closest',
                               expected_fields['dist_closest']))
     self.assertEqual(desc[1],('dist_TSS',expected_fields['dist_TSS']))
     self.assertEqual(desc[2],('dist_TES',expected_fields['dist_TES']))
     self.assertEqual(desc[3],('direction',expected_fields['direction']))
     self.assertEqual(desc[4],('overlap_feature',
                               expected_fields['overlap_feature']))
     self.assertEqual(desc[5],('overlap_promoter',
                               expected_fields['overlap_promoter']))
     self.assertEqual(desc[6],('in_the_feature',
                               expected_fields['in_the_feature']))
     self.assertEqual(desc[7],('order',expected_fields['order']))
     self.assertEqual(desc[8],('number_of_results',
                               expected_fields['number_of_results']))
Ejemplo n.º 3
0
 def test_describe_listed_fields_for_features(self):
     desc = describe_fields(('chr','start','list(id,TSS,strand)'))
     self.assertEqual(desc[0],('chr',output.FIELDS['chr']))
     self.assertEqual(desc[1],('start',output.FIELDS['start']))
     self.assertEqual(desc[2],(('For each hit:',)))
     self.assertEqual(desc[3],('id_#',output.FIELDS['id']))
     self.assertEqual(desc[4],('TSS_#',output.FIELDS['TSS']))
     self.assertEqual(desc[5],('strand_#',output.FIELDS['strand']))
Ejemplo n.º 4
0
 def test_describe_peak_fields(self):
     desc = describe_fields(('peak.id','peak.chr','peak.start','peak.end',
                             'peak.file'))
     self.assertEqual(desc[0],('peak.id',output.FIELDS['peak.id']))
     self.assertEqual(desc[1],('peak.chr',output.FIELDS['peak.chr']))
     self.assertEqual(desc[2],('peak.start',output.FIELDS['peak.start']))
     self.assertEqual(desc[3],('peak.end',output.FIELDS['peak.end']))
     self.assertEqual(desc[4],('peak.file',output.FIELDS['peak.file']))
Ejemplo n.º 5
0
 def test_describe_listed_fields_for_peaks(self):
     desc = describe_fields(('id','list(chr,start,end,dist_TSS)'))
     self.assertEqual(desc[0],('id',output.FIELDS['id']))
     self.assertEqual(desc[1],(('For each hit:',)))
     self.assertEqual(desc[2],('chr_#',output.FIELDS['chr']))
     self.assertEqual(desc[3],('start_#',output.FIELDS['start']))
     self.assertEqual(desc[4],('end_#',output.FIELDS['end']))
     self.assertEqual(desc[5],('dist_TSS_#',output.FIELDS['dist_TSS']))
Ejemplo n.º 6
0
 def test_describe_unqualified_fields(self):
     desc = describe_fields(('chr','start','end','id',
                             'strand','TSS','TES',
                             'differentially_expressed'))
     self.assertEqual(desc[0],('chr',output.FIELDS['chr']))
     self.assertEqual(desc[1],('start',output.FIELDS['start']))
     self.assertEqual(desc[2],('end',output.FIELDS['end']))
     self.assertEqual(desc[3],('id',output.FIELDS['id']))
     self.assertEqual(desc[4],('strand',output.FIELDS['strand']))
     self.assertEqual(desc[5],('TSS',output.FIELDS['TSS']))
     self.assertEqual(desc[6],('TES',output.FIELDS['TES']))
Ejemplo n.º 7
0
 def test_describe_listed_fields_for_peaks(self):
     desc = describe_fields(('id','list(chr,start,end,dist_TSS)'))
     expected_fields = dict()
     for x in ('id','chr','start','end','dist_TSS'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('id',expected_fields['id']))
     self.assertEqual(desc[1],(('For each hit:',)))
     self.assertEqual(desc[2],('chr_#',expected_fields['chr']))
     self.assertEqual(desc[3],('start_#',expected_fields['start']))
     self.assertEqual(desc[4],('end_#',expected_fields['end']))
     self.assertEqual(desc[5],('dist_TSS_#',expected_fields['dist_TSS']))
Ejemplo n.º 8
0
 def test_describe_listed_fields_for_features(self):
     desc = describe_fields(('chr','start','list(id,TSS,strand)'))
     expected_fields = dict()
     for x in ('chr','start','id','TSS','strand'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],(('For each hit:',)))
     self.assertEqual(desc[3],('id_#',expected_fields['id']))
     self.assertEqual(desc[4],('TSS_#',expected_fields['TSS']))
     self.assertEqual(desc[5],('strand_#',expected_fields['strand']))
 def test_describe_listed_fields_for_features(self):
     desc = describe_fields(('chr','start','list(id,TSS,strand)'))
     expected_fields = dict()
     for x in ('chr','start','id','TSS','strand'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],(('For each hit:',)))
     self.assertEqual(desc[3],('id_#',expected_fields['id']))
     self.assertEqual(desc[4],('TSS_#',expected_fields['TSS']))
     self.assertEqual(desc[5],('strand_#',expected_fields['strand']))
 def test_describe_listed_fields_for_peaks(self):
     desc = describe_fields(('id','list(chr,start,end,dist_TSS)'))
     expected_fields = dict()
     for x in ('id','chr','start','end','dist_TSS'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('id',expected_fields['id']))
     self.assertEqual(desc[1],(('For each hit:',)))
     self.assertEqual(desc[2],('chr_#',expected_fields['chr']))
     self.assertEqual(desc[3],('start_#',expected_fields['start']))
     self.assertEqual(desc[4],('end_#',expected_fields['end']))
     self.assertEqual(desc[5],('dist_TSS_#',expected_fields['dist_TSS']))
Ejemplo n.º 11
0
 def test_describe_feature_fields(self):
     desc = describe_fields(('feature.chr','feature.id',
                             'feature.start','feature.end',
                             'feature.strand',
                             'feature.TSS','feature.TES'))
     self.assertEqual(desc[0],('feature.chr',output.FIELDS['feature.chr']))
     self.assertEqual(desc[1],('feature.id',output.FIELDS['feature.id']))
     self.assertEqual(desc[2],('feature.start',
                               output.FIELDS['feature.start']))
     self.assertEqual(desc[3],('feature.end',output.FIELDS['feature.end']))
     self.assertEqual(desc[4],('feature.strand',
                               output.FIELDS['feature.strand']))
     self.assertEqual(desc[5],('feature.TSS',output.FIELDS['feature.TSS']))
     self.assertEqual(desc[6],('feature.TES',output.FIELDS['feature.TES']))
 def test_describe_unqualified_fields(self):
     desc = describe_fields(('chr','start','end','id',
                             'strand','TSS','TES',
                             'differentially_expressed'))
     expected_fields = dict()
     for x in ('chr','start','end','id',
               'strand','TSS','TES',
               'differentially_expressed'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],('end',expected_fields['end']))
     self.assertEqual(desc[3],('id',expected_fields['id']))
     self.assertEqual(desc[4],('strand',expected_fields['strand']))
     self.assertEqual(desc[5],('TSS',expected_fields['TSS']))
     self.assertEqual(desc[6],('TES',expected_fields['TES']))
Ejemplo n.º 13
0
 def test_describe_unqualified_fields(self):
     desc = describe_fields(('chr','start','end','id',
                             'strand','TSS','TES',
                             'differentially_expressed'))
     expected_fields = dict()
     for x in ('chr','start','end','id',
               'strand','TSS','TES',
               'differentially_expressed'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],('end',expected_fields['end']))
     self.assertEqual(desc[3],('id',expected_fields['id']))
     self.assertEqual(desc[4],('strand',expected_fields['strand']))
     self.assertEqual(desc[5],('TSS',expected_fields['TSS']))
     self.assertEqual(desc[6],('TES',expected_fields['TES']))
Ejemplo n.º 14
0
 def test_update_placeholders_in_fields(self):
     desc = describe_fields(('chr','start','list(id,TSS,strand,direction)'),
                            feature="gene",
                            source="peak",
                            target="gene")
     expected_fields = dict()
     for x in ('chr','start','id','TSS','strand','direction'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","gene").\
                              replace("<SOURCE>","peak").\
                              replace("<TARGET>","gene")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],(('For each hit:',)))
     self.assertEqual(desc[3],('id_#',expected_fields['id']))
     self.assertEqual(desc[4],('TSS_#',expected_fields['TSS']))
     self.assertEqual(desc[5],('strand_#',expected_fields['strand']))
     self.assertEqual(desc[6],('direction_#',
                               expected_fields['direction']))
 def test_update_placeholders_in_fields(self):
     desc = describe_fields(('chr','start','list(id,TSS,strand,direction)'),
                            feature="gene",
                            source="peak",
                            target="gene")
     expected_fields = dict()
     for x in ('chr','start','id','TSS','strand','direction'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","gene").\
                              replace("<SOURCE>","peak").\
                              replace("<TARGET>","gene")
     self.assertEqual(desc[0],('chr',expected_fields['chr']))
     self.assertEqual(desc[1],('start',expected_fields['start']))
     self.assertEqual(desc[2],(('For each hit:',)))
     self.assertEqual(desc[3],('id_#',expected_fields['id']))
     self.assertEqual(desc[4],('TSS_#',expected_fields['TSS']))
     self.assertEqual(desc[5],('strand_#',expected_fields['strand']))
     self.assertEqual(desc[6],('direction_#',
                               expected_fields['direction']))
 def test_describe_feature_fields(self):
     desc = describe_fields(('feature.chr','feature.id',
                             'feature.start','feature.end',
                             'feature.strand',
                             'feature.TSS','feature.TES'))
     expected_fields = dict()
     for x in ('feature.chr','feature.id',
               'feature.start','feature.end',
               'feature.strand',
               'feature.TSS','feature.TES'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('feature.chr',expected_fields['feature.chr']))
     self.assertEqual(desc[1],('feature.id',expected_fields['feature.id']))
     self.assertEqual(desc[2],('feature.start',
                               expected_fields['feature.start']))
     self.assertEqual(desc[3],('feature.end',expected_fields['feature.end']))
     self.assertEqual(desc[4],('feature.strand',
                               expected_fields['feature.strand']))
     self.assertEqual(desc[5],('feature.TSS',expected_fields['feature.TSS']))
     self.assertEqual(desc[6],('feature.TES',expected_fields['feature.TES']))
Ejemplo n.º 17
0
 def test_describe_derived_fields(self):
     desc = describe_fields(('dist_closest',
                             'dist_TSS','dist_TES',
                             'direction',
                             'overlap_feature',
                             'overlap_promoter',
                             'in_the_feature',
                             'order','number_of_results'))
     self.assertEqual(desc[0],('dist_closest',
                               output.FIELDS['dist_closest']))
     self.assertEqual(desc[1],('dist_TSS',output.FIELDS['dist_TSS']))
     self.assertEqual(desc[2],('dist_TES',output.FIELDS['dist_TES']))
     self.assertEqual(desc[3],('direction',output.FIELDS['direction']))
     self.assertEqual(desc[4],('overlap_feature',
                               output.FIELDS['overlap_feature']))
     self.assertEqual(desc[5],('overlap_promoter',
                               output.FIELDS['overlap_promoter']))
     self.assertEqual(desc[6],('in_the_feature',
                               output.FIELDS['in_the_feature']))
     self.assertEqual(desc[7],('order',output.FIELDS['order']))
     self.assertEqual(desc[8],('number_of_results',
                               output.FIELDS['number_of_results']))
Ejemplo n.º 18
0
 def test_describe_feature_fields(self):
     desc = describe_fields(('feature.chr','feature.id',
                             'feature.start','feature.end',
                             'feature.strand',
                             'feature.TSS','feature.TES',
                             'feature.file'))
     expected_fields = dict()
     for x in ('feature.chr','feature.id',
               'feature.start','feature.end',
               'feature.strand',
               'feature.TSS','feature.TES',
               'feature.file'):
         expected_fields[x] = output.FIELDS[x].\
                              replace("<FEATURE>","feature")
     self.assertEqual(desc[0],('feature.chr',expected_fields['feature.chr']))
     self.assertEqual(desc[1],('feature.id',expected_fields['feature.id']))
     self.assertEqual(desc[2],('feature.start',
                               expected_fields['feature.start']))
     self.assertEqual(desc[3],('feature.end',expected_fields['feature.end']))
     self.assertEqual(desc[4],('feature.strand',
                               expected_fields['feature.strand']))
     self.assertEqual(desc[5],('feature.TSS',expected_fields['feature.TSS']))
     self.assertEqual(desc[6],('feature.TES',expected_fields['feature.TES']))
     self.assertEqual(desc[7],('feature.file',expected_fields['feature.file']))
Ejemplo n.º 19
0
 def test_field_with_no_description(self):
     desc = describe_fields(('missing_desc',))
     self.assertEqual(desc[0],('missing_desc','missing_desc'))
Ejemplo n.º 20
0
 def test_describe_peak_fields(self):
     desc = describe_fields(('peak.chr','peak.start','peak.end'))
     self.assertEqual(desc[0],('peak.chr',output.FIELDS['peak.chr']))
     self.assertEqual(desc[1],('peak.start',output.FIELDS['peak.start']))
     self.assertEqual(desc[2],('peak.end',output.FIELDS['peak.end']))