Exemple #1
0
    def test_experiment(self):
        """Checks that the form works for an experiment. """
        # Upload input
        stream = open(TEST_INPUT)
        post = self.app.post('/', data=dict(
                mapqtl_input=stream),
                follow_redirects=True)
        stream.close()
        self.assertTrue(post.status_code, 200)
        self.assertTrue('<p> Session identifier: <span style="color:red">'
            in post.data)

        motif = re.compile('\n(.*)</span>\n\s+</p>\n')
        output = motif.search(post.data)
        session_id = output.group(1).strip()

        # Give threshold and session
        post2 = self.app.post('/session/%s/' % session_id,
                data=dict(lod_threshold=3, session=2),
                follow_redirects=True)
        self.assertTrue(post2.status_code, 200)

        motif = re.compile('<li><a href="/session/.*>(.*)</a>')
        output = motif.search(post2.data)
        exp_id = output.group(1).strip()
        self.assertTrue('<p> Session identifier: <span style="color:red">'
            in post2.data)

        # Check results
        post3 = self.app.get('/session/%s/%s/' % (session_id, exp_id),
                follow_redirects=True)

        self.assertTrue(post3.status_code, 200)
        self.assertTrue('qtls_matrix.csv</a> -- Matrix giving for each'
            in post3.data)
        self.assertTrue('map.csv</a> -- The genetic map extracted'
            in post3.data)
        self.assertTrue('map_with_qtls.csv</a> -- Representation'
            in post3.data)

        post4 = self.app.post('/session/%s/' % session_id,
                data=dict(lod_threshold=3, session=2),
                follow_redirects=True)
        self.assertTrue(post4.status_code, 200)
        self.assertTrue('<li>Experiment already run in experiment: ' in
            post4.data)

        post5 = self.app.get('/session/%s/%s/marker/E36M48-330' % (session_id,
                exp_id),
                follow_redirects=True)

        self.assertTrue(post5.status_code, 200)
        self.assertTrue('MQ² results for marker E36M48-330' in post5.data)
        self.assertTrue('2 QTLs found' in post5.data)
        self.assertTrue('A_trait07' in post5.data)
        self.assertTrue('A_trait11' in post5.data)

        upload_folder = CONFIG.get('mq2', 'upload_folder')
        shutil.rmtree(os.path.join(upload_folder, session_id))
Exemple #2
0
    def test_experiment(self):
        """Checks that the form works for an experiment. """
        # Upload input
        stream = open(TEST_INPUT)
        post = self.app.post('/',
                             data=dict(mapqtl_input=stream),
                             follow_redirects=True)
        stream.close()
        self.assertTrue(post.status_code, 200)
        self.assertTrue(
            '<p> Session identifier: <span style="color:red">' in post.data)

        motif = re.compile('\n(.*)</span>\n\s+</p>\n')
        output = motif.search(post.data)
        session_id = output.group(1).strip()

        # Give threshold and session
        post2 = self.app.post('/session/%s/' % session_id,
                              data=dict(lod_threshold=3, session=2),
                              follow_redirects=True)
        self.assertTrue(post2.status_code, 200)

        motif = re.compile('<li><a href="/session/.*>(.*)</a>')
        output = motif.search(post2.data)
        exp_id = output.group(1).strip()
        self.assertTrue(
            '<p> Session identifier: <span style="color:red">' in post2.data)

        # Check results
        post3 = self.app.get('/session/%s/%s/' % (session_id, exp_id),
                             follow_redirects=True)

        self.assertTrue(post3.status_code, 200)
        self.assertTrue(
            'qtls_matrix.csv</a> -- Matrix giving for each' in post3.data)
        self.assertTrue(
            'map.csv</a> -- The genetic map extracted' in post3.data)
        self.assertTrue(
            'map_with_qtls.csv</a> -- Representation' in post3.data)

        post4 = self.app.post('/session/%s/' % session_id,
                              data=dict(lod_threshold=3, session=2),
                              follow_redirects=True)
        self.assertTrue(post4.status_code, 200)
        self.assertTrue(
            '<li>Experiment already run in experiment: ' in post4.data)

        post5 = self.app.get('/session/%s/%s/marker/E36M48-330' %
                             (session_id, exp_id),
                             follow_redirects=True)

        self.assertTrue(post5.status_code, 200)
        self.assertTrue('MQ² results for marker E36M48-330' in post5.data)
        self.assertTrue('2 QTLs found' in post5.data)
        self.assertTrue('A_trait07' in post5.data)
        self.assertTrue('A_trait11' in post5.data)

        upload_folder = CONFIG.get('mq2', 'upload_folder')
        shutil.rmtree(os.path.join(upload_folder, session_id))
Exemple #3
0
 def test_sample_session(self):
     """Checks that the form works for an existing session. """
     session_id = CONFIG.get('mq2', 'sample_session')
     post = self.app.post('/', data=dict(
             session_id=session_id),
             follow_redirects=True)
     self.assertTrue(post.status_code, 200)
     if session_id == 'A MQ² session identifier provided as example in the front page':
         self.assertTrue('<li>This session does not exists</li>'
             in post.data)
     else:
         self.assertTrue('<p> Session identifier: <span style="color:red">'
             in post.data)
Exemple #4
0
 def test_sample_session(self):
     """Checks that the form works for an existing session. """
     session_id = CONFIG.get('mq2', 'sample_session')
     post = self.app.post('/',
                          data=dict(session_id=session_id),
                          follow_redirects=True)
     self.assertTrue(post.status_code, 200)
     if session_id == 'A MQ² session identifier provided as example in the front page':
         self.assertTrue(
             '<li>This session does not exists</li>' in post.data)
     else:
         self.assertTrue('<p> Session identifier: <span style="color:red">'
                         in post.data)
Exemple #5
0
    def test_sample_data(self):
        """Checks that the form works to upload the demo dataset. """
        stream = open(TEST_INPUT)
        post = self.app.post('/', data=dict(
                mapqtl_input=stream),
                follow_redirects=True)
        stream.close()

        self.assertTrue(post.status_code, 200)
        self.assertTrue('<p> Session identifier: <span style="color:red">'
            in post.data)

        motif = re.compile('\n(.*)</span>\n\s+</p>\n')
        output = motif.search(post.data)
        session_id = output.group(1).strip()

        post = self.app.post('/session/%s/' % session_id)
        self.assertTrue(post.status_code, 200)
        self.assertTrue('<p> Session identifier: <span style="color:red">'
            in post.data)
        self.assertTrue('%s</span></p>\n' % session_id)

        upload_folder = CONFIG.get('mq2', 'upload_folder')
        shutil.rmtree(os.path.join(upload_folder, session_id))
Exemple #6
0
    def test_sample_data(self):
        """Checks that the form works to upload the demo dataset. """
        stream = open(TEST_INPUT)
        post = self.app.post('/',
                             data=dict(mapqtl_input=stream),
                             follow_redirects=True)
        stream.close()

        self.assertTrue(post.status_code, 200)
        self.assertTrue(
            '<p> Session identifier: <span style="color:red">' in post.data)

        motif = re.compile('\n(.*)</span>\n\s+</p>\n')
        output = motif.search(post.data)
        session_id = output.group(1).strip()

        post = self.app.post('/session/%s/' % session_id)
        self.assertTrue(post.status_code, 200)
        self.assertTrue(
            '<p> Session identifier: <span style="color:red">' in post.data)
        self.assertTrue('%s</span></p>\n' % session_id)

        upload_folder = CONFIG.get('mq2', 'upload_folder')
        shutil.rmtree(os.path.join(upload_folder, session_id))