Skip to content

Commit

Permalink
Merge pull request #232 from databio/dev
Browse files Browse the repository at this point in the history
Release 0.14.4
  • Loading branch information
donaldcampbelljr authored Feb 25, 2025
2 parents 33ad968 + b15f300 commit 7c0e129
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@20.8b1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: psf/black@stable
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.10"]
python-version: ["3.8", "3.13"]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.14.4] -- 2025-02-25
### Changed
- Fixed warnings for Python >3.12
- Updated version of Python to 3.13 in pytests


## [0.14.3] -- 2024-10-02
### Changed
- bump requirements to require pipestat>=0.11.0
Expand Down
2 changes: 1 addition & 1 deletion pypiper/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.14.3"
__version__ = "0.14.4"
4 changes: 2 additions & 2 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2495,8 +2495,8 @@ def _memory_usage(self, pid="self", category="hwm", container=None):
cmd = "docker stats " + container + " --format '{{.MemUsage}}' --no-stream"
mem_use_str = subprocess.check_output(cmd, shell=True).decode()

mem_num = re.findall("[\d\.]+", mem_use_str.split("/")[0])[0]
mem_scale = re.findall("[A-Za-z]+", mem_use_str.split("/")[0])[0]
mem_num = re.findall(r"[\d\.]+", mem_use_str.split("/")[0])[0]
mem_scale = re.findall(r"[A-Za-z]+", mem_use_str.split("/")[0])[0]

mem_num = float(mem_num)
if mem_scale == "GiB":
Expand Down
38 changes: 21 additions & 17 deletions pypiper/ngstk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,8 +1333,8 @@ def topHat_map(self, input_fastq, output_dir, genome, transcriptome, cpus):
return cmd

def picard_mark_duplicates(self, input_bam, output_bam, metrics_file, temp_dir="."):
transient_file = re.sub("\.bam$", "", output_bam) + ".dups.nosort.bam"
output_bam = re.sub("\.bam$", "", output_bam)
transient_file = re.sub(r"\.bam$", "", output_bam) + ".dups.nosort.bam"
output_bam = re.sub(r"\.bam$", "", output_bam)
cmd1 = self.tools.java + " -Xmx" + self.pm.javamem
cmd1 += " -jar `which MarkDuplicates.jar`"
cmd1 += " INPUT={0}".format(input_bam)
Expand Down Expand Up @@ -1374,7 +1374,7 @@ def filter_reads(
Remove duplicates, filter for >Q, remove multiple mapping reads.
For paired-end reads, keep only proper pairs.
"""
nodups = re.sub("\.bam$", "", output_bam) + ".nodups.nofilter.bam"
nodups = re.sub(r"\.bam$", "", output_bam) + ".nodups.nofilter.bam"
cmd1 = (
self.tools.sambamba
+ " markdup -t {0} -r --compression-level=0 {1} {2} 2> {3}".format(
Expand Down Expand Up @@ -1406,7 +1406,7 @@ def shift_reads(self, input_bam, genome, output_bam):
return cmd

def sort_index_bam(self, input_bam, output_bam):
tmp_bam = re.sub("\.bam", ".sorted", input_bam)
tmp_bam = re.sub(r"\.bam", ".sorted", input_bam)
cmd1 = self.tools.samtools + " sort {0} {1}".format(input_bam, tmp_bam)
cmd2 = "mv {0}.bam {1}".format(tmp_bam, output_bam)
cmd3 = self.tools.samtools + " index {0}".format(output_bam)
Expand Down Expand Up @@ -1638,7 +1638,7 @@ def bam_to_bigwig(
# addjust fragment length dependent on read size and real fragment size
# (right now it asssumes 50bp reads with 180bp fragments)
cmds = list()
transient_file = os.path.abspath(re.sub("\.bigWig", "", output_bigwig))
transient_file = os.path.abspath(re.sub(r"\.bigWig", "", output_bigwig))
cmd1 = self.tools.bedtools + " bamtobed -i {0} |".format(input_bam)
if not tagmented:
cmd1 += (
Expand Down Expand Up @@ -2050,39 +2050,41 @@ def parse_bowtie_stats(self, stats_file):
line = [
i for i in range(len(content)) if " reads; of these:" in content[i]
][0]
stats["readCount"] = re.sub("\D.*", "", content[line])
stats["readCount"] = re.sub(r"\D.*", "", content[line])
if 7 > len(content) > 2:
line = [
i
for i in range(len(content))
if "were unpaired; of these:" in content[i]
][0]
stats["unpaired"] = re.sub("\D", "", re.sub("\(.*", "", content[line]))
stats["unpaired"] = re.sub(
r"\D", "", re.sub(r"\(.*", "", content[line])
)
else:
line = [
i
for i in range(len(content))
if "were paired; of these:" in content[i]
][0]
stats["unpaired"] = stats["readCount"] - int(
re.sub("\D", "", re.sub("\(.*", "", content[line]))
re.sub(r"\D", "", re.sub(r"\(.*", "", content[line]))
)
line = [i for i in range(len(content)) if "aligned 0 times" in content[i]][
0
]
stats["unaligned"] = re.sub("\D", "", re.sub("\(.*", "", content[line]))
stats["unaligned"] = re.sub(r"\D", "", re.sub(r"\(.*", "", content[line]))
line = [
i for i in range(len(content)) if "aligned exactly 1 time" in content[i]
][0]
stats["unique"] = re.sub("\D", "", re.sub("\(.*", "", content[line]))
stats["unique"] = re.sub(r"\D", "", re.sub(r"\(.*", "", content[line]))
line = [i for i in range(len(content)) if "aligned >1 times" in content[i]][
0
]
stats["multiple"] = re.sub("\D", "", re.sub("\(.*", "", content[line]))
stats["multiple"] = re.sub(r"\D", "", re.sub(r"\(.*", "", content[line]))
line = [
i for i in range(len(content)) if "overall alignment rate" in content[i]
][0]
stats["alignmentRate"] = re.sub("\%.*", "", content[line]).strip()
stats["alignmentRate"] = re.sub(r"\%.*", "", content[line]).strip()
except IndexError:
pass
return stats
Expand All @@ -2107,22 +2109,24 @@ def parse_duplicate_stats(self, stats_file):
for i in range(len(content))
if "single ends (among them " in content[i]
][0]
series["single-ends"] = re.sub("\D", "", re.sub("\(.*", "", content[line]))
series["single-ends"] = re.sub(
r"\D", "", re.sub(r"\(.*", "", content[line])
)
line = [
i
for i in range(len(content))
if " end pairs... done in " in content[i]
][0]
series["paired-ends"] = re.sub(
"\D", "", re.sub("\.\.\..*", "", content[line])
r"\D", "", re.sub(r"\.\.\..*", "", content[line])
)
line = [
i
for i in range(len(content))
if " duplicates, sorting the list... done in " in content[i]
][0]
series["duplicates"] = re.sub(
"\D", "", re.sub("\.\.\..*", "", content[line])
r"\D", "", re.sub(r"\.\.\..*", "", content[line])
)
except IndexError:
pass
Expand Down Expand Up @@ -2158,7 +2162,7 @@ def get_peak_number(self, sample):
"""
proc = subprocess.Popen(["wc", "-l", sample.peaks], stdout=subprocess.PIPE)
out, err = proc.communicate()
sample["peakNumber"] = re.sub("\D.*", "", out)
sample["peakNumber"] = re.sub(r"\D.*", "", out)
return sample

def get_frip(self, sample):
Expand All @@ -2171,6 +2175,6 @@ def get_frip(self, sample):

with open(sample.frip, "r") as handle:
content = handle.readlines()
reads_in_peaks = int(re.sub("\D", "", content[0]))
reads_in_peaks = int(re.sub(r"\D", "", content[0]))
mapped_reads = sample["readCount"] - sample["unaligned"]
return pd.Series(reads_in_peaks / mapped_reads, index="FRiP")

0 comments on commit 7c0e129

Please sign in to comment.