Changeset 5838


Ignore:
Timestamp:
Feb 24, 2020, 3:45:46 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #1218: Implement MIPs alignment

Added functions for the novoalign and merge steps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other/pipeline/trunk/mips_functions.sh

    r5836 r5838  
    192192}
    193193
    194 
     194# Align with novoalign
     195# Parameters:
     196#   $1: Prefix of sample (used in output files)
     197#   $2: Prefix for generated files (counter)
     198# Global parameters:
     199#   $NovoAlign: Path to novoalign exectable
     200#   $NovoAlignOptions: Options for novoalign
     201#   $NovoIndex: Path to index file
     202#   $AmpliconsBed: Path to amplicons BED file
     203#   $NovoSort: Path to novosort executable
     204#   $NumThreads: Number of threads to use
     205#   $AlignedBams: For returning paths to aligned BAM files (used for input in the merge step)
     206function novoalign {
     207  local prefix=$1
     208  local n=$2
     209
     210  if [ ! -f tmp/${n}.umi.bam ]; then
     211    return
     212  fi
     213
     214  ./stderrwrap.sh ${NovoAlign} \
     215    -c ${NumThreads} \
     216    ${NovoAlignOptions} \
     217    -d ${NovoIndex} \
     218    --tags MC,ZP \
     219    -i PE ${min_insert}-${max_insert} \
     220    --amplicons ${AmpliconsBed} \
     221    1 out/${prefix}.novo_coverage.bed \
     222    -f tmp/${n}.umi.bam \
     223    > tmp/${n}.nosort.bam \
     224    3> out/${prefix}.novo.log
     225   
     226  ./stderrwrap.sh ${NovoSort} \
     227    -c ${NumThreads} -t . -i \
     228    -o tmp/${n}.novo.bam \
     229    tmp/${n}.nosort.bam \
     230    3> tmp/${n}.sort.log
     231
     232  AlignedBams="${AlignedBams} -INPUT tmp/${n}.novo.bam"
     233}
     234
     235# Merge BAM files
     236# Global parameters:
     237#   $AlignedBams: BAM files to merge (created by 'novoalign')
     238function merge_bam {
     239
     240  ./stdwrap.sh ./picard2 MergeSamFiles \
     241    -SORT_ORDER coordinate -ASSUME_SORTED true \
     242    ${AlignedBams} \
     243    -OUTPUT tmp/novo.bam \
     244    > mergebam.out
     245}
     246
Note: See TracChangeset for help on using the changeset viewer.