本文整理汇总了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())
示例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())
示例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())