Пример #1
0
 def setUp(self):
     self.a = glbase3.delayedlist(
         filename="test_data/array_data.csv",
         format=format)  # although I don't actually need this at all.
     spoof_gl = [{"name": "Lypla1"}, {"name": "Pdia4"}]
     self.b = glbase3.genelist()
     self.b.load_list(spoof_gl)
Пример #2
0
    def test_sam_tophat_xs(self):
        newgl = gl.genelist("test_data/test.sam",
                            format=gl.format.sam_tophat_xs)

        self.assertEqual(newgl[0]["loc"], "chr1:3035081-3035081")
        self.assertEqual(
            newgl[0]["seq"],
            "AAACATTCCTGGGAACATCTTGACCATAAGATAAAGGGGACTGTGAAGACATAGCAGGGCTATATTATCTAAGTCAACACCATCTGGCCG"
        )
        self.assertEqual(newgl[0]["strand"], "+")
        self.assertEqual(newgl[1]["strand"], "-")

        # test it also works for a delayedlist, which is where I'd usually use it:
        newgl = gl.delayedlist("test_data/test.sam",
                               format=gl.format.sam_tophat_xs)

        for index, item in enumerate(newgl):
            #print item
            if index == 0:
                self.assertEqual(item["loc"], "chr1:3035081-3035081")
                self.assertEqual(
                    item["seq"],
                    "AAACATTCCTGGGAACATCTTGACCATAAGATAAAGGGGACTGTGAAGACATAGCAGGGCTATATTATCTAAGTCAACACCATCTGGCCG"
                )
                self.assertEqual(item["strand"], "+")
            elif index == 1:
                self.assertEqual(item["strand"], "-")
Пример #3
0
    def test_gzipped_delayedlist(self):
        self.b = glbase3.genelist(filename="test_data/array_data.csv",
                                  format=format)
        self.a = glbase3.delayedlist(filename="test_data/array_data.csv.gz",
                                     format=format,
                                     gzip=True)
        self.assertEqual(len(self.a), len(self.b))

        for item in self.a:
            self.assertEqual(item["name"], "Lypla1")
            self.assertEqual(item["array_systematic_name"], 'scl000965.1_10-S')
            break
Пример #4
0
    def test_force_tsvarg(self):
        form = dict(tss_loc=1, skiplines=0) # This loads tss_loc as strings
        form_delayed = dict(tss_loc=1, skiplines=0) # delayedlists must have skiplines
        a = gl.genelist(filename="test_data/mm9_refGene.tsv", force_tsv=True, format=form)
        c = gl.delayedlist(filename="test_data/mm9_refGene.tsv", format=form, force_tsv=True)
        d = gl.genome(filename="test_data/mm9_refGene.tsv", format=form_delayed, force_tsv=True)
        e = gl.expression(filename="test_data/mm9_refGene.tsv", format=form, force_tsv=True, expn="column[5:]") # fake array data # must go last as it modifies format

        # Make sure glbase is not just bodging it all in in one key:
        self.assertEqual("chr1:134212701-134212701", a[0]["tss_loc"])
        self.assertEqual("chr1:134212701-134212701", c[0]["tss_loc"])
        self.assertEqual("chr1:134212701-134212701", d[0]["tss_loc"]) # dls should work as __getitem__() will return the zeroth entry.
        self.assertEqual("chr1:134212701-134212701", e[0]["tss_loc"])
Пример #5
0
   def test_force_tsv_format(self):
       form = dict(tss_loc=1, force_tsv=True, chr=1)
       form_delayed = dict(tss_loc=1, force_tsv=True, skiplines=0) # delayedlists must have skiplines
 
       a = gl.genelist(filename="test_data/mm9_refGene.tsv", format=form)
       c = gl.delayedlist(filename="test_data/mm9_refGene.tsv", format=form_delayed)
       d = gl.genome(filename="test_data/mm9_refGene.tsv", format=form)
       e = gl.expression(filename="test_data/mm9_refGene.tsv", format=form, expn="column[5:]") # must go last as it modifies format      
       
       # Make sure glbase is not just bodging it all in in one key:
       self.assertEqual("chr1:134212701-134212701", a[0]["tss_loc"])
       self.assertEqual("chr1:134212701-134212701", c[0]["tss_loc"])
       self.assertEqual("chr1:134212701-134212701", d[0]["tss_loc"])
       self.assertEqual("chr1:134212701-134212701", e[0]["tss_loc"])
Пример #6
0
 def test_len(self):
     self.b = glbase3.genelist(filename="test_data/array_data.csv",
                               format=format)
     self.a = glbase3.delayedlist(filename="test_data/array_data.csv",
                                  format=format)
     self.assertEqual(len(self.a), len(self.b))