I am trying to figure out a way to remove the limiting factors that Manta says it cannot handle. To quote from the Manta page:
The following limitations exist on the input BAM or CRAM files provided to Manta:
- Alignments cannot have an unknown read sequence (SEQ="*")
- Alignments cannot contain the "=" character in the SEQ field.
- Alignments cannot use the sequence match/mismatch ("="/"X") CIGAR notation RG (read group) tags in the alignment records are ignored -- each file will be treated as representing one sample.
- Alignments with basecall quality values greater than 70 are rejected (these are not supported on the assumption that this indicates an offset error)
Would using a find
statement in this way and then making .bai
files be adequate to remove the limiting factors that Manta has?:
find ${input_dir} -name "*.bam" -type f -exec sh -c 'output_file="${0%.bam}_filtered.bam"; temp_file=$(mktemp); samtools view -h -q 70 "$0" | sed "/^\(@\|[^[:blank:]]\+[[:blank:]]\+4\)/!s/\t[=*]/\t/g" | samtools view -Sb - > "$temp_file"; mv "$temp_file" "$output_file"; samtools index "$output_file"; rm "$0"' {} \;
# Make the .bai files:
for file in ${input_dir}/*.bam; do
samtools index "${file}" "${file%.*}.bai"
done
However, I get the error (repeatedly for all my bam files):
[main_samview] fail to read the header from "-". samtools index: "/path/to/MyBatch1And2/SampleNumber_filtered_filtered_filtered.bam" is in a format that cannot be usefully indexed
I am not sure why I got this error once and then it did not occur again. Why? Or would this not be enough remove the limiting factors (as there are more to be considered or the code is not written correctly) of Manta?