Update by ialbert on Sat Nov 11 20:58:19 STD 2017 from beep
-set -ueo pipefail
+set -ue
# Get the table of contents.
TOC={{reads.toc}}
@@ -26,14 +26,17 @@ if [ ! -f "$IDX.bwt" ]; then
echo "Building the bwa index for the $TOPN scaffolds."
# Find the largest scaffolds.
- cat $REF | bioawk -c fastx '{ print length($seq), $name }' | sort -k1,1rn | head -$TOPN | cut -f 2 > largest.txt
+ cat $REF | bioawk -c fastx '{ print length($seq), $name }' | sort -k1,1rn | head -${TOPN} | cut -f 2 > largest.txt
# Create a fasta index for the reference.
+ echo "Indexing with samtools."
samtools faidx $REF
# Extract each sequence in turn.
+ echo "Extracting sequences"
readarray -t ITEMS < largest.txt
for ACC in ${ITEMS[@]} ; do
+ echo "Extracting accession $ACC"
samtools faidx $REF $ACC >> $IDX
done
