當前位置: 首頁>>代碼示例>>Python>>正文


Python ProteinGrouper.toHTML方法代碼示例

本文整理匯總了Python中dark.proteins.ProteinGrouper.toHTML方法的典型用法代碼示例。如果您正苦於以下問題:Python ProteinGrouper.toHTML方法的具體用法?Python ProteinGrouper.toHTML怎麽用?Python ProteinGrouper.toHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dark.proteins.ProteinGrouper的用法示例。


在下文中一共展示了ProteinGrouper.toHTML方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testNoFilesToHTML

# 需要導入模塊: from dark.proteins import ProteinGrouper [as 別名]
# 或者: from dark.proteins.ProteinGrouper import toHTML [as 別名]
 def testNoFilesToHTML(self):
     """
     If no files have been given to a protein grouper, its HTML string
     format must as expected.
     """
     pg = ProteinGrouper()
     self.assertEqual(
         '\n'.join([
             '<html>',
             '<head>',
             '<title>',
             '0 viruses found in 0 samples',
             '</title>',
             '</head>',
             '<body>',
             '<style>',
             '            body {',
             '                margin-left: 2%;',
             '                margin-right: 2%;',
             '            }',
             '            .sample {',
             '                margin-bottom: 2px;',
             '            }',
             '            .sample-name {',
             '                color: red;',
             '            }',
             '            .index {',
             '                font-size: small;',
             '            }',
             '            .protein-title {',
             '                font-family: "Courier New", Courier, '
             'monospace;',
             '            }',
             '            .stats {',
             '                font-family: "Courier New", Courier, '
             'monospace;',
             '                white-space: pre;',
             '            }',
             '            .protein-list {',
             '                margin-top: 2px;',
             '            }',
             '</style>',
             '</head>',
             '<body>',
             '<h1>0 viruses found in 0 samples</h1>',
             '<h2>Virus index</h2>',
             '</p>',
             '<h2>Sample index</h2>',
             '</p>',
             '<h1>Viruses by sample</h1>',
             '<h1>Samples by virus</h1>',
             '</body>',
             '</html>',
             ]),
         pg.toHTML())
開發者ID:terrycojones,項目名稱:dark-matter,代碼行數:57,代碼來源:test_proteins.py

示例2: list

# 需要導入模塊: from dark.proteins import ProteinGrouper [as 別名]
# 或者: from dark.proteins.ProteinGrouper import toHTML [as 別名]
        # encountered in https://github.com/acorg/dark-matter/issues/453
        proteinFastaFilenames = list(chain.from_iterable(
            args.proteinFastaFilename))
    else:
        proteinFastaFilenames = None

    grouper = ProteinGrouper(assetDir=args.assetDir,
                             sampleName=args.sampleName,
                             sampleNameRegex=args.sampleNameRegex,
                             format_=args.format,
                             proteinFastaFilenames=proteinFastaFilenames,
                             saveReadLengths=args.showReadLengths)

    if args.filenames:
        filenames = args.filenames
    else:
        filenames = (line[:-1] for line in sys.stdin)

    for filename in filenames:
        with open(filename) as fp:
            grouper.addFile(filename, fp)

    if args.html:
        print(grouper.toHTML(args.pathogenPanelFilename,
                             minProteinFraction=args.minProteinFraction,
                             pathogenType=args.pathogenType,
                             sampleIndexFilename=args.sampleIndexFilename,
                             pathogenIndexFilename=args.pathogenIndexFilename))
    else:
        print(grouper.toStr())
開發者ID:acorg,項目名稱:dark-matter,代碼行數:32,代碼來源:proteins-to-pathogens.py

示例3: group

# 需要導入模塊: from dark.proteins import ProteinGrouper [as 別名]
# 或者: from dark.proteins.ProteinGrouper import toHTML [as 別名]
    parser.add_argument(
        'filenames', nargs='*', help='Sample file names to read input from.')

    parser.add_argument(
        '--sampleNameRegex', default=None,
        help=('An (optional) regular expression that can be used to extract a '
              'short sample name from full sample file name.  The regular '
              'expression must have a matching group (delimited by '
              'parentheses) to capture the part of the file name that should '
              'be used as the sample name.'))

    parser.add_argument(
        '--html', default=False, action='store_true',
        help='If specified, output HTML instead of plain text.')

    args = parser.parse_args()

    grouper = ProteinGrouper(sampleNameRegex=args.sampleNameRegex)

    if args.filenames:
        filenames = args.filenames
    else:
        filenames = (line[:-1] for line in sys.stdin)

    for filename in filenames:
        with open(filename) as fp:
            grouper.addFile(filename, fp)

    print(grouper.toHTML() if args.html else grouper.toStr())
開發者ID:terrycojones,項目名稱:dark-matter,代碼行數:31,代碼來源:proteins-to-viruses.py


注:本文中的dark.proteins.ProteinGrouper.toHTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。