Skip to content

Commit

Permalink
Remove deepBlue support from plotFingerprint, in prep for merging
Browse files Browse the repository at this point in the history
  • Loading branch information
dpryan79 committed Nov 2, 2016
1 parent bd21d82 commit b7dcfdc
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions deeptools/plotFingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import deeptools.countReadsPerBin as countR
from deeptools import parserCommon
import deeptools.deepBlue as db

old_settings = np.seterr(all='ignore')

Expand All @@ -27,10 +26,9 @@ def parse_arguments(args=None):
output_args = get_output_args()
optional_args = get_optional_args()
read_options_parser = parserCommon.read_options()
deepBlue_optional_parser = parserCommon.deepBlueOptionalArgs()
parser = argparse.ArgumentParser(
parents=[required_args, output_args, read_options_parser,
optional_args, deepBlue_optional_parser, parent_parser],
optional_args, parent_parser],
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='This tool samples indexed BAM files '
'and plots a profile of cumulative read coverages for each. '
Expand Down Expand Up @@ -346,32 +344,6 @@ def getExpected(mu):
def main(args=None):
args = process_args(args)

# Preload deepBlue files, which need to then be deleted
deepBlueFiles = []
for idx, fname in enumerate(args.bamfiles):
if db.isDeepBlue(fname):
deepBlueFiles.append([fname, idx])
if len(deepBlueFiles) > 0:
sys.stderr.write("Preloading the following deepBlue files: {}\n".format(",".join([x[0] for x in deepBlueFiles])))
foo = db.deepBlue(deepBlueFiles[0][0], url=args.deepBlueURL, userKey=args.userKey)
regs = db.makeChromTiles(foo)
for x in deepBlueFiles:
x.extend([args, regs])
if len(deepBlueFiles) > 1 and args.numberOfProcessors > 1:
pool = multiprocessing.Pool(args.numberOfProcessors)
res = pool.map_async(db.preloadWrapper, deepBlueFiles).get(9999999)
else:
res = list(map(db.preloadWrapper, deepBlueFiles))

# substitute the file names with the temp files
for (ftuple, r) in zip(deepBlueFiles, res):
if ftuple[1] == 0:
args.bigwig1 = r
else:
args.bigwig2 = r
deepBlueFiles = [[x[0], x[1]] for x in deepBlueFiles]
del regs

cr = countR.CountReadsPerBin(
args.bamfiles,
args.binSize,
Expand Down Expand Up @@ -454,14 +426,6 @@ def main(args=None):
args.outQualityMetrics.write("\n")
args.outQualityMetrics.close()

# Clean up temporary bigWig files, if applicable
if not args.deepBlueKeepTemp:
for k, v in deepBlueFiles:
os.remove(args.bamfiles[v])
else:
for k, v in deepBlueFiles:
print("{} is stored in {}".format(k, args.bamfiles[v]))


if __name__ == "__main__":
main()

0 comments on commit b7dcfdc

Please sign in to comment.