Skip to content

Commit f526428

Browse files
committed
Add --ancientness_threshold flag
1 parent c2537db commit f526428

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

conf/process.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ process {
128128
//
129129

130130
withName:"BAM_DEAM_BEST" {
131-
ext.args = "only_stats ${params.doublestranded ? 'doublestranded' : ''}"
131+
ext.args = "${params.ancientness_threshold} only_stats ${params.doublestranded ? 'doublestranded' : ''}"
132132
publishDir = [
133133
[
134134
path: "${outdir}/stats",
@@ -173,7 +173,7 @@ process {
173173
pattern: "confidence.tsv",
174174
],
175175
]
176-
ext.args = "${params.doublestranded ? 'doublestranded' : ''}"
176+
ext.args = "${params.ancientness_threshold} ${params.doublestranded ? 'doublestranded' : ''}"
177177
}
178178

179179
withName:"PLOT_DEAM" {

modules/local/bam_deam_stats/resources/usr/bin/bam_deam_stats.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def binomial_ci(x, n, alpha=0.05):
1515
return f"{round(lower*100,1):.1f},{round(upper*100,1):.1f}"
1616

1717

18-
def main(bamfile, positions=3, stats_only=False, doublestranded=False):
18+
def main(bamfile, threshold=threshold, positions=3, stats_only=False, doublestranded=False):
1919
#store all reference bases
2020
all_first = []
2121
all_last = []
@@ -155,9 +155,9 @@ def main(bamfile, positions=3, stats_only=False, doublestranded=False):
155155
try:
156156
test51,test31 = float(p_deam51_95ci.split(',')[0]),float(p_deam31_95ci.split(',')[0])
157157
if test51 and test31:
158-
if test51 > 9.5 or test31 > 9.5:
158+
if test51 > threshold or test31 > threshold:
159159
ancientness = '+'
160-
if test51 > 9.5 and test31 > 9.5:
160+
if test51 > threshold and test31 > threshold:
161161
ancientness = '++'
162162
except ValueError:
163163
pass
@@ -190,10 +190,11 @@ def pprint(var):
190190

191191
if __name__ == "__main__":
192192
bamfile = sys.argv[1]
193+
threshold = float(sys.argv[2])
193194
only_stats = 'only_stats' in sys.argv
194195
doublestranded = 'doublestranded' in sys.argv
195196

196197
# only_stats - dont write deaminated reads to file
197198
# doublestranded - use G>A rates at 5' end instead of C>T as in singlestranded library prep
198199

199-
main(bamfile, stats_only=only_stats, doublestranded=doublestranded)
200+
main(bamfile, threshold=threshold, stats_only=only_stats, doublestranded=doublestranded)

nextflow.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ params {
6262
mapbwa_quality_cutoff = 25 // filter out mapped reads with qualityscore < 25
6363
krakenuniq_min_kmers = 129 // filter out families with < 129 kmers assined
6464
krakenuniq_min_reads = 3 // filter out families with < 3 reads assigned
65+
ancientness_threshold = 9.5 // set the threshold for reporting a family as Ancientness '++' or '+'
6566
reportfilter_percentage = 0.5 // for the 'filtered_report.tsv', Specify FamPercentage threshold
6667
reportfilter_breadth = 0.5 // for the 'filtered_report.tsv', Specify ProportionExpectedBreadth threshold
6768

0 commit comments

Comments
 (0)