当前位置: 首页>>代码示例>>Python>>正文


Python util.check_count函数代码示例

本文整理汇总了Python中qiita_db.util.check_count函数的典型用法代码示例。如果您正苦于以下问题:Python check_count函数的具体用法?Python check_count怎么用?Python check_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_processed_data_from_cmd

    def test_load_processed_data_from_cmd(self):
        filepaths = [self.otu_table_fp, self.otu_table_2_fp]
        filepath_types = ['biom', 'biom']

        initial_processed_data_count = get_count('qiita.processed_data')
        initial_processed_fp_count = get_count('qiita.processed_filepath')
        initial_fp_count = get_count('qiita.filepath')

        new = load_processed_data_cmd(filepaths, filepath_types,
                                      'processed_params_uclust', 1, 1, None)
        processed_data_id = new.id
        self.files_to_remove.append(
            join(self.db_test_processed_data_dir,
                 '%d_%s' % (processed_data_id, basename(self.otu_table_fp))))
        self.files_to_remove.append(
            join(self.db_test_processed_data_dir,
                 '%d_%s' % (processed_data_id,
                            basename(self.otu_table_2_fp))))

        self.assertTrue(check_count('qiita.processed_data',
                                    initial_processed_data_count + 1))
        self.assertTrue(check_count('qiita.processed_filepath',
                                    initial_processed_fp_count + 2))
        self.assertTrue(check_count('qiita.filepath',
                                    initial_fp_count + 2))

        # Ensure that the ValueError is raised when a filepath_type is not
        # provided for each and every filepath
        with self.assertRaises(ValueError):
            load_processed_data_cmd(filepaths, filepath_types[:-1],
                                    'processed_params_uclust', 1, 1, None)
开发者ID:Jorge-C,项目名称:qiita,代码行数:31,代码来源:test_commands.py

示例2: test_post_edit

    def test_post_edit(self):
        study_count_before = get_count('qiita.study')
        study = Study(1)
        study_info = study.info

        post_data = {
            'new_people_names': [],
            'new_people_emails': [],
            'new_people_affiliations': [],
            'new_people_addresses': [],
            'new_people_phones': [],
            'study_title': 'dummy title',
            'study_alias': study_info['study_alias'],
            'publications_doi': ','.join(
                [doi for doi, _ in study.publications]),
            'study_abstract': study_info['study_abstract'],
            'study_description': study_info['study_description'],
            'principal_investigator': study_info['principal_investigator_id'],
            'lab_person': study_info['lab_person_id']}

        self.post('/study/edit/1', post_data)

        # Check that the study was updated
        self.assertTrue(check_count('qiita.study', study_count_before))
        self.assertEqual(study.title, 'dummy title')
开发者ID:mivamo1214,项目名称:qiita,代码行数:25,代码来源:test_study_handlers.py

示例3: test_import_preprocessed_data

 def test_import_preprocessed_data(self):
     initial_ppd_count = get_count('qiita.preprocessed_data')
     initial_fp_count = get_count('qiita.filepath')
     ppd = load_preprocessed_data_from_cmd(
         1, 'preprocessed_sequence_illumina_params',
         self.tmpdir, 'preprocessed_sequences', 1, False, 1)
     self.files_to_remove.append(
         join(self.db_test_ppd_dir,
              '%d_%s' % (ppd.id, basename(self.file1))))
     self.files_to_remove.append(
         join(self.db_test_ppd_dir,
              '%d_%s' % (ppd.id, basename(self.file2))))
     self.assertEqual(ppd.id, 3)
     self.assertTrue(check_count('qiita.preprocessed_data',
                                 initial_ppd_count + 1))
     self.assertTrue(check_count('qiita.filepath', initial_fp_count+2))
开发者ID:Jorge-C,项目名称:qiita,代码行数:16,代码来源:test_commands.py

示例4: test_new_person_created

    def test_new_person_created(self):
        person_count_before = get_count('qiita.study_person')

        post_data = {'new_people_names': ['Adam', 'Ethan'],
                     'new_people_emails': ['[email protected]', '[email protected]'],
                     'new_people_affiliations': ['CU Boulder', 'NYU'],
                     'new_people_addresses': ['Some St., Boulder, CO 80305',
                                              ''],
                     'new_people_phones': ['', ''],
                     'study_title': 'dummy title',
                     'study_alias': 'dummy alias',
                     'pubmed_id': 'dummy pmid',
                     'investigation_type': 'eukaryote',
                     'environmental_packages': 'air',
                     'is_timeseries': 'y',
                     'study_abstract': "dummy abstract",
                     'study_description': 'dummy description',
                     'principal_investigator': '-2',
                     'lab_person': '1'}

        self.post('/study/create/', post_data)

        # Check that the new person was created
        expected_id = person_count_before + 1
        self.assertTrue(check_count('qiita.study_person', expected_id))

        new_person = StudyPerson(expected_id)
        self.assertTrue(new_person.name == 'Ethan')
        self.assertTrue(new_person.email == '[email protected]')
        self.assertTrue(new_person.affiliation == 'NYU')
        self.assertTrue(new_person.address is None)
        self.assertTrue(new_person.phone is None)
开发者ID:Jorge-C,项目名称:qiita,代码行数:32,代码来源:test_study_handlers.py

