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


Python Helper.extractFromDb方法代码示例

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


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

示例1: getDomainsForSequences

# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import extractFromDb [as 别名]
def getDomainsForSequences(domains, proteomefile):   
    handle = open(proteomefile, "rU")
    result = ''
    accessions = []
    for record in handle.readlines():
        accessions.append(record.split('\n')[0])

    sequences = Helper.extractFromDb(accessions)
    
    for accession in accessions:
        seq = sequences[accession]
        if accession in domains:
            for position in domains[accession]:
                start = position[0]
                end = position[1]
                subseq = seq[start-1:end]
                if len(subseq) > 0:
                    header = ">" + accession + "|" + position[2] + "|start:" + str(start) + "|end:" + str(end) + '\n'
                    result = result + header + subseq + '\n'
                else:
                    print accession, "was shorter than the location of a domain", len(seq), "[", start, end, "]"
        else:
            print accession, "does not have assigned domains"
               
    handle.close()
    return result
开发者ID:expectopatronum,项目名称:orth-scripts,代码行数:28,代码来源:getDomainSequencesForProteome.py

示例2: in

# 需要导入模块: import Helper [as 别名]
# 或者: from Helper import extractFromDb [as 别名]
    except getopt.error, msg:
        print msg
        print "for help use --help"
        sys.exit(2)
    # process options
    for o, a in opts:
        if o in ("-h", "--help"):
            print __doc__
            sys.exit(0)
        if o in ("-o", "--organism"):
            end = rcp.get("Fileendings", "idlistsuffix")
            inputfile = idlistpath+a+end
            outputfile = outpath+a+"Full"+".fasta"

    listin = open(inputfile, 'r')
    idlist = []
    for line in listin.readlines():
        idlist.append(line.split()[0])
    listin.close()

    result = Helper.extractFromDb(idlist)
    outhandle = open(outputfile, 'w')
    for key in result:
        #changed this after mouse, human and drome 0, 20, 30 and 45 were extracted, before that key was the header
        #blastall has problems with ' symbols
        outhandle.write('>' + Helper.retrieveAccessionNumber(key) + '\n' + result[key] + '\n')
    outhandle.close()
        
if __name__ == "__main__":
    main()
开发者ID:expectopatronum,项目名称:orth-scripts,代码行数:32,代码来源:extractSequences.py


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