• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.get_tmp_filename函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

    def setUp(self):

        # Temporary input file
        self.tmp_otu_filepath = get_tmp_filename(prefix="R_test_otu_table_", suffix=".txt")
        seq_file = open(self.tmp_otu_filepath, "w")
        seq_file.write(test_otu_table)
        seq_file.close()

        self.tmp_map_filepath = get_tmp_filename(prefix="R_test_map_", suffix=".txt")
        seq_file = open(self.tmp_map_filepath, "w")
        seq_file.write(test_map)
        seq_file.close()

        self.files_to_remove = [self.tmp_otu_filepath, self.tmp_map_filepath]

        # Prep input files in R format
        output_dir = mkdtemp()
        self.dirs_to_remove = [output_dir]

        # get random forests results
        mkdir(join(output_dir, "random_forest"))
        self.results = run_supervised_learning(
            self.tmp_otu_filepath,
            self.tmp_map_filepath,
            "Individual",
            ntree=100,
            errortype="oob",
            output_dir=output_dir,
        )
开发者ID:lkursell,项目名称:qiime,代码行数:29,代码来源:test_supervised_learning.py


示例2: test_get_common_OTUs

    def test_get_common_OTUs(self):
        """get_common_OTUs works"""

        # create the temporary OTU tables
        otu_table1 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tConsensus Lineage',
                     '0\t0\t2\t0\tlineage0',
                     '1\t1\t0\t0\tlineage1',
                     '2\t1\t1\t1\tlineage2'])
        otu_table2 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tConsensus Lineage',
                     '0\t0\t2\t0\tlineage0',
                     '1\t1\t0\t0\tlineage1',
                     '2\t0\t1\t1\tlineage2'])
        otu_table3 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tConsensus Lineage',
                     '0\t0\t2\t0\tlineage0',
                     '2\t1\t1\t1\tlineage2'])
        category_info = {'sample1':'0.1',
                        'sample2':'0.2',
                        'sample3':'0.3'}
        OTU_list = ['1', '0', '2'] 

        fp1 = get_tmp_filename()
        fp2 = get_tmp_filename()
        fp3 = get_tmp_filename()
        try:
            f1 = open(fp1,'w')
            f2 = open(fp2,'w')
            f3 = open(fp3,'w')
        except IOError, e:
            raise e,"Could not create temporary files: %s, %s" %(f1,f2, f3)
开发者ID:Ecogenomics,项目名称:FrankenQIIME,代码行数:32,代码来源:test_otu_category_significance.py


示例3: setUp

    def setUp(self):
        
        # Temporary input file
        self.tmp_otu_filepath = get_tmp_filename(
            prefix='R_test_otu_table_',
            suffix='.txt'
            )
        seq_file = open(self.tmp_otu_filepath, 'w')
        seq_file.write(test_otu_table)
        seq_file.close()

        self.tmp_map_filepath = get_tmp_filename(
            prefix='R_test_map_',
            suffix='.txt'
            )
        seq_file = open(self.tmp_map_filepath, 'w')
        seq_file.write(test_map)
        seq_file.close()


        self.files_to_remove = \
         [self.tmp_otu_filepath, self.tmp_map_filepath]
   
        # Prep input files in R format
        output_dir = mkdtemp()
        self.dirs_to_remove = [output_dir]

        # get random forests results
        mkdir(join(output_dir, 'random_forest'))
        self.results = run_supervised_learning(
            self.tmp_otu_filepath, self.tmp_map_filepath,'Individual',
            ntree=100, errortype='oob',
            output_dir=output_dir)
开发者ID:rob-knight,项目名称:qiime,代码行数:33,代码来源:test_supervised_learning.py


示例4: setUp

 def setUp(self):
     
     self.files_to_remove = []
     self.dirs_to_remove = []
     
     # Create example output directory
     tmp_dir = get_qiime_temp_dir()
     self.test_out = get_tmp_filename(tmp_dir=tmp_dir,
                                      prefix='qiime_parallel_tests_',
                                      suffix='',
                                      result_constructor=str)
     self.dirs_to_remove.append(self.test_out)
     create_dir(self.test_out)
     
     # Create example input file
     self.inseqs1_fp = get_tmp_filename(tmp_dir=self.test_out,
                                         prefix='qiime_inseqs',
                                         suffix='.fasta')
     inseqs1_f = open(self.inseqs1_fp,'w')
     inseqs1_f.write(inseqs1)
     inseqs1_f.close()
     self.files_to_remove.append(self.inseqs1_fp)
     
     # Define number of seconds a test can run for before timing out 
     # and failing
     initiate_timeout(60)
开发者ID:B-Rich,项目名称:cmd-abstraction,代码行数:26,代码来源:test_util.py


示例5: setUp

    def setUp(self):
        self._files_to_remove = []
        
        self.fasta_file_path = get_tmp_filename(prefix='fastq_', \
        suffix='.fastq')
        
        fastq_file = open(self.fasta_file_path, 'w')
        
        fastq_file.write(fastq_test_string)
        fastq_file.close()
        
        #Error testing files
        false_fasta_file = '/'
        false_qual_file = '/'
        self.read_only_output_dir = get_tmp_filename(prefix = 'read_only_', \
        suffix = '/')
        create_dir(self.read_only_output_dir)
        chmod(self.read_only_output_dir, 0577)

        self.output_dir = get_tmp_filename(prefix = 'convert_fastaqual_fastq_',\
         suffix = '/')
        self.output_dir += sep
        
        create_dir(self.output_dir)
        
        self._files_to_remove.append(self.fasta_file_path)
开发者ID:DDomogala3,项目名称:qiime,代码行数:26,代码来源:test_convert_fastaqual_fastq.py


示例6: test_plot_rank_abundance_graphs_dense

    def test_plot_rank_abundance_graphs_dense(self):
        """plot_rank_abundance_graphs works with any number of samples (DenseOTUTable)"""
 
        self.otu_table = parse_biom_table_str(otu_table_dense)
        self.dir = get_tmp_filename(tmp_dir=self.tmp_dir,
                                   prefix="test_plot_rank_abundance",
                                   suffix="/")
        create_dir(self.dir)
        self._dirs_to_remove.append(self.dir)
        tmp_fname = get_tmp_filename(tmp_dir=self.dir)

        #test empty sample name
        self.assertRaises(ValueError, plot_rank_abundance_graphs, tmp_fname,'',
                          self.otu_table)
        #test invalid sample name
        self.assertRaises(ValueError, plot_rank_abundance_graphs, tmp_fname,
                          'Invalid_sample_name',
                          self.otu_table)

        #test with two samples
        file_type="pdf"
        tmp_file = abspath(self.dir+"rank_abundance_cols_0_2."+file_type)
        plot_rank_abundance_graphs(tmp_file, 'S3,S5', self.otu_table,
                                       file_type=file_type)

        self.assertTrue(exists(tmp_file)) 
        self.files_to_remove.append(tmp_file)
        # test with all samples
        tmp_file = abspath(self.dir+"rank_abundance_cols_0_1_2."+file_type)

        plot_rank_abundance_graphs(tmp_file,'*', self.otu_table,file_type=file_type)
        
        self.files_to_remove.append(tmp_file)
        self.assertTrue(exists(tmp_file)) 
开发者ID:Jorge-C,项目名称:qiime,代码行数:34,代码来源:test_plot_rank_abundance_graph.py


示例7: setUp

    def setUp(self):
        
        # Temporary input file
        self.tmp_pc_fp = get_tmp_filename(
            prefix='R_test_pcoa',
            suffix='.txt'
            )
        seq_file = open(self.tmp_pc_fp, 'w')
        seq_file.write(test_pc)
        seq_file.close()

        self.tmp_map_fp = get_tmp_filename(
            prefix='R_test_map_',
            suffix='.txt'
            )
        map_file = open(self.tmp_map_fp, 'w')
        map_file.write(test_map)
        map_file.close()


        self.files_to_remove = \
         [self.tmp_pc_fp, self.tmp_map_fp]
   
        # Prep input files in R format
        self.output_dir = mkdtemp()
        self.dirs_to_remove = [self.output_dir]
开发者ID:rob-knight,项目名称:qiime,代码行数:26,代码来源:test_detrend.py


示例8: setUp

 def setUp(self):
     """ """
     self.files_to_remove = []
     self.dirs_to_remove = []
     
     tmp_dir = get_qiime_temp_dir()
     self.test_out = get_tmp_filename(tmp_dir=tmp_dir,
                                      prefix='qiime_parallel_tests_',
                                      suffix='',
                                      result_constructor=str)
     self.dirs_to_remove.append(self.test_out)
     create_dir(self.test_out)
     
     self.template_fp = get_tmp_filename(tmp_dir=self.test_out,
                                         prefix='qiime_template',
                                         suffix='.fasta')
     template_f = open(self.template_fp,'w')
     template_f.write(pynast_test1_template_fasta)
     template_f.close()
     self.files_to_remove.append(self.template_fp)
     
     self.inseqs1_fp = get_tmp_filename(tmp_dir=self.test_out,
                                         prefix='qiime_inseqs',
                                         suffix='.fasta')
     inseqs1_f = open(self.inseqs1_fp,'w')
     inseqs1_f.write(inseqs1)
     inseqs1_f.close()
     self.files_to_remove.append(self.inseqs1_fp)
     
     initiate_timeout(60)
开发者ID:qiime,项目名称:qp-refactor,代码行数:30,代码来源:test_align_seqs.py


示例9: test_call_log_file

    def test_call_log_file(self):
        """GenericRepSetPicker.__call__ writes log when expected
        """

        tmp_log_filepath = get_tmp_filename(
            prefix='GenericRepSetPickerTest.test_call_output_to_file_l_',
            suffix='.txt')
        tmp_result_filepath = get_tmp_filename(
            prefix='GenericRepSetPickerTest.test_call_output_to_file_r_',
            suffix='.txt')

        app = GenericRepSetPicker(params=self.params)
        obs = app(self.tmp_seq_filepath, self.tmp_otu_filepath,
                  result_path=tmp_result_filepath, log_path=tmp_log_filepath)

        log_file = open(tmp_log_filepath)
        log_file_str = log_file.read()
        log_file.close()
        # remove the temp files before running the test, so in
        # case it fails the temp file is still cleaned up
        remove(tmp_log_filepath)
        remove(tmp_result_filepath)

        log_file_exp = ["GenericRepSetPicker parameters:",
                        'Algorithm:first',
                        "Application:None",
                        'ChoiceF:first',
                        'ChoiceFRequiresSeqs:False',
                        "Result path: %s" % tmp_result_filepath, ]
        # compare data in log file to fake expected log file
        for i, j in zip(log_file_str.splitlines(), log_file_exp):
            if not i.startswith('ChoiceF:'):  # can't test, different each time
                self.assertEqual(i, j)
开发者ID:TheSchwa,项目名称:qiime,代码行数:33,代码来源:test_pick_rep_set.py


示例10: test_test_wrapper_multiple

    def test_test_wrapper_multiple(self):
        """test_wrapper_multiple works"""
        # create the temporary OTU tables
        otu_table1 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tsample4\tConsensus Lineage',
                     '0\t1\t2\t0\t1\tlineage0',
                     '1\t1\t0\t0\t1\tlineage1',
                     '2\t1\t1\t1\t1\tlineage2'])
        otu_table2 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tsample4\tConsensus Lineage',
                     '0\t0\t2\t0\t1\tlineage0',
                     '1\t1\t0\t0\t1\tlineage1',
                     '2\t0\t1\t1\t1\tlineage2'])
        otu_table3 = '\n'.join(['#Full OTU Counts',
                     '#OTU ID\tsample1\tsample2\tsample3\tConsensus Lineage',
                     '0\t0\t2\t0\t1\tlineage0',
                     '2\t1\t1\t1\t1\tlineage2'])
        category_mapping = ['#SampleID\tcat1\tcat2',
                                      'sample1\tA\t0',
                                      'sample2\tA\t8.0',
                                      'sample3\tB\t1.0',
                                      'sample4\tB\t1.0']
        OTU_list = ['1', '0'] 

        fp1 = get_tmp_filename()
        fp2 = get_tmp_filename()
        fp3 = get_tmp_filename()
        try:
            f1 = open(fp1,'w')
            f2 = open(fp2,'w')
            f3 = open(fp3,'w')
        except IOError, e:
            raise e,"Could not create temporary files: %s, %s" %(f1,f2, f3)
开发者ID:Ecogenomics,项目名称:FrankenQIIME,代码行数:33,代码来源:test_otu_category_significance.py


示例11: model2_table

def model2_table(otu_sums, samples, seq_depth, tpk):
    """Return OTU table drawn from dirichlet distribution with given params.
    Inputs:
     otu_sums - array of floats, weights you want to give to each otu in terms 
     of its probability mass for sampling. basically how large you want the sum
     of that otu to be compared to the others.
     samples - int, number of samples for each otu.
     seq_depth - the sum of each col of the data table, the number of 
     observations. 
     tpk - total prior knowledge. controls how spiky the distribution will be. 
     higher total prior knowledge will allow it to be much spikier which means
     less deviation away from otu_sums. 
    """
    prior_vals = otu_sums
    pvs_str =  'c(%s)' % ','.join(map(str,prior_vals))
    out_fp = get_tmp_filename()
    command_str = COMMAND_STR % (pvs_str, tpk, samples, seq_depth, out_fp)
    command_file = get_tmp_filename()
    o = open(command_file, 'w')
    o.write(command_str)
    o.close()
    os.system('R --slave < ' + command_file)
    o = open(out_fp)
    lines = map(str.rstrip ,o.readlines())
    o.close()
    return array([map(float,line.split(',')) for line in lines])
开发者ID:RNAer,项目名称:correlations,代码行数:26,代码来源:null.py


示例12: null_from_data

def null_from_data(data, tpk, Rseed=None):
    """generates null from dirichlet model of data based on row sums
    Inputs:
     tpk - int, total prior knowledge to allow the rdirichlet code. higher 
      tpk will result in the simulated table more closely matching the 
      initial data.
     Rseed - int/None, whether or not to seed R at a given value.
    """
    prior_vals = data.sum(1)
    pvs_str =  'c(%s)' % ','.join(map(str,prior_vals))
    sams_str = data.shape[1] # num cols
    seq_depth = data.sum(0).mean()
    out_fp = get_tmp_filename()
    command_str = COMMAND_STR % (pvs_str, tpk, sams_str, seq_depth, out_fp)
    if Rseed!=None:
        command_str = command_str[:23]+'set.seed('+str(Rseed)+')\n'+\
            command_str[23:]
    command_file = get_tmp_filename()
    
    open(command_file, 'w').write(command_str)
    
    cmd_status, cmd_output = getstatusoutput('R --slave < ' + command_file)
    if cmd_status==32512:
        raise ValueError, 'Most likely you do not have R installed, ' +\
            'which is a dependency for QIIME'
    elif cmd_status==256:	
        raise ValueError, 'Most likely you do not have gtools library ' +\
            'installed in R installed, which is a dependency for QIIME'
                
    lines = map(str.rstrip , open(out_fp).readlines())
    
    return array([map(float,line.split(',')) for line in lines])
开发者ID:DDomogala3,项目名称:qiime,代码行数:32,代码来源:simulate_samples.py


示例13: setUp

    def setUp(self):
        # create the temporary input files
        self.tmp_seq_filepath = get_tmp_filename(prefix="ReferenceRepSetPickerTest_", suffix=".fasta")
        seq_file = open(self.tmp_seq_filepath, "w")
        seq_file.write(dna_seqs)
        seq_file.close()

        self.ref_seq_filepath = get_tmp_filename(prefix="ReferenceRepSetPickerTest_", suffix=".fasta")
        seq_file = open(self.ref_seq_filepath, "w")
        seq_file.write(reference_seqs)
        seq_file.close()

        self.tmp_otu_filepath = get_tmp_filename(prefix="ReferenceRepSetPickerTest_", suffix=".otu")
        otu_file = open(self.tmp_otu_filepath, "w")
        otu_file.write(otus_w_ref)
        otu_file.close()

        self.result_filepath = get_tmp_filename(prefix="ReferenceRepSetPickerTest_", suffix=".fasta")
        otu_file = open(self.result_filepath, "w")
        otu_file.write(otus_w_ref)
        otu_file.close()

        self.files_to_remove = [
            self.tmp_seq_filepath,
            self.tmp_otu_filepath,
            self.ref_seq_filepath,
            self.result_filepath,
        ]

        self.params = {"Algorithm": "first", "ChoiceF": first_id}
