Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def switches(self): if not self.__switches: self.__switches = Switches(self.__connection) return self.__switches
[ "\n Gets the Switches API client.\n\n Returns:\n Switches:\n " ]
Please provide a description of the function:def roles(self): if not self.__roles: self.__roles = Roles(self.__connection) return self.__roles
[ "\n Gets the Roles API client.\n\n Returns:\n Roles:\n " ]
Please provide a description of the function:def switch_types(self): if not self.__switch_types: self.__switch_types = SwitchTypes(self.__connection) return self.__switch_types
[ "\n Gets the SwitchTypes API client.\n\n Returns:\n SwitchTypes:\n " ]
Please provide a description of the function:def logical_switches(self): if not self.__logical_switches: self.__logical_switches = LogicalSwitches(self.__connection) return self.__logical_switches
[ "\n Gets the LogicalSwitches API client.\n\n Returns:\n LogicalSwitches:\n " ]
Please provide a description of the function:def tasks(self): if not self.__tasks: self.__tasks = Tasks(self.__connection) return self.__tasks
[ "\n Gets the Tasks API client.\n\n Returns:\n Tasks:\n " ]
Please provide a description of the function:def enclosure_groups(self): if not self.__enclosure_groups: self.__enclosure_groups = EnclosureGroups(self.__connection) return self.__enclosure_groups
[ "\n Gets the EnclosureGroups API client.\n\n Returns:\n EnclosureGroups:\n " ]
Please provide a description of the function:def logical_enclosures(self): if not self.__logical_enclosures: self.__logical_enclosures = LogicalEnclosures(self.__connection) return self.__logical_enclosures
[ "\n Gets the LogicalEnclosures API client.\n\n Returns:\n LogicalEnclosures:\n " ]
Please provide a description of the function:def metric_streaming(self): if not self.__metric_streaming: self.__metric_streaming = MetricStreaming(self.__connection) return self.__metric_streaming
[ "\n Gets the MetricStreaming API client.\n\n Returns:\n MetricStreaming:\n " ]
Please provide a description of the function:def interconnects(self): if not self.__interconnects: self.__interconnects = Interconnects(self.__connection) return self.__interconnects
[ "\n Gets the Interconnects API client.\n\n Returns:\n Interconnects:\n " ]
Please provide a description of the function:def interconnect_link_topologies(self): if not self.__interconnect_link_topologies: self.__interconnect_link_topologies = InterconnectLinkTopologies(self.__connection) return self.__interconnect_link_topologies
[ "\n Gets the InterconnectLinkTopologies API client.\n\n Returns:\n InterconnectLinkTopologies:\n " ]
Please provide a description of the function:def sas_interconnect_types(self): if not self.__sas_interconnect_types: self.__sas_interconnect_types = SasInterconnectTypes(self.__connection) return self.__sas_interconnect_types
[ "\n Gets the SasInterconnectTypes API client.\n\n Returns:\n SasInterconnectTypes:\n " ]
Please provide a description of the function:def internal_link_sets(self): if not self.__internal_link_sets: self.__internal_link_sets = InternalLinkSets(self.__connection) return self.__internal_link_sets
[ "\n Gets the InternalLinkSets API client.\n\n Returns:\n InternalLinkSets:\n " ]
Please provide a description of the function:def logical_interconnect_groups(self): if not self.__logical_interconnect_groups: self.__logical_interconnect_groups = LogicalInterconnectGroups( self.__connection) return self.__logical_interconnect_groups
[ "\n Gets the LogicalInterconnectGroups API client.\n\n Returns:\n LogicalInterconnectGroups:\n " ]
Please provide a description of the function:def sas_logical_interconnects(self): if not self.__sas_logical_interconnects: self.__sas_logical_interconnects = SasLogicalInterconnects(self.__connection) return self.__sas_logical_interconnects
[ "\n Gets the SasLogicalInterconnects API client.\n\n Returns:\n SasLogicalInterconnects:\n " ]
Please provide a description of the function:def logical_downlinks(self): if not self.__logical_downlinks: self.__logical_downlinks = LogicalDownlinks( self.__connection) return self.__logical_downlinks
[ "\n Gets the LogicalDownlinks API client.\n\n Returns:\n LogicalDownlinks:\n " ]
Please provide a description of the function:def power_devices(self): if not self.__power_devices: self.__power_devices = PowerDevices(self.__connection) return self.__power_devices
[ "\n Gets the PowerDevices API client.\n\n Returns:\n PowerDevices:\n " ]
Please provide a description of the function:def unmanaged_devices(self): if not self.__unmanaged_devices: self.__unmanaged_devices = UnmanagedDevices(self.__connection) return self.__unmanaged_devices
[ "\n Gets the Unmanaged Devices API client.\n\n Returns:\n UnmanagedDevices:\n " ]
Please provide a description of the function:def racks(self): if not self.__racks: self.__racks = Racks(self.__connection) return self.__racks
[ "\n Gets the Racks API client.\n\n Returns:\n Racks:\n " ]
Please provide a description of the function:def san_managers(self): if not self.__san_managers: self.__san_managers = SanManagers(self.__connection) return self.__san_managers
[ "\n Gets the SanManagers API client.\n\n Returns:\n SanManagers:\n " ]
Please provide a description of the function:def endpoints(self): if not self.__endpoints: self.__endpoints = Endpoints(self.__connection) return self.__endpoints
[ "\n Gets the Endpoints API client.\n\n Returns:\n Endpoints:\n " ]
Please provide a description of the function:def storage_systems(self): if not self.__storage_systems: self.__storage_systems = StorageSystems(self.__connection) return self.__storage_systems
[ "\n Gets the StorageSystems API client.\n\n Returns:\n StorageSystems:\n " ]
Please provide a description of the function:def storage_pools(self): if not self.__storage_pools: self.__storage_pools = StoragePools(self.__connection) return self.__storage_pools
[ "\n Gets the StoragePools API client.\n\n Returns:\n StoragePools:\n " ]
Please provide a description of the function:def storage_volume_templates(self): if not self.__storage_volume_templates: self.__storage_volume_templates = StorageVolumeTemplates(self.__connection) return self.__storage_volume_templates
[ "\n Gets the StorageVolumeTemplates API client.\n\n Returns:\n StorageVolumeTemplates:\n " ]
Please provide a description of the function:def storage_volume_attachments(self): if not self.__storage_volume_attachments: self.__storage_volume_attachments = StorageVolumeAttachments(self.__connection) return self.__storage_volume_attachments
[ "\n Gets the StorageVolumeAttachments API client.\n\n Returns:\n StorageVolumeAttachments:\n " ]
Please provide a description of the function:def firmware_drivers(self): if not self.__firmware_drivers: self.__firmware_drivers = FirmwareDrivers(self.__connection) return self.__firmware_drivers
[ "\n Gets the FirmwareDrivers API client.\n\n Returns:\n FirmwareDrivers:\n " ]
Please provide a description of the function:def firmware_bundles(self): if not self.__firmware_bundles: self.__firmware_bundles = FirmwareBundles(self.__connection) return self.__firmware_bundles
[ "\n Gets the FirmwareBundles API client.\n\n Returns:\n FirmwareBundles:\n " ]
Please provide a description of the function:def volumes(self): if not self.__volumes: self.__volumes = Volumes(self.__connection) return self.__volumes
[ "\n Gets the Volumes API client.\n\n Returns:\n Volumes:\n " ]
Please provide a description of the function:def sas_logical_jbod_attachments(self): if not self.__sas_logical_jbod_attachments: self.__sas_logical_jbod_attachments = SasLogicalJbodAttachments(self.__connection) return self.__sas_logical_jbod_attachments
[ "\n Gets the SAS Logical JBOD Attachments client.\n\n Returns:\n SasLogicalJbodAttachments:\n " ]
Please provide a description of the function:def managed_sans(self): if not self.__managed_sans: self.__managed_sans = ManagedSANs(self.__connection) return self.__managed_sans
[ "\n Gets the Managed SANs API client.\n\n Returns:\n ManagedSANs:\n " ]
Please provide a description of the function:def migratable_vc_domains(self): if not self.__migratable_vc_domains: self.__migratable_vc_domains = MigratableVcDomains(self.__connection) return self.__migratable_vc_domains
[ "\n Gets the VC Migration Manager API client.\n\n Returns:\n MigratableVcDomains:\n " ]
Please provide a description of the function:def sas_interconnects(self): if not self.__sas_interconnects: self.__sas_interconnects = SasInterconnects(self.__connection) return self.__sas_interconnects
[ "\n Gets the SAS Interconnects API client.\n\n Returns:\n SasInterconnects:\n " ]
Please provide a description of the function:def sas_logical_interconnect_groups(self): if not self.__sas_logical_interconnect_groups: self.__sas_logical_interconnect_groups = SasLogicalInterconnectGroups(self.__connection) return self.__sas_logical_interconnect_groups
[ "\n Gets the SasLogicalInterconnectGroups API client.\n\n Returns:\n SasLogicalInterconnectGroups:\n " ]
Please provide a description of the function:def drive_enclosures(self): if not self.__drive_enclures: self.__drive_enclures = DriveEnclosures(self.__connection) return self.__drive_enclures
[ "\n Gets the Drive Enclosures API client.\n\n Returns:\n DriveEnclosures:\n " ]
Please provide a description of the function:def sas_logical_jbods(self): if not self.__sas_logical_jbods: self.__sas_logical_jbods = SasLogicalJbods(self.__connection) return self.__sas_logical_jbods
[ "\n Gets the SAS Logical JBODs API client.\n\n Returns:\n SasLogicalJbod:\n " ]
Please provide a description of the function:def labels(self): if not self.__labels: self.__labels = Labels(self.__connection) return self.__labels
[ "\n Gets the Labels API client.\n\n Returns:\n Labels:\n " ]
Please provide a description of the function:def index_resources(self): if not self.__index_resources: self.__index_resources = IndexResources(self.__connection) return self.__index_resources
[ "\n Gets the Index Resources API client.\n\n Returns:\n IndexResources:\n " ]
Please provide a description of the function:def alerts(self): if not self.__alerts: self.__alerts = Alerts(self.__connection) return self.__alerts
[ "\n Gets the Alerts API client.\n\n Returns:\n Alerts:\n " ]
Please provide a description of the function:def events(self): if not self.__events: self.__events = Events(self.__connection) return self.__events
[ "\n Gets the Events API client.\n\n Returns:\n Events:\n " ]
Please provide a description of the function:def os_deployment_servers(self): if not self.__os_deployment_servers: self.__os_deployment_servers = OsDeploymentServers(self.__connection) return self.__os_deployment_servers
[ "\n Gets the Os Deployment Servers API client.\n\n Returns:\n OsDeploymentServers:\n " ]
Please provide a description of the function:def certificate_rabbitmq(self): if not self.__certificate_rabbitmq: self.__certificate_rabbitmq = CertificateRabbitMQ(self.__connection) return self.__certificate_rabbitmq
[ "\n Gets the Certificate RabbitMQ API client.\n\n Returns:\n CertificateRabbitMQ:\n " ]
Please provide a description of the function:def users(self): if not self.__users: self.__users = Users(self.__connection) return self.__users
[ "\n Gets the Users API client.\n\n Returns:\n Users:\n " ]
Please provide a description of the function:def appliance_device_read_community(self): if not self.__appliance_device_read_community: self.__appliance_device_read_community = ApplianceDeviceReadCommunity(self.__connection) return self.__appliance_device_read_community
[ "\n Gets the ApplianceDeviceReadCommunity API client.\n\n Returns:\n ApplianceDeviceReadCommunity:\n " ]
Please provide a description of the function:def appliance_device_snmp_v1_trap_destinations(self): if not self.__appliance_device_snmp_v1_trap_destinations: self.__appliance_device_snmp_v1_trap_destinations = ApplianceDeviceSNMPv1TrapDestinations(self.__connection) return self.__app...
[ "\n Gets the ApplianceDeviceSNMPv1TrapDestinations API client.\n\n Returns:\n ApplianceDeviceSNMPv1TrapDestinations:\n " ]
Please provide a description of the function:def appliance_device_snmp_v3_trap_destinations(self): if not self.__appliance_device_snmp_v3_trap_destinations: self.__appliance_device_snmp_v3_trap_destinations = ApplianceDeviceSNMPv3TrapDestinations(self.__connection) return self.__app...
[ "\n Gets the ApplianceDeviceSNMPv3TrapDestinations API client.\n\n Returns:\n ApplianceDeviceSNMPv3TrapDestinations:\n " ]
Please provide a description of the function:def appliance_device_snmp_v3_users(self): if not self.__appliance_device_snmp_v3_users: self.__appliance_device_snmp_v3_users = ApplianceDeviceSNMPv3Users(self.__connection) return self.__appliance_device_snmp_v3_users
[ "\n Gets the ApplianceDeviceSNMPv3Users API client.\n\n Returns:\n ApplianceDeviceSNMPv3Users:\n " ]
Please provide a description of the function:def appliance_node_information(self): if not self.__appliance_node_information: self.__appliance_node_information = ApplianceNodeInformation(self.__connection) return self.__appliance_node_information
[ "\n Gets the ApplianceNodeInformation API client.\n\n Returns:\n ApplianceNodeInformation:\n " ]
Please provide a description of the function:def appliance_time_and_locale_configuration(self): if not self.__appliance_time_and_locale_configuration: self.__appliance_time_and_locale_configuration = ApplianceTimeAndLocaleConfiguration(self.__connection) return self.__appliance_time...
[ "\n Gets the ApplianceTimeAndLocaleConfiguration API client.\n\n Returns:\n ApplianceTimeAndLocaleConfiguration:\n " ]
Please provide a description of the function:def versions(self): if not self.__versions: self.__versions = Versions(self.__connection) return self.__versions
[ "\n Gets the Version API client.\n\n Returns:\n Version:\n " ]
Please provide a description of the function:def backups(self): if not self.__backups: self.__backups = Backups(self.__connection) return self.__backups
[ "\n Gets the Backup API client.\n\n Returns:\n Backups:\n " ]
Please provide a description of the function:def login_details(self): if not self.__login_details: self.__login_details = LoginDetails(self.__connection) return self.__login_details
[ "\n Gets the login details\n\n Returns:\n List of login details\n " ]
Please provide a description of the function:def licenses(self): if not self.__licenses: self.__licenses = Licenses(self.__connection) return self.__licenses
[ "\n Gets all the licenses\n Returns:\n List of licenses\n " ]
Please provide a description of the function:def create(self, data=None, uri=None, timeout=-1, force=True): if not data: data = {} default_values = self._get_default_values() for key, value in default_values.items(): if not data.get(key): data[ke...
[ "Makes a POST request to create a resource when a request body is required.\n\n Args:\n data: Additional fields can be passed to create the resource.\n uri: Resouce uri\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operatio...
Please provide a description of the function:def update(self, data=None, timeout=-1, force=True): uri = self.data['uri'] resource = deepcopy(self.data) resource.update(data) self.data = self._helper.update(resource, uri, force, timeout) return self
[ "Updates server profile template.\n\n Args:\n data: Data to update the resource.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its completion.\n force: Force ...
Please provide a description of the function:def get_new_profile(self): uri = "{}/new-profile".format(self.data["uri"]) return self._helper.do_get(uri)
[ "\n A profile object will be returned with the configuration based on this template. Specify the profile name and\n server hardware to assign. If template has any fiber channel connection (which is specified as bootable) but no\n boot target was defined, that connection will be instantiated as ...
Please provide a description of the function:def get_transformation(self, server_hardware_type_uri, enclosure_group_uri): query_params = self.TRANSFORMATION_PATH.format(**locals()) uri = "{}{}".format(self.data["uri"], query_params) return self._helper.do_get(uri)
[ "\n Transforms an existing profile template by supplying a new server hardware type and enclosure group or both.\n A profile template will be returned with a new configuration based on the capabilities of the supplied\n server hardware type and/or enclosure group. All configured connections wil...
Please provide a description of the function:def get_available_networks(self, **kwargs): query_string = '&'.join('{}={}'.format(key, value) for key, value in kwargs.items() if value) uri = self.URI + "{}?{}".format("/available-networks", query_string) re...
[ "\n Retrieves the list of Ethernet networks, Fibre Channel networks and network sets that are available\n to a server profile template along with their respective ports. The scopeUris, serverHardwareTypeUri and\n enclosureGroupUri parameters should be specified to get the available networks for...
Please provide a description of the function:def get_all_without_ethernet(self, start=0, count=-1, filter='', sort=''): without_ethernet_client = ResourceClient( self._connection, "/rest/logical-downlinks/withoutEthernet") return without_ethernet_client.get_all(start, count, filter=...
[ "\n Gets a paginated collection of logical downlinks without ethernet. The collection is\n based on optional sorting and filtering and is constrained by start and count parameters.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n ...
Please provide a description of the function:def get_without_ethernet(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/withoutEthernet" return self._client.get(uri)
[ "\n Gets the logical downlink with the specified ID without ethernet.\n\n Args:\n id_or_uri: Can be either the logical downlink id or the logical downlink uri.\n\n Returns:\n dict\n " ]
Please provide a description of the function:def update_firmware(self, firmware_information, force=False): firmware_uri = "{}/firmware".format(self.data["uri"]) result = self._helper.update(firmware_information, firmware_uri, force=force) self.refresh() return result
[ "\n Installs firmware to the member interconnects of a SAS Logical Interconnect.\n\n Args:\n firmware_information: Options to install firmware to a SAS Logical Interconnect.\n force: If sets to true, the operation completes despite any problems with the network connectivy\n ...
Please provide a description of the function:def get_firmware(self): firmware_uri = "{}/firmware".format(self.data["uri"]) return self._helper.do_get(firmware_uri)
[ "\n Gets baseline firmware information for a SAS Logical Interconnect.\n\n Returns:\n dict: SAS Logical Interconnect Firmware.\n " ]
Please provide a description of the function:def update_compliance_all(self, information, timeout=-1): uri = self.URI + "/compliance" result = self._helper.update(information, uri, timeout=timeout) return result
[ "\n Returns SAS Logical Interconnects to a consistent state. The current SAS Logical Interconnect state is\n compared to the associated SAS Logical Interconnect group.\n\n Args:\n information: Can be either the resource ID or URI.\n timeout: Timeout in seconds. Wait for ta...
Please provide a description of the function:def replace_drive_enclosure(self, information): uri = "{}/replaceDriveEnclosure".format(self.data["uri"]) result = self._helper.create(information, uri) self.refresh() return result
[ "\n When a drive enclosure has been physically replaced, initiate the replacement operation that enables the\n new drive enclosure to take over as a replacement for the prior drive enclosure. The request requires\n specification of both the serial numbers of the original drive enclosure and its...
Please provide a description of the function:def update_configuration(self): uri = "{}/configuration".format(self.data["uri"]) result = self._helper.update({}, uri) self.refresh() return result
[ "\n Asynchronously applies or re-applies the SAS Logical Interconnect configuration to all managed interconnects\n of a SAS Logical Interconnect.\n\n Returns:\n dict: SAS Logical Interconnect.\n " ]
Please provide a description of the function:def encode_multipart_formdata(self, fields, files, baseName, verbose=False): BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$' CRLF = '\r\n' content_type = 'multipart/form-data; boundary=%s' % BOUNDARY if verbose is True: prin...
[ "\n Fields is a sequence of (name, value) elements for regular form fields.\n Files is a sequence of (name, filename, value) elements for data\n to be uploaded as files\n\n Returns: (content_type, body) ready for httplib.HTTP instance\n " ]
Please provide a description of the function:def mutationhash(strings, nedit): maxlen = max([len(string) for string in strings]) indexes = generate_idx(maxlen, nedit) muthash = defaultdict(set) for string in strings: muthash[string].update([string]) for x in substitution_set(string,...
[ "\n produce a hash with each key a nedit distance substitution for a set of\n strings. values of the hash is the set of strings the substitution could\n have come from\n " ]
Please provide a description of the function:def substitution_set(string, indexes): strlen = len(string) return {mutate_string(string, x) for x in indexes if valid_substitution(strlen, x)}
[ "\n for a string, return a set of all possible substitutions\n " ]
Please provide a description of the function:def valid_substitution(strlen, index): values = index[0] return all([strlen > i for i in values])
[ "\n skip performing substitutions that are outside the bounds of the string\n " ]
Please provide a description of the function:def generate_idx(maxlen, nedit): ALPHABET = ["A", "C", "G", "T", "N"] indexlists = [] ALPHABETS = [ALPHABET for x in range(nedit)] return list(itertools.product(itertools.combinations(range(maxlen), nedit), *ALPHABETS))
[ "\n generate all possible nedit edits of a string. each item has the form\n ((index1, index2), 'A', 'G') for nedit=2\n index1 will be replaced by 'A', index2 by 'G'\n\n this covers all edits < nedit as well since some of the specified\n substitutions will not change the base\n " ]
Please provide a description of the function:def acgt_match(string): search = re.compile(r'[^ACGT]').search return not bool(search(string))
[ "\n returns True if sting consist of only \"A \"C\" \"G\" \"T\"\n " ]
Please provide a description of the function:def stream_fastq(file_handler): ''' Generator which gives all four lines if a fastq read as one string ''' next_element = '' for i, line in enumerate(file_handler): next_element += line if i % 4 == 3: yield next_element ...
[]
Please provide a description of the function:def read_fastq(filename): if not filename: return itertools.cycle((None,)) if filename == "-": filename_fh = sys.stdin elif filename.endswith('gz'): if is_python3: filename_fh = gzip.open(filename, mode='rt') else:...
[ "\n return a stream of FASTQ entries, handling gzipped and empty files\n " ]
Please provide a description of the function:def write_fastq(filename): if filename: if filename.endswith('gz'): filename_fh = gzip.open(filename, mode='wb') else: filename_fh = open(filename, mode='w') else: filename_fh = None return filename_fh
[ "\n return a handle for FASTQ writing, handling gzipped files\n " ]
Please provide a description of the function:def detect_alignment_annotations(queryalignment, tags=False): annotations = set() for k, v in BARCODEINFO.items(): if tags: if queryalignment.has_tag(v.bamtag): annotations.add(k) else: if v.readprefix in q...
[ "\n detects the annotations present in a SAM file, inspecting either the\n tags or the query names and returns a set of annotations present\n " ]
Please provide a description of the function:def detect_fastq_annotations(fastq_file): annotations = set() queryread = tz.first(read_fastq(fastq_file)) for k, v in BARCODEINFO.items(): if v.readprefix in queryread: annotations.add(k) return annotations
[ "\n detects annotations preesent in a FASTQ file by examining the first read\n " ]
Please provide a description of the function:def construct_transformed_regex(annotations): re_string = '.*' if "cellular" in annotations: re_string += ":CELL_(?P<CB>.*)" if "molecular" in annotations: re_string += ":UMI_(?P<MB>\w*)" if "sample" in annotations: re_string += "...
[ "\n construct a regex that matches possible fields in a transformed file\n annotations is a set of which keys in BARCODEINFO are present in the file\n " ]
Please provide a description of the function:def fastqtransform(transform, fastq1, fastq2, fastq3, fastq4, keep_fastq_tags, separate_cb, demuxed_cb, cores, fastq1out, fastq2out, min_length): ''' Transform input reads to the tagcounts compatible read layout using regular exp...
[]
Please provide a description of the function:def _infer_transform_options(transform): TransformOptions = collections.namedtuple("TransformOptions", ['CB', 'dual_index', 'triple_index', 'MB', 'SB']) CB = False SB = False MB = False dual_index = False...
[ "\n figure out what transform options should be by examining the provided\n regexes for keywords\n " ]
Please provide a description of the function:def _extract_readnum(read_dict): pat = re.compile(r"(?P<readnum>/\d+)$") parts = pat.split(read_dict["name"]) if len(parts) == 3: name, readnum, endofline = parts read_dict["name"] = name read_dict["readnum"] = readnum else: ...
[ "Extract read numbers from old-style fastqs.\n\n Handles read 1 and 2 specifications where naming is\n readname/1 readname/2\n " ]
Please provide a description of the function:def tagcount(sam, out, genemap, output_evidence_table, positional, minevidence, cb_histogram, cb_cutoff, no_scale_evidence, subsample, sparse, parse_tags, gene_tags): ''' Count up evidence for tagged molecules ''' from pysam import Align...
[]
Please provide a description of the function:def fasttagcount(sam, out, genemap, positional, minevidence, cb_histogram, cb_cutoff, subsample, parse_tags, gene_tags, umi_matrix): ''' Count up evidence for tagged molecules, this implementation assumes the alignment file is coordinate sorted ...
[]
Please provide a description of the function:def sparse(csv, sparse): ''' Convert a CSV file to a sparse matrix with rows and column names saved as companion files. ''' import pandas as pd df = pd.read_csv(csv, index_col=0, header=0) pd.Series(df.index).to_csv(sparse + ".rownames", index=False) ...
[]
Please provide a description of the function:def cb_histogram(fastq, umi_histogram): ''' Counts the number of reads for each cellular barcode Expects formatted fastq files. ''' annotations = detect_fastq_annotations(fastq) re_string = construct_transformed_regex(annotations) parser_re = re.comp...
[]
Please provide a description of the function:def get_cb_depth_set(cb_histogram, cb_cutoff): ''' Returns a set of barcodes with a minimum number of reads ''' cb_keep_set = set() if not cb_histogram: return cb_keep_set with read_cbhistogram(cb_histogram) as fh: cb_map = dict(p.strip()...
[]
Please provide a description of the function:def guess_depth_cutoff(cb_histogram): ''' Guesses at an appropriate barcode cutoff ''' with read_cbhistogram(cb_histogram) as fh: cb_vals = [int(p.strip().split()[1]) for p in fh] histo = np.histogram(np.log10(cb_vals), bins=50) vals = histo[0] ...
[]
Please provide a description of the function:def cb_filter(fastq, bc1, bc2, bc3, cores, nedit): ''' Filters reads with non-matching barcodes Expects formatted fastq files. ''' with open_gzipsafe(bc1) as bc1_fh: bc1 = set(cb.strip() for cb in bc1_fh) if bc2: with open_gzipsafe(bc2) a...
[]
Please provide a description of the function:def sb_filter(fastq, bc, cores, nedit): ''' Filters reads with non-matching sample barcodes Expects formatted fastq files. ''' barcodes = set(sb.strip() for sb in bc) if nedit == 0: filter_sb = partial(exact_sample_filter2, barcodes=barcodes) ...
[]
Please provide a description of the function:def mb_filter(fastq, cores): ''' Filters umis with non-ACGT bases Expects formatted fastq files. ''' filter_mb = partial(umi_filter) p = multiprocessing.Pool(cores) chunks = tz.partition_all(10000, read_fastq(fastq)) bigchunks = tz.partition_all(...
[]
Please provide a description of the function:def add_uid(fastq, cores): ''' Adds UID:[samplebc cellbc umi] to readname for umi-tools deduplication Expects formatted fastq files with correct sample and cell barcodes. ''' uids = partial(append_uids) p = multiprocessing.Pool(cores) chunks = tz.pa...
[]
Please provide a description of the function:def kallisto(fastq, out_dir, cb_histogram, cb_cutoff): ''' Convert fastqtransformed file to output format compatible with kallisto. ''' parser_re = re.compile('(.*):CELL_(?<CB>.*):UMI_(?P<UMI>.*)\\n(.*)\\n\\+\\n(.*)\\n') if fastq.endswith('gz'): f...
[]
Please provide a description of the function:def bamtag(sam): ''' Convert a BAM/SAM with fastqtransformed read names to have UMI and cellular barcode tags ''' from pysam import AlignmentFile start_time = time.time() sam_file = open_bamfile(sam) out_file = AlignmentFile("-", "wh", template=...
[]
Please provide a description of the function:def demultiplex_samples(fastq, out_dir, nedit, barcodes): ''' Demultiplex a fastqtransformed FASTQ file into a FASTQ file for each sample. ''' annotations = detect_fastq_annotations(fastq) re_string = construct_transformed_regex(annotations) parser_re...
[]
Please provide a description of the function:def demultiplex_cells(fastq, out_dir, readnumber, prefix, cb_histogram, cb_cutoff): ''' Demultiplex a fastqtransformed FASTQ file into a FASTQ file for each cell. ''' annotations = detect_fastq_annotations(fastq) re_string = constru...
[]
Please provide a description of the function:def subset_bamfile(sam, barcodes): from pysam import AlignmentFile start_time = time.time() sam_file = open_bamfile(sam) out_file = AlignmentFile("-", "wh", template=sam_file) track = sam_file.fetch(until_eof=True) # peek at first alignment to...
[ "\n Subset a SAM/BAM file, keeping only alignments from given\n cellular barcodes\n " ]
Please provide a description of the function:def array_type(data_types, field): from sqlalchemy.dialects import postgresql internal_type = field.base_field.get_internal_type() # currently no support for multi-dimensional arrays if internal_type in data_types and internal_type != 'ArrayField': ...
[ "\n Allows conversion of Django ArrayField to SQLAlchemy Array.\n Takes care of mapping the type of the array element.\n " ]
Please provide a description of the function:def setup_logger(logger, logfile): # noqa # type: (logger, str) -> None global _REGISTERED_LOGGER_HANDLERS logger.setLevel(logging.DEBUG) if is_none_or_empty(logfile): handler = logging.StreamHandler() else: handler = logging.FileHan...
[ "Set up logger" ]
Please provide a description of the function:def set_verbose_logger_handlers(): # noqa # type: (None) -> None global _REGISTERED_LOGGER_HANDLERS formatter = logging.Formatter( '%(asctime)s %(levelname)s %(name)s:%(funcName)s:%(lineno)d ' '%(message)s') formatter.default_msec_format...
[ "Set logger handler formatters to more detail" ]
Please provide a description of the function:def join_thread(thr): # type: (threading.Thread) -> None if on_python2(): while True: thr.join(timeout=1) if not thr.isAlive(): break else: thr.join()
[ "Join a thread\n :type threading.Thread thr: thread to join\n " ]
Please provide a description of the function:def merge_dict(dict1, dict2): # type: (dict, dict) -> dict if not isinstance(dict1, dict) or not isinstance(dict2, dict): raise ValueError('dict1 or dict2 is not a dictionary') result = copy.deepcopy(dict1) for k, v in dict2.items(): if k...
[ "Recursively merge dictionaries: dict2 on to dict1. This differs\n from dict.update() in that values that are dicts are recursively merged.\n Note that only dict value types are merged, not lists, etc.\n\n :param dict dict1: dictionary to merge to\n :param dict dict2: dictionary to merge with\n :rtyp...
Please provide a description of the function:def datetime_from_timestamp(ts, tz=None, as_utc=False): # type: (float, dateutil.tz, bool) -> datetime.datetime if tz is None: tz = dateutil.tz.tzlocal() dt = datetime.datetime.fromtimestamp(ts, tz=tz) if as_utc: return dt.astimezone(tz=d...
[ "Convert a timestamp into datetime with offset\n :param float ts: timestamp\n :param dateutil.tz tz: time zone or local tz if not specified\n :param bool as_utc: convert datetime to UTC\n :rtype: datetime.datetime\n :return: converted timestamp to datetime\n " ]
Please provide a description of the function:def scantree(path): # type: (str) -> os.DirEntry for entry in scandir(path): if entry.is_dir(follow_symlinks=True): # due to python2 compat, cannot use yield from here for t in scantree(entry.path): yield t ...
[ "Recursively scan a directory tree\n :param str path: path to scan\n :rtype: DirEntry\n :return: DirEntry via generator\n " ]