Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libhts
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blaise LI
libhts
Commits
66415b36
Commit
66415b36
authored
5 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Make slurm-compatible script.
parent
b5c33ec8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/bam2bigwig.sh
+4
-6
4 additions, 6 deletions
scripts/bam2bigwig.sh
with
4 additions
and
6 deletions
scripts/bam2bigwig.sh
+
4
−
6
View file @
66415b36
#!/bin/
d
ash
#!/bin/
b
ash
-l
# Usage: bam2bigwig.sh <sorted.bam> <bin_file> <library_name> <orientation> <strandedness> [<normalization>] <bigwig>
# 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
# <bin_file> should be a bed file representing 10 bp bins along the genome
# <orientation> must be "all", "fwd" or "rev"
# <orientation> must be "all", "fwd" or "rev"
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
# * python3 -> module load Python/3.6.0
# * python3 -> module load Python/3.6.0
# * samtools -> module load samtools/1.9
# * samtools -> module load samtools/1.9
# * bedtools -> module load bedtools/2.25.0
# * bedtools -> module load bedtools/2.25.0
# * mawk -> use alias if absent
# * parallel (for niceload) -> module load parallel/20170122
# * parallel (for niceload) -> module load parallel/20170122
# * UCSC-tools (for bedGraphToBigWig) -> module load UCSC-tools/v373
# * UCSC-tools (for bedGraphToBigWig) -> module load UCSC-tools/v373
...
@@ -66,7 +65,6 @@ error_exit ()
...
@@ -66,7 +65,6 @@ error_exit ()
exit
1
exit
1
}
}
mawk
--version
1> /dev/null 2> /dev/null
||
alias
mawk
=
'awk'
load_tools
||
error_exit
"Some tools are not available"
load_tools
||
error_exit
"Some tools are not available"
...
@@ -74,7 +72,7 @@ bam=${1}
...
@@ -74,7 +72,7 @@ bam=${1}
bin_file
=
${
2
}
bin_file
=
${
2
}
# Example of how to generate the bin_file from iGenome data:
# Example of how to generate the bin_file from iGenome data:
# cd /Genomes/C_elegans
# 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://' \
# | sed 's/SN://g' | sed 's/LN://' \
# | bedops --chop 10 - \
# | bedops --chop 10 - \
# > Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/genome_binned_10.bed
# > Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/genome_binned_10.bed
...
@@ -163,7 +161,7 @@ fi
...
@@ -163,7 +161,7 @@ fi
echo
"getting chromosome bounds"
echo
"getting chromosome bounds"
genome_file
=
"
${
workdir
}
/chrom_sizes.txt"
genome_file
=
"
${
workdir
}
/chrom_sizes.txt"
samtools view
-H
${
bam
}
\
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://'
\
|
sed
's/SN://g'
|
sed
's/LN://'
\
>
${
genome_file
}
||
error_exit
"making
${
genome_file
}
failed"
>
${
genome_file
}
||
error_exit
"making
${
genome_file
}
failed"
#> ${genome_file} || cleanup && error_exit "making ${genome_file} failed"
#> ${genome_file} || cleanup && error_exit "making ${genome_file} failed"
...
@@ -172,7 +170,7 @@ compute_coverage()
...
@@ -172,7 +170,7 @@ compute_coverage()
{
{
cmd
=
"niceload --noswap bedtools genomecov -bg -split
${
orient_filter
}
${
scaling
}
-ibam
${
bam
}
"
cmd
=
"niceload --noswap bedtools genomecov -bg -split
${
orient_filter
}
${
scaling
}
-ibam
${
bam
}
"
eval
${
cmd
}
\
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"
||
error_exit
"compute_coverage failed"
#|| cleanup && error_exit "compute_coverage failed"
#|| cleanup && error_exit "compute_coverage failed"
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment