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


Python SearchIO.convert方法代码示例

本文整理汇总了Python中Bio.SearchIO.convert方法的典型用法代码示例。如果您正苦于以下问题:Python SearchIO.convert方法的具体用法?Python SearchIO.convert怎么用?Python SearchIO.convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bio.SearchIO的用法示例。


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

示例1: main

# 需要导入模块: from Bio import SearchIO [as 别名]
# 或者: from Bio.SearchIO import convert [as 别名]
def main():
    extensions = {'blast-tab': ['tsv', 'csv', 'blast', 'm8', 'blastm8'],
        'blast-text': ['txt', 'bls', 'blast'], 'blast-xml': ['xml'],
        'blat-psl': ['psl'], 'hmmer3-tab': ['tsv', 'csv'],
        'hmmer3-text': ['txt'], 'hmmer2-text': ['txt'],
        'exonerate-text': ['txt']}
    kwargs = args.keywords
    infile = args.infile
    in_type = args.in_type
    in_ext = infile.split('.')[-1]
    proper_ext = extensions[in_type][0]
    if in_ext not in extensions[in_type]:
        print(textwrap.fill("error: invalid input file extension \"{}\". An "
            "appropriate extension for this input type is {}"
            .format(in_ext, proper_ext), 79))
        sys.exit(1)

    out_type = args.out_type
    if args.output:
        outfile = io_check(args.output, 'w')
    else:
        out_ext = extensions[out_type][0]
        outfile = io_check("{}.{}".format('.'.join(infile.split('.')[:-1]), out_ext), 'w')

    print("output will be in {} and formatted as {}".format(outfile, out_type))
    SearchIO.convert(infile, in_type, outfile, out_type, out_kwargs=kwargs)
开发者ID:Brazelton-Lab,项目名称:lab_scripts,代码行数:28,代码来源:convert_query_format.py

示例2: main

# 需要导入模块: from Bio import SearchIO [as 别名]
# 或者: from Bio.SearchIO import convert [as 别名]
def main(args):
	if len(args) == 2:
		filenameRoot = args[1].split(".")[0]
		filenameXML = filenameRoot + ".xml"
		SearchIO.convert(args[1], 'blast-tab', filenameXML, 'blast-xml')

	elif len(args) == 3:
		filenameRoot = args[1].split(".")[0]
		filenameXML = args[2]
		SearchIO.convert(args[1], 'blast-tab', filenameXML, 'blast-xml')

	else:
		print("Usage: path/to/blast/tabular/file [optional path/for/new/blast/xml/file]")
开发者ID:Rinoahu,项目名称:MICA,代码行数:15,代码来源:convert-blastTab-to-blastXML.py

示例3: parse_ListProteins

# 需要导入模块: from Bio import SearchIO [as 别名]
# 或者: from Bio.SearchIO import convert [as 别名]
    def parse_ListProteins(self):
            
            f=open("proteins.html","w")
            texto=[]
            texto.append('<!DOCTYPE html>\n')
            texto.append('<html>\n')
            texto.append('<head><title>Proteinas</title><link rel="stylesheet" href="mystyles.css"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>\n')
            texto.append("<body>")
            texto.append('<div id="header">\n')
            texto.append('<H1>Lista de Proteinas</H1>')
            texto.append('</div>')
    

           
			 
            texto.append("<div>")
            texto.append("<table border=\"1\" style=\"width:100%\">")   
            texto.append("<tr><th>Assession Number</th><th>Locus Tag</th><th>Name</th><th>EC Number </th><th>Status</th></tr>")
           
          
          
           
            for file in glob.glob("Uniprot\\*.txt"):
                    fileBlast=("Blasts\\"+file.split('\\')[1].split('txt')[0][:-1]+".xml")
                    print("Teste1"+fileBlast)
                    SearchIO.convert(fileBlast, 'blast-xml', fileBlast[:-4]+'.tab', 'blast-tab', out_kwargs={'comments': False})                    
                    lista=self.parse_table(fileBlast[:-4]+'.tab')
                 
                    if lista[4] == None:
                        lista[4]="NA"
                    texto.append('<tr><td><p><a href=\"'+fileBlast[:-4]+'.html\">'+lista[0]+"</a></p></td><td>"+str(lista[1])+"</td><td>"+lista[3]+'</td><td><p><a href=\"keggs_new.html\">'+lista[4]+'</a></p></td><td>'+lista[2]+'</td></tr>\n')
              
               
                   
            texto.append("</table>\n") 
            texto.append("</div>") 
            texto.append("</body></html>")
            f.writelines(texto)
            f.close()
            return None
开发者ID:Grupo4Bioinformatica,项目名称:TrabBIOV0.8,代码行数:42,代码来源:Web.py

示例4: cria_html

