text
stringlengths 0
828
|
---|
return files"
|
58,"def _parse(self):
|
""""""Parses file contents
|
:return: Tree hierarchy of file
|
""""""
|
with open(self.path, ""rt"") as reader:
|
return ast.parse(reader.read(), filename=self.path)"
|
59,"def _find_package(self, root_package):
|
""""""Finds package name of file
|
:param root_package: root package
|
:return: package name
|
""""""
|
package = self.path.replace(root_package, """")
|
if package.endswith("".py""):
|
package = package[:-3]
|
package = package.replace(os.path.sep, MODULE_SEP)
|
root_package = get_folder_name(root_package)
|
package = root_package + package # add root
|
return package"
|
60,"def _get_instances(self, instance):
|
""""""Finds all instances of instance in tree
|
:param instance: type of object
|
:return: list of objects in tree of same instance
|
""""""
|
return [
|
x
|
for x in self.tree.body
|
if isinstance(x, instance)
|
]"
|
61,"def get_classes(self):
|
""""""Finds classes in file
|
:return: list of top-level classes
|
""""""
|
instances = self._get_instances(ast.ClassDef)
|
instances = [
|
PyClass(instance, self.package)
|
for instance in instances
|
]
|
return instances"
|
62,"def get_functions(self):
|
""""""Finds top-level functions in file
|
:return: list of top-level functions
|
""""""
|
instances = self._get_instances(ast.FunctionDef)
|
instances = [
|
PyFunction(instance, self.package)
|
for instance in instances
|
]
|
return instances"
|
63,"def get_functions(self, include_meta=False):
|
""""""Finds top-level functions in file
|
:param include_meta: whether include meta functions like (__init__)
|
:return: list of top-level functions
|
""""""
|
instances = self._get_instances(ast.FunctionDef)
|
instances = [
|
PyFunction(instance, self.full_package) # fix package name
|
for instance in instances
|
]
|
if not include_meta:
|
instances = [
|
instance # fix package name
|
for instance in instances
|
if not instance.get_name().startswith(""__"")
|
]
|
return instances"
|
64,"def skesa_assemble(self):
|
""""""
|
Run skesa to assemble genomes
|
""""""
|
with progressbar(self.metadata) as bar:
|
for sample in bar:
|
# Initialise the assembly command
|
sample.commands.assemble = str()
|
try:
|
if sample.general.trimmedcorrectedfastqfiles:
|
# If the sample is a pure isolate, assemble it. Otherwise, run the pre-metagenome pipeline
|
try:
|
status = sample.run.Description
|
except AttributeError:
|
status = 'unknown'
|
if status == 'metagenome':
|
self.merge(sample)
|
else:
|
# Set the output directory
|
sample.general.assembly_output = os.path.join(sample.general.outputdirectory,
|
'assembly_output')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.