Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Blaise LI
libhts
Commits
66415b36
Commit
66415b36
authored
Mar 24, 2020
by
Blaise Li
Browse files
Make slurm-compatible script.
parent
b5c33ec8
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/bam2bigwig.sh
View file @
66415b36
#!/bin/
d
ash
#!/bin/
b
ash
-l
# Usage: bam2bigwig.sh <sorted.bam> <bin_file> <library_name> <orientation> <strandedness> [<normalization>] <bigwig>
# <bin_file> should be a bed file representing 10 bp bins along the genome
# <orientation> must be "all", "fwd" or "rev"
...
...
@@ -30,7 +30,6 @@
# * python3 -> module load Python/3.6.0
# * samtools -> module load samtools/1.9
# * bedtools -> module load bedtools/2.25.0
# * mawk -> use alias if absent
# * parallel (for niceload) -> module load parallel/20170122
# * UCSC-tools (for bedGraphToBigWig) -> module load UCSC-tools/v373
...
...
@@ -66,7 +65,6 @@ error_exit ()
exit
1
}
mawk
--version
1> /dev/null 2> /dev/null
||
alias
mawk
=
'awk'
load_tools
||
error_exit
"Some tools are not available"
...
...
@@ -74,7 +72,7 @@ bam=${1}
bin_file
=
${
2
}
# Example of how to generate the bin_file from iGenome data:
# cd /Genomes/C_elegans
#
m
awk '$1 == "@SQ" {print $2"\t0\t"$3}' Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/WholeGenomeFasta/genome.dict \
# awk '$1 == "@SQ" {print $2"\t0\t"$3}' Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/WholeGenomeFasta/genome.dict \
# | sed 's/SN://g' | sed 's/LN://' \
# | bedops --chop 10 - \
# > Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/genome_binned_10.bed
...
...
@@ -163,7 +161,7 @@ fi
echo
"getting chromosome bounds"
genome_file
=
"
${
workdir
}
/chrom_sizes.txt"
samtools view
-H
${
bam
}
\
|
m
awk
'$1 == "@SQ" {print $2"\t"$3}'
\
|
awk
'$1 == "@SQ" {print $2"\t"$3}'
\
|
sed
's/SN://g'
|
sed
's/LN://'
\
>
${
genome_file
}
||
error_exit
"making
${
genome_file
}
failed"
#> ${genome_file} || cleanup && error_exit "making ${genome_file} failed"
...
...
@@ -172,7 +170,7 @@ compute_coverage()
{
cmd
=
"niceload --noswap bedtools genomecov -bg -split
${
orient_filter
}
${
scaling
}
-ibam
${
bam
}
"
eval
${
cmd
}
\
|
m
awk
'{ print $1"\t"$2"\t"$3"\tid-"NR"\t"$4; }'
| sort-bed -
\
|
awk
'{ print $1"\t"$2"\t"$3"\tid-"NR"\t"$4; }'
| sort-bed -
\
||
error_exit
"compute_coverage failed"
#|| cleanup && error_exit "compute_coverage failed"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment