Skip to content

Commit

Permalink
added griffin
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwong90 committed Jun 30, 2023
1 parent eaa6ef4 commit f7b91f9
Show file tree
Hide file tree
Showing 20 changed files with 3,289 additions and 0 deletions.
71 changes: 71 additions & 0 deletions griffin/runners/GC_correction.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

griffin=/cluster/projects/pughlab/bin/Griffin/v0.2.0
basedir=/cluster/projects/pughlab/projects/CHARM/LFS/griffin2
ref=/cluster/projects/pughlab/references/TGL/hg38/hg38_random.fa
input=/cluster/projects/pughlab/external_data/TGL49_CHARM/LFS/LFS_WG/bams
outdir=$basedir/output/GC_correction
shdir=$basedir/sh_scripts/GC_correction

mkdir -p $outdir
mkdir -p $shdir
mkdir -p $outdir/mappability_bias
mkdir -p $outdir/mappability_plots
mkdir -p $outdir/tmp

cd $input
ls *bam > $shdir/bams

cd $shdir
sed 's/....$//' bams > bam
mv bam bams

for bam in $(cat bams);do

name=${bam:0:25}
echo $bam
echo $name

mkdir -p $outdir/tmp/$name

echo -e "#!/bin/bash
source activate base
conda activate griffin2" > $shdir/${name}.sh

echo -e "$griffin/scripts/griffin_mappability_correction.py \
--bam_file $input/${bam}.bam \
--bam_file_name $name \
--output $outdir/mappability_bias/${name}.mappability_bias.txt \
--output_plot $outdir/mappability_plots/${name}.mappability_bias.pdf \
--mappability $griffin/Ref/k50.Umap.MultiTrackMappability.hg38.bw \
--exclude_paths $griffin/Ref/encode_unified_GRCh38_exclusion_list.bed \
--chrom_sizes $griffin/Ref/hg38.standard.chrom.sizes \
--map_quality 20 \
--CPU 8 \
--tmp_dir $outdir/tmp/$name" >> $shdir/${name}.sh

echo -e "$griffin/scripts/griffin_GC_counts.py \
--bam_file $input/${bam}.bam \
--bam_file_name $name \
--mappable_regions_path $griffin/Ref/k100_minus_exclusion_lists.mappable_regions.hg38.bed \
--ref_seq $ref \
--chrom_sizes $griffin/Ref/hg38.standard.chrom.sizes \
--out_dir $outdir \
--map_q 20 \
--size_range 15 500 \
--CPU 8" >> $shdir/${name}.sh

echo -e "$griffin/scripts/griffin_GC_bias.py \
--bam_file_name $name \
--mappable_name k100_minus_exclusion_lists.mappable_regions.hg38 \
--genome_GC_frequency $griffin/Ref/genome_GC_frequency \
--out_dir $outdir/ \
--size_range 15 500" >> $shdir/${name}.sh

done

cd $shdir
ls *.sh > files
for file in $(cat files);do
sbatch -p all -c 8 --mem 8G -t 24:00:00 $file
done
107 changes: 107 additions & 0 deletions griffin/runners/nucleosome_profiling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash

analysis=hematopoetic
CPU=1
mem=8G

griffin=/cluster/projects/pughlab/bin/Griffin/v0.2.0
basedir=/cluster/projects/pughlab/projects/CHARM/LFS/griffin2
sites=$griffin/site_configs/${analysis}_sites.yaml
ref=/cluster/projects/pughlab/references/TGL/hg38/hg38_random.fa
input=/cluster/projects/pughlab/external_data/TGL49_CHARM/LFS/LFS_WG/bams
counts=$basedir/output/GC_correction
outdir=$basedir/output/nucleosome_profiling/$analysis
shdir=$basedir/sh_scripts/nucleosome_profiling/$analysis

encode_exclude=$griffin/Ref/encode_unified_GRCh38_exclusion_list.bed
centromere_path=$griffin/Ref/hg38_centromeres.bed
gap_path=$griffin/Ref/hg38_gaps.bed
patch_path=$griffin/Ref/hg38_fix_patches.bed
alternative_haplotype_path=$griffin/Ref/hg38_alternative_haplotypes.bed

mkdir -p $outdir
mkdir -p $outdir/tmp
mkdir -p $outdir/results
mkdir -p $shdir

cd $input
ls *bam > $shdir/bams

cd $shdir
sed 's/....$//' bams > bam
mv bam bams

for bam in $(cat bams);do

name=${bam:0:25}
echo $bam
echo $name

echo -e "#!/bin/bash\n
source activate base\n
conda activate griffin2\n" > $shdir/${name}.sh

echo -e "$griffin/scripts/griffin_coverage.py \
--sample_name $name \
--bam $input/${bam}.bam \
--GC_bias $counts/GC_bias/${name}.GC_bias.txt \
--mappability_bias $counts/mappability_bias/${name}.mappability_bias.txt \
--mappability_correction True \
--tmp_dir $outdir/tmp \
--reference_genome $ref \
--mappability_bw $griffin/Ref/k50.Umap.MultiTrackMappability.hg38.bw \
--chrom_sizes_path $griffin/Ref/hg38.standard.chrom.sizes \
--sites_yaml $sites \
--griffin_scripts $griffin/scripts \
--chrom_column Chrom \
--position_column position \
--strand_column Strand \
--chroms chr1 chr2 chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr20 chr21 chr22 \
--norm_window -5000 5000 \
--size_range 100 200 \
--map_quality 20 \
--number_of_sites none \
--sort_by none \
--ascending none \
--CPU $CPU\n" >> $shdir/${name}.sh

echo -e "$griffin/scripts/griffin_merge_sites.py \
--sample_name $name \
--uncorrected_bw_path $outdir/tmp/$name/tmp_bigWig/${name}.uncorrected.bw \
--GC_corrected_bw_path $outdir/tmp/$name/tmp_bigWig/${name}.GC_corrected.bw \
--GC_map_corrected_bw_path $outdir/tmp/$name/tmp_bigWig/${name}.GC_map_corrected.bw \
--mappability_correction False \
--tmp_dir $outdir/tmp \
--results_dir $outdir/results \
--mappability_bw $griffin/Ref/k50.Umap.MultiTrackMappability.hg38.bw \
--chrom_sizes_path $griffin/Ref/hg38.standard.chrom.sizes \
--sites_yaml $sites \
--griffin_scripts $griffin/scripts \
--chrom_column Chrom \
--position_column position \
--strand_column Strand \
--chroms chr1 chr2 chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr20 chr21 chr22 \
--norm_window -5000 5000 \
--save_window -1000 1000 \
--fft_window -960 960 \
--fft_index 10 \
--smoothing_length 165 \
--exclude_paths $encode_exclude $centromere_path $gap_path $patch_path $alternative_haplotype_path \
--step 15 \
--CNA_normalization False \
--individual False \
--smoothing True \
--exclude_outliers True \
--exclude_zero_mappability True \
--number_of_sites none \
--sort_by none \
--ascending none \
--CPU $CPU\n" >> $shdir/${name}.sh

done

cd $shdir
ls *.sh > files
for file in $(cat files);do
sbatch -c $CPU --mem $mem -t 24:00:00 $file
done
Loading

0 comments on commit f7b91f9

Please sign in to comment.