开发者ID:Ecogenomics,项目名称:FrankenQIIME,代码行数:30,代码来源:test_pick_rep_set.py


示例14: setUp

    def setUp(self):
        self.infernal_test1_input_fp = get_tmp_filename(
            prefix='InfernalAlignerTests_',suffix='.fasta')
        open(self.infernal_test1_input_fp,'w').write(infernal_test1_input_fasta)

        self.infernal_test1_template_fp = get_tmp_filename(
            prefix='InfernalAlignerTests_',suffix='template.sto')
        open(self.infernal_test1_template_fp,'w').\
         write(infernal_test1_template_stockholm)

        # create temp file names (and touch them so we can reliably 
        # clean them up)
        self.result_fp = get_tmp_filename(
            prefix='InfernalAlignerTests_',suffix='.fasta')
        open(self.result_fp,'w').close()
        
        self.log_fp = get_tmp_filename(
            prefix='InfernalAlignerTests_',suffix='.log')
        open(self.log_fp,'w').close()

        self._paths_to_clean_up = [
            self.infernal_test1_input_fp,
            self.result_fp,
            self.log_fp,
            self.infernal_test1_template_fp,
            ]

        self.infernal_test1_aligner = InfernalAligner({
                'template_filepath': self.infernal_test1_template_fp,
                })
        self.infernal_test1_expected_aln = \
         LoadSeqs(data=infernal_test1_expected_alignment,aligned=Alignment,\
            moltype=DNA)
开发者ID:DDomogala3,项目名称:qiime,代码行数:33,代码来源:test_align_seqs.py


示例15: _create_directory_structure

    def _create_directory_structure(self, correct=True):
        """Creates a directory structure for check_exist_filepaths function

        Returns:
            base_dir: the base directory path
            mapping_fps: a list with the relative paths from base_dir to
                the created mapping files

        If correct=False, it adds one mapping file to the mapping_fps list that
            do not exists
        """
        base_dir = get_tmp_filename(tmp_dir=self.tmp_dir, suffix='')
        mkdir(base_dir)

        self._dirs_to_clean_up.append(base_dir)

        mapping_fps = []
        for i in range(5):
            mapping_fp = get_tmp_filename(tmp_dir='', suffix='.txt')
            mapping_fps.append(mapping_fp)
            path_to_create = join(base_dir, mapping_fp)
            f = open(path_to_create, 'w')
            f.close()
            self._paths_to_clean_up.append(path_to_create)

        if not correct:
            mapping_fps.append(get_tmp_filename(tmp_dir='', suffix='.txt'))

        return base_dir, mapping_fps
开发者ID:josenavas,项目名称:SCGM,代码行数:29,代码来源:test_util.py


示例16: setUp

    def setUp(self):
        """ """
        self.files_to_remove = []
        self.dirs_to_remove = []

        tmp_dir = get_qiime_temp_dir()
        self.test_out = get_tmp_filename(tmp_dir=tmp_dir,
                                         prefix='qiime_parallel_taxonomy_assigner_tests_',
                                         suffix='',
                                         result_constructor=str)
        self.dirs_to_remove.append(self.test_out)
        create_dir(self.test_out)

        self.tmp_seq_filepath = get_tmp_filename(tmp_dir=self.test_out,
            prefix='qiime_parallel_taxonomy_assigner_tests_input',
            suffix='.fasta')
        seq_file = open(self.tmp_seq_filepath, 'w')
        seq_file.write(blast_test_seqs.toFasta())
        seq_file.close()
        self.files_to_remove.append(self.tmp_seq_filepath)

        self.id_to_taxonomy_file = NamedTemporaryFile(
            prefix='qiime_parallel_taxonomy_assigner_tests_id_to_taxonomy',
            suffix='.txt',dir=tmp_dir)
        self.id_to_taxonomy_file.write(blast_id_to_taxonomy)
        self.id_to_taxonomy_file.seek(0)

        self.reference_seqs_file = NamedTemporaryFile(
            prefix='qiime_parallel_taxonomy_assigner_tests_ref_seqs',
            suffix='.fasta',dir=tmp_dir)
        self.reference_seqs_file.write(blast_reference_seqs.toFasta())
        self.reference_seqs_file.seek(0)

        initiate_timeout(60)
