store_deprecated

Module for dealing with deprecated pickle file storage and retrieval.

Attributes

logger

def _store_chromosome_data_deprecated(name, plusdata, minusdata, tag, notag=False,

Module Contents

store_deprecated.logger
def _store_chromosome_data_deprecated(name, plusdata, minusdata, tag, notag=False,

writer=BNY, otherpath=None):

#with shelve.open(str(path_.joinpath(f’{name_}{BNY}’))) as db: # db[f”{PL}_{name_}”] = plusdata # db[f”{MI}_{name_}”] = minusdata

def store_processed_chrindexes_deprecated(name, chrnam, plusdata, minusdata, tag):

## open existing database dicts if present #with shelve.open(str(path_.joinpath(f”{name_}{BNY}”))) as db: # storedplusdata = db[f”{PL}_{name_}”] # storedminusdata = db[f”{MI}_{name_}”]

def store_processed_chrindexes(name, chrnam, plusdata, minusdata, tag):

“””Binarize chromosomal indexfile tuples for easy access.

namestr

Name for file to be stored.

chrnamstr

Name of chromosome for which data are stored.

plusdataobject

Data for plus strand of chromosome chrnam.

minusdataobject

Data for minus strand of chromosome chrnam.

tagstr

Flag to indicate kind of aligned-reads, TAGUNCOLL or TAGCOLL.

None

Prints message upon completion of function.

“”” path_ = _get_store_path().joinpath(SEGMNTS) name_ = f’{name}_{tag}’ if tag else name name_ = replace_dot(name_) path_ = path_.joinpath(f’{name_}’) name_stored = _get_store_name.format(name_) try: # open existing database dicts if present

with shelve.open(str(path_.joinpath(f”{name_}{BNY}”))) as db:

storedplusdata = db[f”{PL}_{name_}”] storedminusdata = db[f”{MI}_{name_}”]

except KeyError:

storedplusdata = {} storedminusdata = {} pass

try: # add chromosome data to dict, save dict

storedplusdata[chrnam] = plusdata storedminusdata[chrnam] = minusdata with shelve.open(str(path_.joinpath(f”{name_}{BNY}”))) as db:

db[f”{PL}_{name_}”] = storedplusdata db[f”{MI}_{name_}”] = storedminusdata

msg = f”Saved index ‘{name_}{BNY}’ for chr. ‘{chrnam}’.”

except FileNotFoundError:

msg = f”Cannot store data as {name_}{BNY} in folder {path_}.” logging.debug(f”{__name__}.{thisfunc()}:

{msg}”)

raise SystemExit(EXITERR.format(msg))

except KeyError:

msg = “Key Error: No chromosome found, stopping…” logging.debug(f”{__name__}.{thisfunc()}:

{msg}”)

raise SystemExit(EXITERR.format(msg))

print(msg)

def _get_unselected_folderpath_deprecated():

kind_ = UNSPECIFIC.lower() bampath = Path(STOREPATH).joinpath(SAVEBAM) folderpath set(bampath.glob(get_count_folder_pattern(kind_))) if folderpath == None or len(folderpath) == 0:

msg=(f”No bam-files found with:

‘{pattern}’.”)

logging.debug(f”{__name__}.{thisfunc()}:

{msg}”)

return False

# take first item as valid path folderpath = list(folderpath)[0]