widget1.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:MMinte 作者: mendessoares 项目源码 文件源码
def workingOTUs(uniqueOTUs,seqs, output):
    '''
    This function takes the outputs of the functions getUniqueOTU() and getSeqs(). It then creates a FASTA file that contains the 16S dRNA sequences for only the OTUs that are listed in the file with the association values between OTUs. This reduces the size of the files to ge used in further analysis in MMinte.


    :param uniqueOTUs: list of OTUs present in the dataset with association information, output of getUniqueOTU()
    :param seqs: set of sequences in a FASTA file where the sequences themselves only take one line and do not span multiple lines
    :param output: FASTA file with only the sequences that are needed for running Widget 2
    :returns output: FASTA file with only the sequences that are needed for running Widget 2

    '''

    cherrypy.log('Finally, we are going to create a FASTA file with only the representative OTUs that we will use in our analysis.')
    cherrypy.log('The full path to the FASTA file created is %s .' %output)

    reprOtusForAnalysis = open(output,'w')
    counter = 0
    for line in seqs:
        for item in uniqueOTUs:
            new_item = '>'+item+' '
            if line.startswith(new_item):
                counter += 1
                print>>reprOtusForAnalysis, line

    reprOtusForAnalysis.close() 


    cherrypy.log("There are a total of %d sequences to BLAST against the local database. The path to this file is %s"%(counter,output))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号