Skip to content
GitLab
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
04157769
Commit
04157769
authored
Apr 30, 2021
by
Blaise Li
Browse files
Preserving names when extracting genes from gtf.
The resulting BedTool is now in bed format.
parent
32004076
Changes
2
Hide whitespace changes
Inline
Side-by-side
libhts/__init__.py
View file @
04157769
...
...
@@ -2,7 +2,7 @@ from subprocess import check_output
__copyright__
=
"Copyright (C) 2020-2021 Blaise Li"
__licence__
=
"GNU GPLv3"
__version__
=
0.
5
__version__
=
0.
6
BEDTOOLS_VERSION
=
check_output
(
[
"bedtools"
,
"--version"
]).
decode
(
"utf-8"
).
strip
().
split
()[
-
1
]
...
...
libhts/libhts.py
View file @
04157769
...
...
@@ -46,6 +46,7 @@ import seaborn as sns
# from rpy2.robjects.packages import importr
# deseq2 = importr("DESeq2")
from
pybedtools
import
BedTool
from
pybedtools.featurefuncs
import
gff2bed
import
pyBigWig
import
networkx
as
nx
from
libworkflows
import
texscape
...
...
@@ -225,8 +226,15 @@ def id_list_gtf2bed(
def
feature_filter
(
feature
):
return
feature
[
2
]
==
feature_type
and
feature
[
id_kwd
]
in
ids
# def add_name(feature):
# feature.name = feature[id_kwd]
# return feature
gtf
=
BedTool
(
gtf_filename
)
return
gtf
.
filter
(
feature_filter
)
# Apparently ignored when later using merge
# return gtf.filter(feature_filter).each(add_name)
return
gtf
.
filter
(
feature_filter
).
each
(
gff2bed
,
id_kwd
)
# https://stackoverflow.com/a/13243870/1878788
def
empty_bed_generator
():
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment