Skip to content

Commit

Permalink
Adjust regex to allow for dragonflye-style contig IDs (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfornika authored Sep 12, 2023
1 parent 112f374 commit 36d8db1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/mob_recon.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ process mob_recon {
--outdir ${sample_id} \
--force
# fix fasta header to put whitespace after contig ID.
# BC23A123A_1_depth=10.0x_circular=true -> BC23A123A_1 depth=10.0x_circular=true
# BC23A123A_contig0001_depth=10.0x_circular=true -> BC23A123A_contig0001 depth=10.0x_circular=true
for assembly in ${sample_id}/*.fasta;
do
sed -i -r 's/^>${sample_id}_([[:digit:]]+)_(.+)/>${sample_id}_\\1 \\2/' \${assembly};
sed -i -r 's/^>${sample_id}_((contig)?[[:digit:]]+)_(.+)/>${sample_id}_\\1 \\3/' \${assembly};
done
rename plasmid ${sample_id}_plasmid ${sample_id}/plasmid*.fasta || true
cp ${sample_id}/${sample_id}_plasmid*.fasta . || true
Expand Down

0 comments on commit 36d8db1

Please sign in to comment.