示例5: test_load_data_from_cmd

    def test_load_data_from_cmd(self):
        filepaths = [self.forward_fp, self.reverse_fp, self.barcodes_fp]
        filepath_types = ['raw_forward_seqs', 'raw_reverse_seqs',
                          'raw_barcodes']

        filetype = 'FASTQ'
        metadata_dict = {
            'SKB8.640193': {'center_name': 'ANL',
                            'primer': 'GTGCCAGCMGCCGCGGTAA',
                            'barcode': 'GTCCGCAAGTTA',
                            'run_prefix': "s_G1_L001_sequences",
                            'platform': 'ILLUMINA',
                            'instrument_model': 'Illumina MiSeq',
                            'library_construction_protocol': 'AAAA',
                            'experiment_design_description': 'BBBB'}}
        metadata = pd.DataFrame.from_dict(metadata_dict, orient='index')
        pt1 = PrepTemplate.create(metadata, Study(1), "16S")
        prep_templates = [pt1.id]

        initial_raw_count = get_count('qiita.raw_data')
        initial_fp_count = get_count('qiita.filepath')
        initial_raw_fp_count = get_count('qiita.raw_filepath')

        new = load_raw_data_cmd(filepaths, filepath_types, filetype,
                                prep_templates)
        raw_data_id = new.id
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.forward_fp))))
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.reverse_fp))))
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.barcodes_fp))))

        self.assertTrue(check_count('qiita.raw_data', initial_raw_count + 1))
        self.assertTrue(check_count('qiita.filepath',
                                    initial_fp_count + 3))
        self.assertTrue(check_count('qiita.raw_filepath',
                                    initial_raw_fp_count + 3))

        # Ensure that the ValueError is raised when a filepath_type is not
        # provided for each and every filepath
        with self.assertRaises(ValueError):
            load_raw_data_cmd(filepaths, filepath_types[:-1], filetype,
                              prep_templates)
开发者ID:jenwei,项目名称:qiita,代码行数:47,代码来源:test_commands.py

示例6: test_load_data_from_cmd

    def test_load_data_from_cmd(self):
        filepaths = [self.forward_fp, self.reverse_fp, self.barcodes_fp]
        filepath_types = ['raw_forward_seqs', 'raw_reverse_seqs',
                          'raw_barcodes']

        filetype = 'FASTQ'
        study_ids = [1]

        initial_raw_count = get_count('qiita.raw_data')
        initial_fp_count = get_count('qiita.filepath')
        initial_raw_fp_count = get_count('qiita.raw_filepath')

        new = load_raw_data_cmd(filepaths, filepath_types, filetype,
                                study_ids)
        raw_data_id = new.id
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.forward_fp))))
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.reverse_fp))))
        self.files_to_remove.append(
            join(self.db_test_raw_dir,
                 '%d_%s' % (raw_data_id, basename(self.barcodes_fp))))

        self.assertTrue(check_count('qiita.raw_data', initial_raw_count + 1))
        self.assertTrue(check_count('qiita.filepath',
                                    initial_fp_count + 3))
        self.assertTrue(check_count('qiita.raw_filepath',
                                    initial_raw_fp_count + 3))
        self.assertTrue(check_count('qiita.study_raw_data',
                                    initial_raw_count + 1))

        # Ensure that the ValueError is raised when a filepath_type is not
        # provided for each and every filepath
        with self.assertRaises(ValueError):
            load_raw_data_cmd(filepaths, filepath_types[:-1], filetype,
                              study_ids)
开发者ID:BrindhaBioinfo,项目名称:qiita,代码行数:38,代码来源:test_commands.py

示例7: test_post_edit_blank_doi

    def test_post_edit_blank_doi(self):
        study_count_before = get_count('qiita.study')
        study = Study(1)
        study_info = study.info

        post_data = {
            'new_people_names': [],
            'new_people_emails': [],
            'new_people_affiliations': [],
            'new_people_addresses': [],
            'new_people_phones': [],
            'study_title': 'New title - test post edit',
            'study_alias': study_info['study_alias'],
            'publications_doi': '',
            'study_abstract': study_info['study_abstract'],
            'study_description': study_info['study_description'],
            'principal_investigator': study_info['principal_investigator'].id,
            'lab_person': study_info['lab_person'].id}

        response = self.post('/study/edit/1', post_data)
        self.assertEqual(response.code, 200)
        # Check that the study was updated
        self.assertTrue(check_count('qiita.study', study_count_before))
        self.assertEqual(study.title, 'New title - test post edit')
        self.assertEqual(study.publications, [])

        # check for failure
        old_title = post_data['study_title']
        post_data['study_title'] = 'My new title!'
        shared = User('[email protected]')
        study.unshare(shared)
        BaseHandler.get_current_user = Mock(return_value=shared)
        response = self.post('/study/edit/1', post_data)
        self.assertEqual(response.code, 403)
        # Check that the study wasn't updated
        self.assertEqual(study.title, old_title)

        # returning sharing
        study.share(shared)
开发者ID:ElDeveloper,项目名称:qiita,代码行数:39,代码来源:test_edit_handlers.py

示例8: test_processed_filepath

 def test_processed_filepath(self):
     check_count("qiita.processed_filepath", 1)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例9: test_reference

 def test_reference(self):
     check_count("qiita.reference", 1)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例10: test_processed_params_uclust

 def test_processed_params_uclust(self):
     check_count("qiita.processed_params_uclust", 1)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例11: test_filepath

 def test_filepath(self):
     check_count("qiita.filepath", 9)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例12: test_required_sample_info

 def test_required_sample_info(self):
     check_count("qiita.required_sample_info", 27)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例13: test_raw_filepath

 def test_raw_filepath(self):
     check_count("qiita.raw_filepath", 4)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例14: test_ontology_terms

 def test_ontology_terms(self):
     self.assertTrue(check_count('qiita.term', 14))
开发者ID:zonca,项目名称:qiita,代码行数:2,代码来源:test_setup.py

示例15: test_raw_data_prep_columns

 def test_raw_data_prep_columns(self):
     check_count("qiita.raw_data_prep_columns", 19)
开发者ID:teravest,项目名称:qiita,代码行数:2,代码来源:test_setup.py


注:本文中的qiita_db.util.check_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。