Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ngsclialab/process_scripts
  • astrocyte/workflows/bicf/process_scripts
Show changes
Commits on Source (4)
...@@ -12,7 +12,7 @@ usage() { ...@@ -12,7 +12,7 @@ usage() {
exit 1 exit 1
} }
OPTIND=1 # Reset OPTIND OPTIND=1 # Reset OPTIND
while getopts :r:x:y:p:u:h opt while getopts :r:x:y:p:uh opt
do do
case $opt in case $opt in
r) index_path=$OPTARG;; r) index_path=$OPTARG;;
......
...@@ -34,15 +34,18 @@ if [[ -z $pair_id ]] || [[ -z $fq1 ]]; then ...@@ -34,15 +34,18 @@ if [[ -z $pair_id ]] || [[ -z $fq1 ]]; then
fi fi
source /etc/profile.d/modules.sh source /etc/profile.d/modules.sh
module load samtools/gcc/1.6 picard/2.10.3 module load samtools/1.6 picard/2.10.3
baseDir="`dirname \"$0\"`" baseDir="`dirname \"$0\"`"
if [[ -z $SLURM_CPUS_ON_NODE ]] if [[ -z $SLURM_CPUS_ON_NODE ]]
then then
SLURM_CPUS_ON_NODE=1 SLURM_CPUS_ON_NODE=1
fi fi
diff $fq1 $fq2 > difffile.out
if [ $algo == 'star' ] if [ $algo == 'star' ]
then then
if ($fq1 != $fq2) if (-s difffile)
then then
module load star/2.4.2a module load star/2.4.2a
STAR --genomeDir ${index_path}/star_index/ --readFilesIn $fq1 $fq2 --readFilesCommand zcat --genomeLoad NoSharedMemory --outFilterMismatchNmax 999 --outFilterMismatchNoverReadLmax 0.04 --outFilterMultimapNmax 20 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --outSAMheaderCommentFile COfile.txt --outSAMheaderHD @HD VN:1.4 SO:coordinate --outSAMunmapped Within --outFilterType BySJout --outSAMattributes NH HI AS NM MD --outSAMstrandField intronMotif --outSAMtype BAM SortedByCoordinate --quantMode TranscriptomeSAM --sjdbScore 1 --limitBAMsortRAM 60000000000 --outFileNamePrefix out STAR --genomeDir ${index_path}/star_index/ --readFilesIn $fq1 $fq2 --readFilesCommand zcat --genomeLoad NoSharedMemory --outFilterMismatchNmax 999 --outFilterMismatchNoverReadLmax 0.04 --outFilterMultimapNmax 20 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --outSAMheaderCommentFile COfile.txt --outSAMheaderHD @HD VN:1.4 SO:coordinate --outSAMunmapped Within --outFilterType BySJout --outSAMattributes NH HI AS NM MD --outSAMstrandField intronMotif --outSAMtype BAM SortedByCoordinate --quantMode TranscriptomeSAM --sjdbScore 1 --limitBAMsortRAM 60000000000 --outFileNamePrefix out
...@@ -53,19 +56,20 @@ then ...@@ -53,19 +56,20 @@ then
mv outAligned.sortedByCoord.out.bam output.bam mv outAligned.sortedByCoord.out.bam output.bam
else else
module load hisat2/2.1.0-intel module load hisat2/2.1.0-intel
if [ $fq1 == $fq2 ] if [ -s difffile ]
then then
hisat2 -p $SLURM_CPUS_ON_NODE --rg-id ${pair_id} --rg LB:tx --rg PL:illumina --rg PU:barcode --rg SM:${pair_id} --add-chrname --no-unal --dta -x ${index_path}/hisat_index/genome -1 $fq1 -2 $fq2 -S out.sam --summary-file ${pair_id}.alignerout.txt
else
hisat2 -p $SLURM_CPUS_ON_NODE --rg-id ${pair_id} --rg LB:tx --rg PL:illumina --rg PU:barcode --rg SM:${pair_id} --add-chrname --no-unal --dta -x ${index_path}/hisat_index/genome -U $fq1 -S out.sam --summary-file ${pair_id}.alignerout.txt hisat2 -p $SLURM_CPUS_ON_NODE --rg-id ${pair_id} --rg LB:tx --rg PL:illumina --rg PU:barcode --rg SM:${pair_id} --add-chrname --no-unal --dta -x ${index_path}/hisat_index/genome -U $fq1 -S out.sam --summary-file ${pair_id}.alignerout.txt
fi
if [[ $umi==1 ]]
then
python ${baseDir}/add_umi_sam.py -s out.sam -o output.bam
else else
hisat2 -p $SLURM_CPUS_ON_NODE --rg-id ${pair_id} --rg LB:tx --rg PL:illumina --rg PU:barcode --rg SM:${pair_id} --add-chrname --no-unal --dta -x ${index_path}/hisat_index/genome -1 $fq1 -2 $fq2 -S out.sam --summary-file ${pair_id}.alignerout.txt samtools view -1 --threads $SLURM_CPUS_ON_NODE -o output.bam out.sam
fi fi
samtools view -1 --threads $SLURM_CPUS_ON_NODE -o output.bam out.sam
fi
if [[ $umi==1 ]]
then
python ${baseDir}/add_umi_bam.py -b output.bam -o output.unsort2.bam
mv output.unsort2.bam output.bam
fi fi
samtools sort -@ $SLURM_CPUS_ON_NODE -O BAM -n -o output.nsort.bam output.bam samtools sort -@ $SLURM_CPUS_ON_NODE -O BAM -n -o output.nsort.bam output.bam
java -jar $PICARD/picard.jar FixMateInformation ASSUME_SORTED=TRUE SORT_ORDER=coordinate ADD_MATE_CIGAR=TRUE I=output.nsort.bam O=${pair_id}.bam java -jar $PICARD/picard.jar FixMateInformation ASSUME_SORTED=TRUE SORT_ORDER=coordinate ADD_MATE_CIGAR=TRUE I=output.nsort.bam O=${pair_id}.bam
samtools index -@ $SLURM_CPUS_ON_NODE ${pair_id}.bam samtools index -@ $SLURM_CPUS_ON_NODE ${pair_id}.bam
...@@ -32,13 +32,13 @@ r2base="${fq2%.fastq*}" ...@@ -32,13 +32,13 @@ r2base="${fq2%.fastq*}"
source /etc/profile.d/modules.sh source /etc/profile.d/modules.sh
module load trimgalore/0.4.1 cutadapt/1.9.1 module load trimgalore/0.4.1 cutadapt/1.9.1
if [ $fq1 == $fq2 ] if [ -s $fq2 ]
then then
trim_galore -q 25 --illumina --gzip --length 35 ${fq1}
mv ${r1base}_trimmed.fq.gz ${pair_id}.trim.R1.fastq.gz
cp ${pair_id}.trim.R1.fastq.gz ${pair_id}.trim.R2.fastq.gz
else
trim_galore --paired -q 25 --illumina --gzip --length 35 ${fq1} ${fq2} trim_galore --paired -q 25 --illumina --gzip --length 35 ${fq1} ${fq2}
mv ${r1base}_val_1.fq.gz ${pair_id}.trim.R1.fastq.gz mv ${r1base}_val_1.fq.gz ${pair_id}.trim.R1.fastq.gz
mv ${r2base}_val_2.fq.gz ${pair_id}.trim.R2.fastq.gz mv ${r2base}_val_2.fq.gz ${pair_id}.trim.R2.fastq.gz
else
trim_galore -q 25 --illumina --gzip --length 35 ${fq1}
mv ${r1base}_trimmed.fq.gz ${pair_id}.trim.R1.fastq.gz
cp ${pair_id}.trim.R1.fastq.gz ${pair_id}.trim.R2.fastq.gz
fi fi
...@@ -21,6 +21,8 @@ done ...@@ -21,6 +21,8 @@ done
shift $(($OPTIND -1)) shift $(($OPTIND -1))
index_path='/project/shared/bicf_workflow_ref/GRCh38/clinseq_prj/'
# Check for mandatory options # Check for mandatory options
if [[ -z $pair_id ]] || [[ -z $sbam ]]; then if [[ -z $pair_id ]] || [[ -z $sbam ]]; then
usage usage
...@@ -33,13 +35,13 @@ baseDir="`dirname \"$0\"`" ...@@ -33,13 +35,13 @@ baseDir="`dirname \"$0\"`"
source /etc/profile.d/modules.sh source /etc/profile.d/modules.sh
module load cnvkit/0.9.0 module load cnvkit/0.9.0
cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_targets.bed -o ${pair_id}.targetcoverage.cnn cnvkit.py coverage ${sbam} ${index_path}/UTSWV2.cnvkit_targets.bed -o ${pair_id}.targetcoverage.cnn
cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_antitargets.bed -o ${pair_id}.antitargetcoverage.cnn cnvkit.py coverage ${sbam} ${index_path}/UTSWV2.cnvkit_antitargets.bed -o ${pair_id}.antitargetcoverage.cnn
if [[ $umi == 'umi' ]] if [[ $umi == 'umi' ]]
then then
cnvkit.py fix ${pair_id}.targetcoverage.cnn ${pair_id}.antitargetcoverage.cnn /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.uminormals.cnn -o ${pair_id}.cnr cnvkit.py fix ${pair_id}.targetcoverage.cnn ${pair_id}.antitargetcoverage.cnn ${index_path}/UTSWV2.uminormals.cnn -o ${pair_id}.cnr
else else
cnvkit.py fix ${pair_id}.targetcoverage.cnn ${pair_id}.antitargetcoverage.cnn /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.normals.cnn -o ${pair_id}.cnr cnvkit.py fix ${pair_id}.targetcoverage.cnn ${pair_id}.antitargetcoverage.cnn ${index_path}/UTSWV2.normals.cnn -o ${pair_id}.cnr
fi fi
cnvkit.py segment ${pair_id}.cnr -o ${pair_id}.cns cnvkit.py segment ${pair_id}.cnr -o ${pair_id}.cns
......