forked from igordot/sns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
423 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/bash | ||
|
||
|
||
## | ||
## ATAC-seq using Bowtie 2 | ||
## | ||
|
||
|
||
# script filename | ||
script_name=$(basename "${BASH_SOURCE[0]}") | ||
route_name=${script_name/%.sh/} | ||
echo -e "\n ========== ROUTE: $route_name ========== \n" >&2 | ||
|
||
# check for correct number of arguments | ||
if [ ! $# == 2 ] ; then | ||
echo -e "\n $script_name ERROR: WRONG NUMBER OF ARGUMENTS SUPPLIED \n" >&2 | ||
echo -e "\n USAGE: $script_name project_dir sample_name \n" >&2 | ||
exit 1 | ||
fi | ||
|
||
# standard route arguments | ||
proj_dir=$(readlink -f "$1") | ||
sample=$2 | ||
|
||
# additional settings | ||
threads=$NSLOTS | ||
code_dir=$(dirname "$(dirname "${BASH_SOURCE[0]}")") | ||
qsub_dir="${proj_dir}/logs-qsub" | ||
|
||
# display settings | ||
echo " * proj_dir: $proj_dir " | ||
echo " * sample: $sample " | ||
echo " * code_dir: $code_dir " | ||
echo " * qsub_dir: $qsub_dir " | ||
echo " * threads: $threads " | ||
|
||
|
||
######################### | ||
|
||
|
||
# delete empty qsub .po files | ||
rm -f ${qsub_dir}/sns.*.po* | ||
|
||
|
||
######################### | ||
|
||
|
||
# segments | ||
|
||
# rename and/or merge raw input FASTQs | ||
segment_fastq_clean="fastq-clean" | ||
fastq_R1=$(grep -s -m 1 "^${sample}," "${proj_dir}/samples.${segment_fastq_clean}.csv" | cut -d ',' -f 2) | ||
fastq_R2=$(grep -s -m 1 "^${sample}," "${proj_dir}/samples.${segment_fastq_clean}.csv" | cut -d ',' -f 3) | ||
if [ -z "$fastq_R1" ] ; then | ||
bash_cmd="bash ${code_dir}/segments/${segment_fastq_clean}.sh $proj_dir $sample" | ||
($bash_cmd) | ||
fastq_R1=$(grep -m 1 "^${sample}," "${proj_dir}/samples.${segment_fastq_clean}.csv" | cut -d ',' -f 2) | ||
fastq_R2=$(grep -m 1 "^${sample}," "${proj_dir}/samples.${segment_fastq_clean}.csv" | cut -d ',' -f 3) | ||
fi | ||
|
||
# run alignment | ||
segment_align="align-bowtie2-atac" | ||
bam_bt2=$(grep -s -m 1 "^${sample}," "${proj_dir}/samples.${segment_align}.csv" | cut -d ',' -f 2) | ||
if [ -z "$bam_bt2" ] ; then | ||
bash_cmd="bash ${code_dir}/segments/${segment_align}.sh $proj_dir $sample $threads $fastq_R1 $fastq_R2" | ||
($bash_cmd) | ||
bam_bt2=$(grep -m 1 "^${sample}," "${proj_dir}/samples.${segment_align}.csv" | cut -d ',' -f 2) | ||
fi | ||
|
||
# remove duplicates | ||
segment_dedup="bam-dedup-sambamba" | ||
bam_dd=$(grep -s -m 1 "^${sample}," "${proj_dir}/samples.${segment_dedup}.csv" | cut -d ',' -f 2) | ||
if [ -z "$bam_dd" ] ; then | ||
bash_cmd="bash ${code_dir}/segments/${segment_dedup}.sh $proj_dir $sample $threads $bam_bt2" | ||
($bash_cmd) | ||
bam_dd=$(grep -m 1 "^${sample}," "${proj_dir}/samples.${segment_dedup}.csv" | cut -d ',' -f 2) | ||
fi | ||
|
||
|
||
######################### | ||
|
||
|
||
# combine summary from each step | ||
|
||
sleep 30 | ||
|
||
summary_csv="${proj_dir}/summary-combined.wes.csv" | ||
|
||
bash_cmd=" | ||
bash ${code_dir}/scripts/join-many.sh , X \ | ||
${proj_dir}/summary.${segment_fastq_clean}.csv \ | ||
${proj_dir}/summary.${segment_align}.csv \ | ||
${proj_dir}/summary.${segment_dedup}.csv \ | ||
> $summary_csv | ||
" | ||
(eval $bash_cmd) | ||
|
||
|
||
######################### | ||
|
||
|
||
# delete empty qsub .po files | ||
rm -f ${qsub_dir}/sns.*.po* | ||
|
||
|
||
######################### | ||
|
||
|
||
date | ||
|
||
|
||
|
||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.