# 需要导入模块: from Bio import SearchIO [as 别名]
# 或者: from Bio.SearchIO import convert [as 别名]
 def cria_html(self):
         
         
         self.conteudo.append('<!DOCTYPE html>\n')
         self.conteudo.append('<html>\n')
         self.conteudo.append('<head><title>UMBioBlastTool</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>\n')
         self.conteudo.append('<style>')
         self.conteudo.append('body{ background-image: url("'+ str(self.background) +'");background-repeat: repeat;}</style>')            
         self.conteudo.append('<hr>\n')            
         self.conteudo.append('<body>\n')
         self.conteudo.append('<div>\n')
         self.conteudo.append('<h1>'+str(self.titulo)+'</h1>\n')
         self.conteudo.append('<hr>\n') 
         self.conteudo.append('<h2>GRUPO 4</h2>\n')
         self.conteudo.append('<p>\n')
         self.conteudo.append('Tiago Manuel Martinho Barbosa PG 19641 MBIO </br>\n')        
         self.conteudo.append('David Miguel Alves A53791 MIEI </br>\n')     
         self.conteudo.append('Pedro Duarte Cardoso Lopes A32652 MIEI </br>')  
         self.conteudo.append('Augusto Daniel Teixeira Moreira PG30381 MBIO</br>')  
         self.conteudo.append('</p>\n')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('<div>')
         """
         self.conteudo.append('<h3>Abstract</h3>\n')    
         self.conteudo.append('<?php\n')
         self.conteudo.append('echo file_get_contents("abstract.txt");')
         self.conteudo.append('?>')
         self.conteudo.append('<hr>\n') 
         """
         self.conteudo.append('<h3>Context</h3>\n') 
         self.conteudo.append('<?php\n')
         self.conteudo.append('echo file_get_contents("contexto.txt");')
         
         self.conteudo.append('?>')
         self.conteudo.append('</div>\n')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('<h2><i>Treponema pallidum pallidum st.Nichols str</i></h2>\n') 
         self.conteudo.append('<h3>Genome Zone: 381901 - 501800</h3>\n')
         
         self.conteudo.append('</div>\n')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('<div style=\"float:top;margin:10px;border:5px solid #E0E0E0;padding: 10px 10px 10px 1px;\">\n')
         self.conteudo.append('<p><a href=\"arvore.html"><h1>Locus Phylogenetic Tree</h1></a></p>\n')
         self.conteudo.append('<p><a href=\"keggs_new.html"><h1>Kegg Results</h1></a></p>\n')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('</div>')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('<hr>\n')
         self.conteudo.append('<h3>Interest Proteins</h3>\n')
         self.conteudo.append('<div style=\"width: 400px;float:left;margin:10px;border: 5px solid #E0E0E0;padding: 10px 10px 10px 10px;\">\n')            
         self.conteudo.append('<h3> Hypothetical Proteins: </h3>\n')            
        
        # cria links para as hipoteticas
         self.conteudo.append("<ul>\n")
         for file in glob.glob("Blasts\\Hypothetical\\*.xml"):
                 SearchIO.convert(file, 'blast-xml', file[:-4]+'.tab', 'blast-tab', out_kwargs={'comments': False})                    
                 self.parse_table(file[:-4]+'.tab')
                 #gene=self.protgene.get(os.path.basename(file)[:-4])
                 self.conteudo.append('<li><p><a href=\"'+file[:-4]+'.html\">'+os.path.basename(file)[:-4]+'</a></p></li>\n') #''.join(gene)
         self.conteudo.append("</ul>\n")
         
         self.conteudo.append('</div>')
         self.conteudo.append('<div style=\"width: 400px;float:left;margin:10px;border: 5px solid #E0E0E0;padding: 10px 10px 10px 1px;\">\n')
        
          # cria links para as nao hipoteticas
         self.conteudo.append('<h3> Non Hypothetical Proteins: </h3>\n')  
         self.conteudo.append("<ul>\n")
         for file in glob.glob("Blasts\\Not_Hypothetical\\*.xml"):
                 SearchIO.convert(file, 'blast-xml', file[:-4]+'.tab', 'blast-tab', out_kwargs={'comments': False})
                 self.parse_table(file[:-4]+'.tab')
                 #gene=self.protgene.get(os.path.basename(file)[:-4])
                 self.conteudo.append('<li><p><a href=\"'+file[:-4]+'.html\">'+os.path.basename(file)[:-4]+'</a></p></li>\n')
         self.conteudo.append("</ul>\n")        
         self.conteudo.append("</div>\n")
         self.conteudo.append('</body>\n')
         self.conteudo.append('</html>\n')
         return None
开发者ID:Grupo4Bioinformatica,项目名称:TrabalhoLaboratoriosBioinf,代码行数:79,代码来源:Web.py


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