开发者ID:DDomogala3,项目名称:qiime,代码行数:34,代码来源:test_assign_taxonomy.py


示例17: test_process_illumina_single_end_read_file_bc_in_seq

    def test_process_illumina_single_end_read_file_bc_in_seq(self):
        """process_illumina_single_end_read_file: functions as expected with bc in seq
        """
        output_seqs_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.fasta')
        output_qual_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.txt')
        read_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.txt')
        
        open(read_fp,'w').write('\n'.join(self.illumina_read3_bc_in_seq))
        self.files_to_remove.append(read_fp)
        
        actual = process_illumina_single_end_read_file(read_fp,output_seqs_fp,
         output_qual_fp,barcode_to_sample_id=self.barcode_to_sample_id4, 
         barcode_length=12,store_unassigned=True,max_bad_run_length=0,
         quality_threshold=1e-5,min_per_read_length=70,rev_comp=False,
         rev_comp_barcode=False,barcode_in_seq=True,
         seq_max_N=0,start_seq_id=0)
        
        self.files_to_remove.append(output_seqs_fp)
        self.files_to_remove.append(output_qual_fp)

        # next_seq_id is returned correctly
        self.assertEqual(actual,2)
        
        # correct seq file is returned
        self.assertEqual([l.strip() for l in list(open(output_seqs_fp))],\
         self.expected_seq_file_bc_in_seq1)
        
        # correct qual file is returned
        self.assertEqual([l.strip() for l in list(open(output_qual_fp))],\
         self.expected_qual_file_bc_in_seq1)
开发者ID:Ecogenomics,项目名称:FrankenQIIME,代码行数:33,代码来源:test_split_libraries_illumina.py


示例18: test_process_illumina_paired_end_read_files3

    def test_process_illumina_paired_end_read_files3(self):
        """process_illumina_paired_end_read_files: functions as expected with seq_max_N
        """
        output_seqs_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.fasta')
        output_qual_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.txt')
        read1_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.txt')
        read2_fp = get_tmp_filename(\
         prefix='ParseIlluminaTests',suffix='.txt')
        
        open(read1_fp,'w').write('\n'.join(self.illumina_read1_seq_N))
        self.files_to_remove.append(read1_fp)
        open(read2_fp,'w').write('\n'.join(self.illumina_read2_seq_N))
        self.files_to_remove.append(read2_fp)
        
        # seq_max_N=2 allows both sequences
        actual = process_illumina_paired_end_read_files(\
         read1_fp,read2_fp,output_seqs_fp,output_qual_fp,\
         barcode_to_sample_id=self.barcode_to_sample_id3,\
         barcode_length=6,rev_comp_barcode=True,\
         store_unassigned=True,max_bad_run_length=0,\
         quality_threshold=1e-5,min_per_read_length=70,\
         start_seq_id=0,seq_max_N=2)
        
        self.files_to_remove.append(output_seqs_fp)
        self.files_to_remove.append(output_qual_fp)
        
        # next_seq_id is returned correctly
        self.assertEqual(actual,2)
        
        # correct seq file is returned
        self.assertEqual([l.strip() for l in list(open(output_seqs_fp))],\
         self.expected_seqs_file3)
        
        # correct qual file is returned
        self.assertEqual([l.strip() for l in list(open(output_qual_fp))],\
         self.expected_qual_file3)

        # Lower seq_max_N returns no results
        actual = process_illumina_paired_end_read_files(\
         read1_fp,read2_fp,output_seqs_fp,output_qual_fp,\
         barcode_to_sample_id=self.barcode_to_sample_id3,\
         barcode_length=6,rev_comp_barcode=True,\
         store_unassigned=True,max_bad_run_length=0,\
         quality_threshold=1e-5,min_per_read_length=70,\
         start_seq_id=0,seq_max_N=0)
        
        # next_seq_id is returned correctly
        self.assertEqual(actual,0)
        
        # correct seq file is returned
        self.assertEqual([l.strip() for l in list(open(output_seqs_fp))],[])
        
        # correct qual file is returned
        self.assertEqual([l.strip() for l in list(open(output_qual_fp))],[])
