1 Disbamer

1.1 Design main script ‘disbamer.sh’

Most commands are explained in detail in Techniques Section

Was a read number supplied?

  • $# : Number of arguments passed to bash script
  • We looking for one input only! `-ne 1 : not equal to one


Is samtools loaded

  • Try samtools, output to null, and redirect error to stdout, if we get output then show message.


Extract Read from SAM file.

  • run samtools, use sed to get line requested, and put read in to var bamdata


Get read data fields.

  • Use awk to get fields from bamdata. Bash ‘read’ puts output into variable : seqD


Check sequence field. Secondary alignments don’t hold sequence

  • Sam data only has sequence in primary/supplementary mapped reads.


Using CIGAR calculate length of Reference sequence required

  • Use awk script to calculate. Use bash ‘read’ to assign result. to variable, returns ‘*’ if error


Obtain reference matching sequence for read

  • Send bash variables for ‘region, position and length’ to the awk script; return sequence


Display read alongside Reference with indels marked

  • Send bash variables for ‘cigar, read and reference sequences’ to the awk script for display


1.2 Find Reference alignment length ‘cigtoRefLen.awk’

Using CIGAR calculate length of Reference sequence required


Note: All code is in a BEGIN block, and only operates on passed variable (via –v)

1.3 Obtain reference sequence ‘getrefseq.awk’

Obtain reference matching sequence for read

1.4 Display output ‘viewread.awk’

Display read alongside Reference with indels marked