Skip to content

Commit

Permalink
release 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
y9c committed Apr 22, 2024
1 parent 550cca0 commit 50f6b86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions cutseq/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self):
self.rcd = False

def __repr__(self):
return f"UnconditionalCutter(length={self.length})"
return "ReverseComplementConverter()"

def __call__(self, read, info):
return read.reverse_complement()
Expand Down Expand Up @@ -256,6 +256,8 @@ def pipeline_single(input1, output1, short1, untrimmed1, barcode, settings):

# step 9: reverse complement the read
if settings.reverse_complement:
if barcode.strand == "+":
logging.warn("Library is + strand, but reverse complement is enabled.")
modifiers.append(ReverseComplementConverter())

inpaths = InputPaths(input1)
Expand All @@ -267,14 +269,16 @@ def pipeline_single(input1, output1, short1, untrimmed1, barcode, settings):
interleaved=False,
)
steps = []
# TODO: report info
# --info-file=info.txt
# PairedSingleEndStep(InfoFileWriter(outfiles.open_text("info.txt"))),
steps.append(
# --info-file=info.txt
# PairedSingleEndStep(InfoFileWriter(outfiles.open_text("info.txt"))),
# -m 10
SingleEndFilter(
TooShort(settings.min_length), outfiles.open_record_writer(short1)
),
)
# TODO: --max-n=0 support
if (
settings.ensure_inline_barcode
and barcode.inline5.len + barcode.inline3.len > 0
Expand All @@ -285,7 +289,6 @@ def pipeline_single(input1, output1, short1, untrimmed1, barcode, settings):
if barcode.inline3.len > 0:
ref_adapters.append(adapter_inline3)
steps.append(
# TODO: --max-n=0 support
SingleEndFilter(
IsUntrimmedAny(ref_adapters),
outfiles.open_record_writer(untrimmed1, interleaved=False),
Expand Down Expand Up @@ -444,6 +447,8 @@ def pipeline_paired(

# step 9: reverse complement the read
if settings.reverse_complement:
if barcode.strand == "+":
logging.warn("Library is + strand, but reverse complement is enabled.")
modifiers.append((ReverseComplementConverter(), ReverseComplementConverter()))

inpaths = InputPaths(input1, input2)
Expand All @@ -465,12 +470,12 @@ def pipeline_paired(
outfiles.open_record_writer(short1, short2, interleaved=False),
)
)
# TODO: --max-n=0 support
if (
settings.ensure_inline_barcode
and barcode.inline5.len + barcode.inline3.len > 0
):
steps.append(
# TODO: --max-n=0 support
PairedEndFilter(
IsUntrimmedAny([adapter_inline5])
if barcode.inline5.len > 0
Expand All @@ -495,7 +500,7 @@ def pipeline_paired(


def run_cutseq(args):
barcode_config = BarcodeConfig(args.adapter_scheme.upper())
barcode_config = BarcodeConfig(args.replace(" ", "").adapter_scheme.upper())
settings = CutadaptConfig()
settings.rname_suffix = args.with_rname_suffix
settings.ensure_inline_barcode = args.ensure_inline_barcode
Expand Down Expand Up @@ -630,6 +635,11 @@ def main():
"-V", "--version", action="version", version=f"%(prog)s {__version__}"
)

# Check if no arguments were provided
if len(sys.argv) == 1:
parser.print_help(sys.stdout)
sys.exit(0)

args = parser.parse_args()

if args.adapter_name is not None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cutseq"
version = "0.0.7"
version = "0.0.8"
description = "Automatically cut adapter / barcode / UMI from NGS data"
authors = ["Ye Chang <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 50f6b86

Please sign in to comment.