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


Python ProteinGrouper.toStr方法代码示例

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


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

示例1: testNoFilesToStr

# 需要导入模块: from dark.proteins import ProteinGrouper [as 别名]
# 或者: from dark.proteins.ProteinGrouper import toStr [as 别名]
 def testNoFilesToStr(self):
     """
     If no files have been given to a protein grouper, its text string
     format must as expected.
     """
     pg = ProteinGrouper()
     self.assertEqual('0 viruses found in 0 samples\n', pg.toStr())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:9,代码来源:test_proteins.py

示例2: testNoFilesToStr

# 需要导入模块: from dark.proteins import ProteinGrouper [as 别名]
# 或者: from dark.proteins.ProteinGrouper import toStr [as 别名]
 def testNoFilesToStr(self):
     """
     If no files have been given to a protein grouper, its text string
     format must as expected.
     """
     pg = ProteinGrouper()
     self.assertEqual(
         'Overall, proteins from 0 pathogens were found in 0 samples.\n',
         pg.toStr())
开发者ID:bamueh,项目名称:dark-matter,代码行数:11,代码来源:test_proteins.py

示例3: testOneLineInOneFileToStr

# 需要导入模块: from dark.proteins import ProteinGrouper [as 别名]
# 或者: from dark.proteins.ProteinGrouper import toStr [as 别名]
 def testOneLineInOneFileToStr(self):
     """
     If a protein grouper is given one file with one line, its toStr method
     must produce the expected result.
     """
     fp = StringIO(
         '0.77 46.6 48.1 5 6 74 gi|32|X|I4 protein X [HBV]\n')
     pg = ProteinGrouper()
     pg.addFile('sample-filename', fp)
     self.assertEqual(
         '1 virus found in 1 sample\n'
         '\n'
         'HBV (in 1 sample)\n'
         '  sample-filename (1 protein, 5 reads)\n'
         '    0.77\t46.60\t48.10\t   5\t   6\t  0\tgi|32|X|I4 protein X\n',
         pg.toStr())
开发者ID:terrycojones,项目名称:dark-matter,代码行数:18,代码来源:test_proteins.py

示例4: list

# 需要导入模块: from dark.proteins import ProteinGrouper [as 别名]
# 或者: from dark.proteins.ProteinGrouper import toStr [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

示例5: group

# 需要导入模块: from dark.proteins import ProteinGrouper [as 别名]
# 或者: from dark.proteins.ProteinGrouper import toStr [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.toStr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。