开发者ID:Ecogenomics,项目名称:FrankenQIIME,代码行数:57,代码来源:test_split_libraries_illumina.py


示例19: setUp

    def setUp(self):
        """Define some test data."""
        self.qiime_config = load_qiime_config()
        self.dirs_to_remove = []

        self.tmp_dir = self.qiime_config['temp_dir'] or '/tmp/'
        if not exists(self.tmp_dir):
            makedirs(self.tmp_dir)
            # if test creates the temp dir, also remove it
            self.dirs_to_remove.append(self.tmp_dir)

        self.otu_table1 = table_factory(data=array([[2, 0, 0, 1],
                                                   [1, 1, 1, 1],
                                                   [0, 0, 0, 0]]).T,
                                        sample_ids=list('XYZ'),
                                        observation_ids=list('abcd'),
                                        constructor=DenseOTUTable)
        self.otu_table1_fp = get_tmp_filename(tmp_dir=self.tmp_dir,
                                              prefix='alpha_diversity_tests',
                                              suffix='.biom',
                                              result_constructor=str)
        open(self.otu_table1_fp, 'w').write(
            format_biom_table(self.otu_table1))

        self.otu_table2 = table_factory(data=array([[2, 0, 0, 1],
                                                   [1, 1, 1, 1],
                                                   [0, 0, 0, 0]]).T,
                                        sample_ids=list('XYZ'),
                                        observation_ids=['a', 'b', 'c', 'd_'],
                                        constructor=DenseOTUTable)
        self.otu_table2_fp = get_tmp_filename(tmp_dir=self.tmp_dir,
                                              prefix='alpha_diversity_tests',
                                              suffix='.biom',
                                              result_constructor=str)
        open(self.otu_table2_fp, 'w').write(
            format_biom_table(self.otu_table2))

        self.single_sample_otu_table = table_factory(
            data=array([[2, 0, 0, 1]]).T,
            sample_ids=list('X'),
            observation_ids=list(
                'abcd'),
            constructor=DenseOTUTable)
        self.single_sample_otu_table_fp = get_tmp_filename(
            tmp_dir=self.tmp_dir,
            prefix='alpha_diversity_tests',
            suffix='.biom',
            result_constructor=str)
        open(self.single_sample_otu_table_fp, 'w').write(
            format_biom_table(self.single_sample_otu_table))

        self.tree1 = parse_newick('((a:2,b:3):2,(c:1,d:2):7);')
        self.tree2 = parse_newick("((a:2,'b':3):2,(c:1,'d_':2):7);")

        self.files_to_remove = [self.otu_table1_fp, self.otu_table2_fp,
                                self.single_sample_otu_table_fp]
开发者ID:TheSchwa,项目名称:qiime,代码行数:56,代码来源:test_alpha_diversity.py


示例20: test_make_html_file

 def test_make_html_file(self):
     """The HTML file is stored in the correct location"""
     # Generate the PCoA output directory
     pcoa_dir = get_tmp_filename(tmp_dir=self.tmp_dir, suffix='')
     self._create_pcoa_output_structure(pcoa_dir)
     # Add the PCoA output to the cleaning paths
     self._dirs_to_clean_up = [pcoa_dir]
     # Perform the test
     html_fp = get_tmp_filename(tmp_dir=self.tmp_dir, suffix='.html')
     make_html_file(pcoa_dir, html_fp)
     self.assertTrue(exists(html_fp))
开发者ID:elisemorrison,项目名称:FastUnifrac,代码行数:11,代码来源:test_make_pcoa_html.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.load_qiime_config函数代码示例发布时间:2022-05-26
下一篇:
Python util.get_qiime_temp_dir函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap