Skip to content

Commit 1e8912f

Browse files
authored
1.6.2 PR [closes #160] (#161)
* Add linearise ref option * linearise fasta in validator * triple quotes around awk * escape newlines * add space after awk * Fix the awk * remove the awkward awk solution * 1.6.2 version bump
1 parent 0bfb1c6 commit 1e8912f

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

artic/fasta_header.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ def fasta_header(args):
55
with open(args.filename) as fh:
66
rec = list(SeqIO.parse(fh, "fasta"))
77

8+
fasta_format = "fasta-2line" if args.linearise_fasta else "fasta"
9+
810
with open(args.filename, "w") as fh:
911
for record in rec:
1012
chrom = record.id
1113
record.id = f"{args.samplename}/{chrom}/ARTIC/{args.caller}"
1214

13-
SeqIO.write(record, fh, "fasta")
15+
SeqIO.write(record, fh, fasta_format)
1416

1517

1618
def main():
@@ -22,6 +24,7 @@ def main():
2224
parser.add_argument("filename")
2325
parser.add_argument("samplename")
2426
parser.add_argument("caller")
27+
parser.add_argument("--linearise-fasta", action="store_true")
2528

2629
args = parser.parse_args()
2730
fasta_header(args)

artic/minion.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def run(parser, args):
126126
## create a holder to keep the pipeline commands in
127127
cmds = []
128128

129-
# 2) check the reference fasta has and index and create one if not
129+
# 2) check the reference fasta has an index and create one if not
130130
if not os.path.exists("%s.fai" % (ref)):
131131
cmds.append("samtools faidx %s" % (ref))
132132

@@ -234,8 +234,9 @@ def run(parser, args):
234234

235235
# 11) apply the header to the consensus sequence and run alignment against the reference sequence
236236
caller = "clair3"
237+
linearise_fasta = "--linearise-fasta" if args.linearise_fasta else ""
237238
cmds.append(
238-
f"artic_fasta_header {args.sample}.consensus.fasta {args.sample} {caller}"
239+
f"artic_fasta_header {linearise_fasta} {args.sample}.consensus.fasta {args.sample} {caller}"
239240
)
240241

241242
if args.align_consensus:

artic/pipeline.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ def init_pipeline_parser():
176176
action="store_true",
177177
help="Run a mafft alignment of consensus to reference after generation",
178178
)
179+
parser_minion.add_argument(
180+
"--linearise-fasta",
181+
action="store_true",
182+
help="Output linearised (unwrapped) FASTA consensus files",
183+
)
179184
parser_minion.add_argument("--dry-run", action="store_true")
180185
parser_minion.set_defaults(func=run_subtool)
181186

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = artic
3-
version = 1.6.1
3+
version = 1.6.2
44
author = Nick Loman
55
author_email = [email protected]
66
maintainer = Sam Wilkinson

tests/minion_validator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def genCommand(sampleID, workflow):
179179
"minion",
180180
"--threads",
181181
"2",
182+
"--linearise-fasta",
182183
"--read-file",
183184
dataDir + sampleID + "/" + sampleID + ".fastq",
184185
"--scheme-directory",

0 commit comments

Comments
 (0)