diff --git a/alignment/dnaseqalign.sh b/alignment/dnaseqalign.sh index b6a707ddc292f7f704d585ff8c63d3fcd63d87b6..26a546a9bf50d05ca8dea5bd380febbe9e82cfd2 100644 --- a/alignment/dnaseqalign.sh +++ b/alignment/dnaseqalign.sh @@ -41,19 +41,21 @@ module load bwakit/0.7.15 bwa/intel/0.7.15 samtools/1.6 picard/2.10.3 baseDir="`dirname \"$0\"`" -if [[ $fq1 == $fq2 ]] +diff $fq1 $fq2 > difffile + +if [ -s difffile ] then - bwa mem -M -t $SLURM_CPUS_ON_NODE -R "@RG\tID:${pair_id}\tLB:tx\tPL:illumina\tPU:barcode\tSM:${pair_id}" ${index_path}/genome.fa ${fq1} > out.sam -else bwa mem -M -t $SLURM_CPUS_ON_NODE -R "@RG\tID:${pair_id}\tLB:tx\tPL:illumina\tPU:barcode\tSM:${pair_id}" ${index_path}/genome.fa ${fq1} ${fq2} > out.sam +else + bwa mem -M -t $SLURM_CPUS_ON_NODE -R "@RG\tID:${pair_id}\tLB:tx\tPL:illumina\tPU:barcode\tSM:${pair_id}" ${index_path}/genome.fa ${fq1} > out.sam fi if [[ $umi == 'umi' ]] then - k8 /cm/shared/apps/bwakit/0.7.15/bwa-postalt.js -p ${pair_id}.hla ${index_path}/genome.fa.alt out.sam | python ${baseDir}/add_umi_sam.py -s - -o output.unsort.bam + k8 /cm/shared/apps/bwakit/0.7.15/bwa-postalt.js -p tmphla ${index_path}/genome.fa.alt out.sam | python ${baseDir}/add_umi_sam.py -s - -o output.unsort.bam elif [[ $index_path == '/project/shared/bicf_workflow_ref/GRCh38' ]] then - k8 /cm/shared/apps/bwakit/0.7.15/bwa-postalt.js -p ${pair_id}.hla ${index_path}/genome.fa.alt out.sam| samtools view -1 - > output.unsort.bam + k8 /cm/shared/apps/bwakit/0.7.15/bwa-postalt.js -p tmphla ${index_path}/genome.fa.alt out.sam| samtools view -1 - > output.unsort.bam else samtools view -1 -o output.unsort.bam out.sam fi diff --git a/alignment/hisat_genotype.sh b/alignment/hisat_genotype.sh new file mode 100644 index 0000000000000000000000000000000000000000..6e225ebcf6f4ceebecc3a15982d70dc9ef4e9dd1 --- /dev/null +++ b/alignment/hisat_genotype.sh @@ -0,0 +1,52 @@ +#!/bin/bash +#hlatyping.sh + +usage() { + echo "-h Help documentation for dnaseqalign.sh" + echo "-r --Reference Genome: GRCh38 or GRCm38" + echo "-x --FastQ R1" + echo "-y --FastQ R2" + echo "-p --Prefix for output file name" + echo "Example: bash hisat_genotype.sh -p prefix" + exit 1 +} +OPTIND=1 # Reset OPTIND +while getopts :r:x:y:p:uh opt +do + case $opt in + r) index_path=$OPTARG;; + x) fq1=$OPTARG;; + y) fq2=$OPTARG;; + u) umi='umi';; + p) pair_id=$OPTARG;; + h) usage;; + esac +done + +shift $(($OPTIND -1)) + +# Check for mandatory options +if [[ -z $pair_id ]] || [[ -z $index_path ]]; then + usage +fi + +if [[ -z $SLURM_CPUS_ON_NODE ]] +then + SLURM_CPUS_ON_NODE=1 +fi + +source /etc/profile.d/modules.sh +module load hisat-genotype/1.0.1 + +diff $fq1 $fq2 > difffile + +if [ -s difffile ] +then +hisatgenotype_extract_reads.py -p 16 --database-list hla --base /project/shared/bicf_workflow_ref/hisat_genotype_hla/genotype_genome -1 $fq1 -2 $fq2 --out-dir hisatgeno_out +else +hisatgenotype_extract_reads.py -p 16 --database-list hla --base /project/shared/bicf_workflow_ref/hisat_genotype_hla/genotype_genome -U $fq1 --out-dir hisatgeno_out +fi +hisatgenotype_locus_samples.py -p 16 --region-list hla.A,hla.B,hla.C,hla.DQA1,hla.DQB1,hla.DRB1,hla.DPB1 --assembly --read-dir hisatgeno_out --out-dir ${pair_id}.hisat_hla > ${pair_id}.hisat_hla.txt + +tar cf ${pair_id}.hisat_hla.tar ${pair_id}.hisat_hla +gzip ${pair_id}.hisat_hla.tar diff --git a/alignment/rnaseqalign.sh b/alignment/rnaseqalign.sh index 8fea8af45275b03db9cf7c856a35297b94e609b3..dabe9418a1aa9867389b26fa1fcc883650e68928 100644 --- a/alignment/rnaseqalign.sh +++ b/alignment/rnaseqalign.sh @@ -41,7 +41,7 @@ then SLURM_CPUS_ON_NODE=1 fi -diff $fq1 $fq2 > difffile.out +diff $fq1 $fq2 > difffile if [ $algo == 'star' ] then