Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chipseq_analysis
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Astrocyte
Workflows
BICF
chipseq_analysis
Commits
965294b4
Commit
965294b4
authored
8 years ago
by
Beibei Chen
Browse files
Options
Downloads
Patches
Plain Diff
memechip script done
parent
22946049
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workflow/scripts/runMemechip.py
+64
-0
64 additions, 0 deletions
workflow/scripts/runMemechip.py
with
64 additions
and
0 deletions
workflow/scripts/runMemechip.py
0 → 100644
+
64
−
0
View file @
965294b4
#!/qbrc/software/Python-2.7.7/bin/python
# programmer : bbc
# usage:
import
sys
import
re
from
re
import
sub
import
string
import
argparse
as
ap
import
logging
#import twobitreader
import
pybedtools
from
Bio
import
SeqIO
from
Bio.Seq
import
Seq
from
Bio.SeqRecord
import
SeqRecord
logging
.
basicConfig
(
level
=
10
)
def
prepare_argparser
():
description
=
"
Scan potential sgRNA in given fasta
"
epilog
=
"
For command line options of each command, type %(prog)% COMMAND -h
"
argparser
=
ap
.
ArgumentParser
(
description
=
description
,
epilog
=
epilog
)
argparser
.
add_argument
(
"
-i
"
,
"
--input
"
,
dest
=
"
infile
"
,
type
=
str
,
required
=
True
,
help
=
"
input BED file
"
)
argparser
.
add_argument
(
"
-o
"
,
"
--output
"
,
dest
=
"
outfile
"
,
type
=
str
,
required
=
True
,
help
=
"
output
"
)
argparser
.
add_argument
(
"
-g
"
,
"
--genome
"
,
dest
=
"
genome
"
,
type
=
str
,
help
=
"
Genome 2 bit file
"
)
argparser
.
add_argument
(
"
-m
"
,
"
--mask
"
,
dest
=
"
mask
"
,
type
=
bool
,
default
=
False
,
help
=
"
Convert repeats to N
"
)
argparser
.
add_argument
(
"
-l
"
,
"
--limit
"
,
dest
=
"
limit
"
,
type
=
int
,
default
=-
1
,
help
=
"
Top limit of peaks
"
)
return
(
argparser
)
def
rc
():
comps
=
{
'
A
'
:
"
T
"
,
'
C
'
:
"
G
"
,
'
G
'
:
"
C
"
,
'
T
'
:
"
A
"
,
"
N
"
:
"
N
"
}
return
''
.
join
([
comps
[
x
]
for
x
in
seq
.
upper
()[::
-
1
]])
def
main
():
argparser
=
prepare_argparser
()
args
=
argparser
.
parse_args
()
run
(
args
.
infile
,
args
.
genome
,
args
.
limit
,
args
.
output
)
def
run
(
infile
,
genome
,
limit
,
output
)
infile
=
pybedtools
.
BedTool
(
infile
)
#genome = twobitreader.TwoBitFile(genome)
output
=
open
(
args
.
outfile
,
"
w
"
)
rowcount
=
1
for
record
in
infile
:
while
rowcount
<=
limit
:
rowcount
+=
1
try
:
seq
=
genome
[
record
.
chrom
][
record
.
start
:
record
.
stop
]
except
:
pass
else
:
if
record
.
strand
==
"
-
"
:
seq
=
rc
(
seq
)
newfa_name
=
record
.
name
#"_".join(record.fields)
newfa
=
SeqRecord
(
Seq
(
seq
),
newfa_name
,
description
=
""
)
SeqIO
.
write
(
newfa
,
output
+
"
.fa
"
,
"
fasta
"
)
output
.
close
()
#Call memechip
meme_command
=
"
meme-chip -oc
"
+
output
+
"
-meme-minw 5 -meme-maxw 15 -meme-nmotifs 10
"
p
=
subprocess
.
Popen
(
meme_command
,
shell
=
True
)
p
.
communicate
()
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
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