Skip to content

Commit

Permalink
fix RG
Browse files Browse the repository at this point in the history
  • Loading branch information
skoren committed Sep 25, 2024
1 parent e6bb621 commit cf66459
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Snakefiles/7-combineConsensus.sm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ rule combineConsensus:
tigmap = rules.buildPackages.output.tigmap,
scfmap = rules.layoutContigs.output.scfmap,
layout = rules.layoutContigs.output.layout,
ontalns = rules.generateLayoutContigsInputs.output.ontalns,
hificov = rules.verkko.input.hifi5cov,
finished = rules.buildPackages.output.finished,
pathstsv = rules.rukki.output.pathstsv if config['ruk_enable'] == "True" else rules.emptyfile.output,
Expand Down Expand Up @@ -122,7 +123,7 @@ if [ "{params.haveBAM}" = "True" ]; then
echo ""
mem_per_core=\`expr {resources.mem_gb} \/ {threads} | awk '{{if (\$1 < 1) print "1G"; else print \$1"G"}}'\`

{params.SAMTOOLS} merge -f -O bam --reference combined.fasta -@{threads} -u - {params.packbam} | {PYTHON} {VERKKO}/scripts/bam_rename.py ../{input.layout} ../6-layoutContigs/ont-gapfill.txt ../{input.scfmap} ../{input.tigmap} {params.packcns} | {params.SAMTOOLS} sort -m \$mem_per_core -@{threads} -o ../{output.bam}
{params.SAMTOOLS} merge -f -O bam --reference combined.fasta -@{threads} -u - {params.packbam} | {PYTHON} {VERKKO}/scripts/bam_rename.py ../{input.layout} ../{input.ontalns} ../{input.scfmap} ../{input.tigmap} {params.packcns} | {params.SAMTOOLS} sort -m \$mem_per_core -@{threads} -o ../{output.bam}
else
touch ../{output.bam}
fi
Expand Down
5 changes: 3 additions & 2 deletions src/scripts/bam_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
for l in f:
parts = l.strip().split('\t')
if len(parts) > 2:
readtorg[parts[0]] = "LA" if (int(parts[-1]) == 0) else "UL"
readtorg[parts[0]] = "LA" if (int(parts[-1]) == 0 or len(parts) == 3) else "UL"
with open(gap_info) as f:
for l in f:
parts = l.strip().split('\t')
readtorg[parts[0]] = "UL-gap"
if parts[0] in readtorg and readtorg[parts[0]] == "LA":
readtorg[parts[0]] = "UL-gap"

for filename in sys.argv[5:]:
sys.stderr.write("Starting file %s\n"%(filename))
Expand Down

0 comments on commit cf66459

Please sign in to comment.