Skip to content
Snippets Groups Projects
Verified Commit 4c5c8034 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

add line number check for subsample and split

parent 8fd09836
No related branches found
No related tags found
No related merge requests found
......@@ -9,3 +9,10 @@ src/mergekmer
.Rhistory
.Rprofile
.kmer-diff.Rproj
.Rbuildignore
doc/2023_09_18_presentation.html
doc/2023_09_18_presentation_files/
doc/presentation_files/
fail.txt
kmer-diff.Rproj
src/plot_counts.Rmd
......@@ -120,10 +120,18 @@ process SAMPLE_READS {
error "SEQTK/SAMPLE must have a sample_size value included"
}
"""
if [\$(cat $sample_size | tr -d '\\n') -eq \$(cat $read_number | tr -d '\\n')]; then
SAMPLE_SIZE=\$((cat $sample_size | tr -d '\\n'))
CURRENT_READ_NUMBER=\$((cat $read_number | tr -d '\\n'))
if [\$SAMPLE_SIZE -eq \$CURRENT_READ_NUMBER]; then
ln -s ${reads} sample_${reads}
READ_NUMBER=\$((cat $sample_size | tr -d '\\n'))
else
zcat ${reads} | head -n \$(cat $sample_size | tr -d '\\n') | gzip -c > sample_${reads}
zcat ${reads} | head -n \$((cat $sample_size | tr -d '\\n')) | gzip -c > sample_${reads}
READ_NUMBER=\$((zcat sample_${reads} | wc -l))
fi
if [\$SAMPLE_SIZE -ne \$READ_NUMBER]; then
exit 1
fi
cat <<-END_VERSIONS > versions.yml
......
......@@ -16,6 +16,9 @@ process SPLIT {
"""
zcat ${fastq} | split -l 4000000 - ${fastq.simpleName}_
ls -l ${fastq.simpleName}_* | \\
awk '{system("if [\$((wc -l "\$9")) -ne 4000000]; then exit 1; fi")}'
ls -l ${fastq.simpleName}_* | \\
awk '{system("gzip -c "\$9" > "\$9".fastq.gz && rm "\$9)}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment