Commit 03fc3d49 authored by jhoogenboom's avatar jhoogenboom
Browse files

Cleanup and minor enhancements

* BGCorrect and Stuttermark will now exit with an error message if
  more than one input file for the same sample is specified and no
  separate output files are given. Previously these tools would
  just overwrite the output file repeatedly, discarding the output
  of all but the last data file of the sample.
* Removed to main() functions and related stubs from the tools
  because they are not actually runnable directly anyway.
* Added some more help text to some of the tools.
* Doubled the size of the marker name filter input element on the
  HTML visualisations.
parent ce7f34fb
......@@ -9,9 +9,14 @@ per marker. The allele balance is kept within given bounds. If the
highest non-allelic sequence exceeds a given limit, no alleles are
called for this marker. If this happens for multiple markers in one
sample, no alleles are called for this sample at all.
"""
import argparse
The allele list obtained from allelefinder should always be checked
carefully before using it as the input of various other tools operating
on reference samples. These tools rely heavily on the correctness of
this file to do their job. One may use the allelefinder report
(-R/--report output argument) and the blame tool to get a quick overview
of what might be wrong.
"""
from ..lib import pos_int_arg, add_input_output_args, get_input_output_files, \
ensure_sequence_format, get_sample_data, parse_library, \
add_sequence_format_args
......@@ -201,21 +206,3 @@ def run(args):
args.max_noisy, args.stuttermark_column, args.sequence_format,
args.library)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -211,26 +211,9 @@ def run(args):
for tag, infiles, outfile in gen:
# TODO: Aggregate data from all infiles of each sample.
# This tool now only works properly with one infile per sample!
for infile in infiles:
match_profiles(infile, outfile, profiles, library,
args.sequence_format)
if len(infiles) > 1:
raise ValueError(
"multiple input files for sample '%s' specified " % tag)
match_profiles(infiles[0], outfile, profiles, library,
args.sequence_format)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -7,7 +7,6 @@ Compute a profile of recurring background noise for each unique allele
in the database of reference samples. The profiles obtained can be used
by bgcorrect to filter background noise from samples.
"""
import argparse
import sys
import time
import math
......@@ -541,21 +540,3 @@ def run(args):
args.marker, args.homozygotes, args.limit_reads,
args.drop_samples)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -2,9 +2,11 @@
"""
Compute noise ratios for all noise detected in homozygous reference
samples.
"""
import argparse
With this tool, separate data points are produced for each sample, which
can be visualised using "fdstools vis bgraw". Use bghomstats or
bgestimate to compute aggregate statistics on noise instead.
"""
from ..lib import pos_int_arg, add_input_output_args, get_input_output_files,\
add_allele_detection_args, parse_allelelist, parse_library,\
get_sample_data, add_sequence_format_args
......@@ -183,21 +185,3 @@ def run(args):
args.min_sample_pct, args.sequence_format, args.library,
args.marker)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -5,10 +5,11 @@ reference samples (min, max, mean, sample variance).
Compute a profile of recurring background noise for each unique allele
in the database of reference samples. The profiles obtained can be used
by bgcorrect to filter background noise from samples.
by bgcorrect to filter background noise from samples. If many reference
samples are heterozygous (as is usually the case with forensic STR
markers), it is preferable to use bgestimate instead, since it can
handle heterozygous samples as well.
"""
import argparse
from ..lib import pos_int_arg, add_input_output_args, get_input_output_files,\
add_allele_detection_args, parse_allelelist, parse_library,\
get_sample_data, add_sequence_format_args, adjust_stats,\
......@@ -179,21 +180,3 @@ def run(args):
args.min_sample_pct, args.sequence_format, args.library,
args.marker, args.limit_reads, args.drop_samples)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -10,7 +10,9 @@ It is convenient to pipe the output of bgpredict and/or bgestimate
into bgmerge to merge that with an existing file containing background
profiles. Specify '-' as one of the input files to read from stdin
(i.e., read input from a pipe). If only one input file is specified,
'-' is implicitly used as the second input file.
'-' is implicitly used as the second input file. Note that as a result,
in case of conflicting values, the value in the specified input file
will take precedence over the value in the data that was piped in.
Example: fdstools bgpredict ... | fdstools bgmerge old.txt > out.txt
"""
......@@ -105,21 +107,3 @@ def run(args):
merge_profiles(args.infiles, args.outfile, args.cross_tabular,
args.sequence_format, args.library)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -2,6 +2,24 @@
"""
Predict background profiles of new alleles based on a model of stutter
occurrence obtained from stuttermodel.
This tool can be used to compute background noise profiles for alleles
for which no reference samples are available. The profiles are
predicted using a model of stutter occurrence that must have been
created previously using stuttermodel. A list of sequences should be
given; bgpredict will predict a background noise profile for each of the
provided sequences separately. The prediction is based completely on
the provided stutter model.
The predicted background noise profiles obtained from bgpredict can be
combined with the output of bgestimate and/or bghomstats using bgmerge.
It is possible to use an entire forensic case sample as the SEQS input
argument of bgpredict to obtain a predicted background noise profile for
each sequence detected in the sample. When the background noise
profiles thus obtained are combined with those obtained from bgestimate,
bgcorrect may subsequently produce 'cleaner' results if the sample
contained alleles for which no reference samples were available.
"""
import argparse
import sys
......@@ -362,21 +380,3 @@ def run(args):
args.use_all_data, args.cross_tabular, args.min_pct,
args.min_r2, args.sequence_format, args.library)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -160,21 +160,3 @@ def run(args):
args.mode, args.profiles, args.num, args.sequence_format,
args.library, args.marker)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -284,21 +284,3 @@ def run(args):
convert_library(args.infile, args.outfile, args.aliases)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -143,21 +143,3 @@ def run(args):
args.allele_column, args.output_column, library2,
args.reverse_complement)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -446,26 +446,10 @@ def run(args):
for tag, infiles, outfile in gen:
# TODO: Aggregate data from all infiles of each sample.
# This tool now only works properly with one infile per sample!
for infile in infiles:
annotate_alleles(infile, outfile, args.stutter, args.min_reads,
args.min_repeats, args.min_report,
args.column_name, library, args.debug)
if len(infiles) > 1:
raise ValueError(
"multiple input files for sample '%s' specified " % tag)
annotate_alleles(infiles[0], outfile, args.stutter, args.min_reads,
args.min_repeats, args.min_report, args.column_name,
library, args.debug)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
#!/usr/bin/env python
"""
Train a stutter prediction model using homozygous samples.
Train a stutter prediction model using homozygous reference samples.
The model obtained from this tool can be used by bgpredict to predict
background noise profiles of alleles for which no reference samples are
available.
"""
import argparse
import re
......@@ -507,21 +511,3 @@ def run(args):
args.ignore_zeros, args.max_unit_length, args.raw_outfile,
args.marker, args.limit_reads, args.drop_samples)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -280,21 +280,3 @@ def run(args):
args.bar_width, args.padding, args.marker, args.width,
args.log_scale)
#run
def main():
"""
Main entry point.
"""
parser = argparse.ArgumentParser(
description=__doc__)
try:
add_arguments(parser)
run(parser.parse_args())
except OSError as error:
parser.error(error)
#main
if __name__ == "__main__":
main()
......@@ -83,7 +83,7 @@
</tr>
<tr>
<td>Marker name</td>
<td><input type="text" id="markerFilter" size="10" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
<td><input type="text" id="markerFilter" size="20" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
</tr>
</table>
<table class="optiongroup">
......
......@@ -79,7 +79,7 @@
</tr>
<tr>
<td>Marker name</td>
<td><input type="text" id="markerFilter" size="10" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
<td><input type="text" id="markerFilter" size="20" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
</tr>
</table>
<table class="optiongroup">
......
......@@ -83,7 +83,7 @@
</tr>
<tr>
<td>Marker name</td>
<td><input type="text" id="markerFilter" size="10" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
<td><input type="text" id="markerFilter" size="20" title="Supports regular expression syntax: e.g., use '.*' to match anything."></td>
</tr>
</table>
<table class="optiongroup">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment