Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
ZEB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
primates
ZEB2
Commits
3a82f570
Commit
3a82f570
authored
Aug 17, 2023
by
vladijouan
Browse files
Options
Downloads
Patches
Plain Diff
Update getting_promoter_regions.sh
parent
c65a8b7e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
getting_promoter_regions.sh
+10
-3
10 additions, 3 deletions
getting_promoter_regions.sh
with
10 additions
and
3 deletions
getting_promoter_regions.sh
+
10
−
3
View file @
3a82f570
#!/bin/bash
#!/bin/bash
genenames
=
/path/to/file
annotation
=
/path/to/annotationfile
genome
=
/path/to/genome/fastafile
#adding quotes around the gene names for more specific grep later
awk
'{print "\x22"$1"\x22"}'
$genenames
>
genenames_merged.txt
#get the 2000 bp long region before the transcript starting position
#get the 2000 bp long region before the transcript starting position
grep
-f
$pos
genenames
<
(
awk
'{if ($3=="transcript") print}'
$annotation
)
|
awk
'{OFS="\t"; split($10,a,";"); split(a[1],b,"\""); if ($7=="-") print $1,$5,$5+2000,b[2],"1000",$7; else print $1,$4-2000,$4,b[2],"1000",$7}'
|
awk
'{OFS="\t"; if ($2<0) $2+0; print $0}'
|
awk
'{if ($3>4) print}'
|
sort
-k1
,1
-k2
,2n |
uniq
>
$pos
positions
.bed6.bed
grep
-f
genenames
_merged.txt
<
(
awk
'{if ($3=="transcript") print}'
$annotation
)
|
awk
'{OFS="\t"; split($10,a,";"); split(a[1],b,"\""); if ($7=="-") print $1,$5,$5+2000,b[2],"1000",$7; else print $1,$4-2000,$4,b[2],"1000",$7}'
|
awk
'{OFS="\t"; if ($2<0) $2+0; print $0}'
|
awk
'{if ($3>4) print}'
|
sort
-k1
,1
-k2
,2n |
uniq
>
positions.bed6.bed
#merge the promoter regions if they are overlapping
#merge the promoter regions if they are overlapping
bedtools merge
-d
100
-s
-i
$pos
positions
.bed6.bed
>
$
mergedbed
.bed
bedtools merge
-d
100
-s
-i
positions.bed6.bed
>
mergedbed.bed
#get the sequence
#get the sequence
bedtools getfasta
-fi
$
GENOME
-bed
$
mergedbed
.bed
-fo
$
mergedbad
.fa
bedtools getfasta
-fi
$
genome
-bed
mergedbed.bed
-fo
mergedbad.fa
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