cutseq 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cutseq
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Automatically cut adapter / barcode / UMI from NGS data
|
|
5
5
|
Home-page: https://github.com/y9c/cutseq
|
|
6
6
|
License: MIT
|
|
@@ -19,5 +19,9 @@ Requires-Dist: cutadapt (>=4.8,<5.0)
|
|
|
19
19
|
Project-URL: Repository, https://github.com/y9c/cutseq
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
#✂️ CutSeq
|
|
23
|
+
|
|
24
|
+
## How to use?
|
|
25
|
+
|
|
26
|
+
`cutseq -a "ACACGACGCTCTTCCGATCTX<XXXAGATCGGAAGAGCACACGTC" test_R1.fq.gz test_R2.fq.gz`
|
|
23
27
|
|
cutseq-0.0.3/README.md
ADDED
|
@@ -159,16 +159,7 @@ def run_cutadapt_PE(
|
|
|
159
159
|
steps.append(
|
|
160
160
|
f"{cutadapt} -q {settings.min_quality} --max-n=0 -m {settings.min_length} --too-short-output={discard1} --too-short-paired-output={discard2} -o {output1} -p {output2} --interleaved -"
|
|
161
161
|
)
|
|
162
|
-
|
|
163
|
-
if settings.dry_run:
|
|
164
|
-
print(
|
|
165
|
-
" |\\\n".join([(" " + s if i > 0 else s) for i, s in enumerate(steps)])
|
|
166
|
-
)
|
|
167
|
-
process = subprocess.run("true", shell=True, capture_output=True)
|
|
168
|
-
else:
|
|
169
|
-
cmd = " | ".join(steps)
|
|
170
|
-
process = subprocess.run(cmd, shell=True, capture_output=True)
|
|
171
|
-
return process.stdout.decode(), process.stderr.decode()
|
|
162
|
+
return steps
|
|
172
163
|
|
|
173
164
|
|
|
174
165
|
def run_cutadapt_SE(input1, output1, discard1, barcode, settings):
|
|
@@ -215,8 +206,11 @@ def run_cutadapt_SE(input1, output1, discard1, barcode, settings):
|
|
|
215
206
|
steps.append(
|
|
216
207
|
f"{cutadapt} -q {settings.min_quality} --max-n=0 -m {settings.min_length} --too-short-output={discard1} -o {output1} -"
|
|
217
208
|
)
|
|
209
|
+
return steps
|
|
218
210
|
|
|
219
|
-
|
|
211
|
+
|
|
212
|
+
def run_steps(steps, dry_run=False):
|
|
213
|
+
if dry_run:
|
|
220
214
|
print(
|
|
221
215
|
" |\\\n".join([(" " + s if i > 0 else s) for i, s in enumerate(steps)])
|
|
222
216
|
)
|
|
@@ -228,7 +222,7 @@ def run_cutadapt_SE(input1, output1, discard1, barcode, settings):
|
|
|
228
222
|
|
|
229
223
|
|
|
230
224
|
def run_cutseq(args):
|
|
231
|
-
barcode_config = BarcodeConfig(args.
|
|
225
|
+
barcode_config = BarcodeConfig(args.adapter_scheme.upper())
|
|
232
226
|
settings = CutadaptConfig()
|
|
233
227
|
if args.with_rname_suffix:
|
|
234
228
|
settings.rname_suffix = True
|
|
@@ -241,7 +235,7 @@ def run_cutseq(args):
|
|
|
241
235
|
settings.dry_run = args.dry_run
|
|
242
236
|
# Example command setup, you'll need to expand this based on your actual requirements
|
|
243
237
|
if len(args.input_file) == 1:
|
|
244
|
-
|
|
238
|
+
steps = run_cutadapt_SE(
|
|
245
239
|
args.input_file[0],
|
|
246
240
|
args.output_file[0],
|
|
247
241
|
args.discard_file[0],
|
|
@@ -249,7 +243,7 @@ def run_cutseq(args):
|
|
|
249
243
|
settings,
|
|
250
244
|
)
|
|
251
245
|
else:
|
|
252
|
-
|
|
246
|
+
steps = run_cutadapt_PE(
|
|
253
247
|
args.input_file[0],
|
|
254
248
|
args.input_file[1],
|
|
255
249
|
args.output_file[0],
|
|
@@ -259,6 +253,8 @@ def run_cutseq(args):
|
|
|
259
253
|
barcode_config,
|
|
260
254
|
settings,
|
|
261
255
|
)
|
|
256
|
+
stdout, stderr = run_steps(steps, settings.dry_run)
|
|
257
|
+
print(stderr, file=sys.stderr)
|
|
262
258
|
print(stdout)
|
|
263
259
|
|
|
264
260
|
|
|
@@ -277,11 +273,11 @@ def main():
|
|
|
277
273
|
# if no output suffix provided it will generate based on the input file name
|
|
278
274
|
parser.add_argument(
|
|
279
275
|
"-a",
|
|
280
|
-
"--adapter",
|
|
276
|
+
"--adapter-scheme",
|
|
281
277
|
type=str,
|
|
282
|
-
required=True,
|
|
283
278
|
help="Adapter sequence configuration.",
|
|
284
279
|
)
|
|
280
|
+
parser.add_argument("-A", "--adapter-name", type=str, help="Built-in adapter name.")
|
|
285
281
|
parser.add_argument(
|
|
286
282
|
"-O",
|
|
287
283
|
"--output-suffix",
|
|
@@ -346,6 +342,25 @@ def main():
|
|
|
346
342
|
)
|
|
347
343
|
args = parser.parse_args()
|
|
348
344
|
|
|
345
|
+
if args.adapter_name is not None:
|
|
346
|
+
if args.adapter_scheme is not None:
|
|
347
|
+
logging.info("Adapter scheme is provided, ignore adapter name.")
|
|
348
|
+
else:
|
|
349
|
+
if args.adapter_name.upper() == "TAKARAV2":
|
|
350
|
+
args.adapter_scheme = "ACACGACGCTCTTCCGATCTX<XXXAGATCGGAAGAGCACACGTC"
|
|
351
|
+
elif args.adapter_name.upper() == "STRANDED":
|
|
352
|
+
args.adapter_scheme = "ACACGACGCTCTTCCGATCTX<XXXAGATCGGAAGAGCACACGTC"
|
|
353
|
+
elif args.adapter_name.upper() == "TAKARAV3":
|
|
354
|
+
args.adapter_scheme = (
|
|
355
|
+
"ACACGACGCTCTTCCGATCTXXX<XXXXXXNNNNNNNNAGATCGGAAGAGCACACGTC"
|
|
356
|
+
)
|
|
357
|
+
else:
|
|
358
|
+
logging.error("Adapter name is not valid.")
|
|
359
|
+
sys.exit(1)
|
|
360
|
+
elif args.adapter_scheme is None:
|
|
361
|
+
logging.error("Adapter scheme or name is required.")
|
|
362
|
+
sys.exit(1)
|
|
363
|
+
|
|
349
364
|
if len(args.input_file) > 2:
|
|
350
365
|
raise ValueError("Input file can not be more than two.")
|
|
351
366
|
|
cutseq-0.0.2/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# CutSeq
|