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