Guest User

Untitled

a guest
Oct 16th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. #!/bin/sh
  2. #$ -N runsve
  3. #$ -S /bin/sh
  4. #$ -l h_vmem=4G
  5. #$ -l m_mem_free=4G
  6. #$ -wd /mnt/isilon/conlin_lab/data/wgs/broad/batch1_sept_2018/
  7. #$ -pe smp 16
  8.  
  9. . /etc/profile
  10. module load perl/current
  11. module load sve/current
  12. module load sam-bcf-tools/current
  13.  
  14. # Sample name and indexed reference, assumed to be in WD (change to fit needs):
  15. SAMPLE="sample_name_no_suffix"
  16. REF="reference_name.fa"
  17.  
  18. # Make output dirs for VCFs in WD (structured as future input to FusorSV):
  19. mkdir -p vcfFiles
  20. mkdir -p vcfFiles/$SAMPLE
  21.  
  22. # Structure of CRAM sample dirs on Respublica is currently: $SAMPLE/v1/$SAMPLE.cram; $SAMPLE/v1/$SAMPLE.cram.crai
  23. # Could not get some callers to work properly with CRAM:
  24. samtools view -@16 -b $SAMPLE/v1/$SAMPLE.cram -T $REF > $SAMPLE/v1/$SAMPLE.bam # Already sorted.
  25. samtools index $SAMPLE/v1/$SAMPLE.bam
  26.  
  27. # Three SV callers (GenomeSTRiP not integrated into SVE):
  28. sve call -r $REF -g hg38 $SAMPLE.bam -M4 -t16 -a cnvnator -o vcfFiles/"$SAMPLE"
  29. sve call -r $REF -g hg38 $SAMPLE.bam -M4 -t12 -a lumpy -o vcfFiles/"$SAMPLE"
  30. sve call -r $REF -g hg38 $SAMPLE.bam -M4 -t4 -a delly -o vcfFiles/"$SAMPLE"
  31.  
  32. # Note: still optimizing delly - takes longest in this case.
  33.  
  34.  
  35. # cn.MOPS had issues and my current work-around is to force 1-22,X,Y,M mappings.
  36. # Error message related to creating vector with no reads mapped to it (hence 0 element in vector which creates the error).
  37. # May also have an issue with the naming convention of the particular ref seqs?
  38. # i.e., need to remove reference lines in BAM header containing references with 0 mapped reads and also removing HLA for now.
  39. # Current strategy: remove references not conforming to 1-22,X,Y,M (MT?) from header and non-header lines.
  40.  
  41. # 1. "Fix" header:
  42. samtools view -H $SAMPLE/v1/$SAMPLE.bam > $SAMPLE/v1/$SAMPLE.nohla.header.sam
  43. samtools view -H $SAMPLE/v1/$SAMPLE.bam | grep -w "@HD" > $SAMPLE/v1/$SAMPLE.nohla.header.sam
  44. samtools view -H $SAMPLE/v1/$SAMPLE.bam | grep -w "@PG" $SAMPLE/v1/$SAMPLE.nohla.header >> $SAMPLE/v1/$SAMPLE.nohla.header.sam
  45. for i in {1..22} X Y M; do samtools view -H $SAMPLE/v1/$SAMPLE.bam | grep -w "SN:chr$i"; done >> $SAMPLE/v1/$SAMPLE.nohla.header.sam
  46. samtools view -H $SAMPLE/v1/$SAMPLE.bam | grep -w "@RG" >> $SAMPLE/v1/$SAMPLE.nohla.header.sam
  47.  
  48. # 2. Obtain 1-22,X,Y,M; convert to BAM; run cn.MOPS:
  49. samtools view -@16 $SAMPLE/v1/$SAMPLE.bam >> $SAMPLE/v1/$SAMPLE.nohla.header.sam
  50. samtools view -@16 -b $SAMPLE/v1/$SAMPLE.nohla.header.sam > $SAMPLE/v1/$SAMPLE.nohla.header.bam
  51. samtools index $SAMPLE/v1/$SAMPLE.nohla.header.bam
  52. rm $SAMPLE/v1/$SAMPLE.nohla.header.sam
  53. sve call -r $REF -g hg38 $SAMPLE/v1/$SAMPLE.nohla.header.bam -M4 -t8 -a cnmops -o vcfFiles/"$SAMPLE"
Add Comment
Please, Sign In to add comment