Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bioinfo_utils
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
bioinfo_utils
Commits
233c7a4e
Commit
233c7a4e
authored
6 years ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Avoiding deprecation warnings.
parent
32a603f1
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
libworkflows/libworkflows/libworkflows.py
+5
-5
5 additions, 5 deletions
libworkflows/libworkflows/libworkflows.py
with
5 additions
and
5 deletions
libworkflows/libworkflows/libworkflows.py
+
5
−
5
View file @
233c7a4e
...
@@ -245,7 +245,7 @@ def sum_htseq_counts(counts_filename):
...
@@ -245,7 +245,7 @@ def sum_htseq_counts(counts_filename):
def
read_htseq_counts
(
counts_filename
):
def
read_htseq_counts
(
counts_filename
):
return
pd
.
read_
table
(
counts_filename
,
header
=
None
,
index_col
=
0
).
drop
(
return
pd
.
read_
csv
(
counts_filename
,
sep
=
"
\t
"
,
header
=
None
,
index_col
=
0
).
drop
(
[
"
__no_feature
"
,
[
"
__no_feature
"
,
"
__ambiguous
"
,
"
__ambiguous
"
,
"
__too_low_aQual
"
,
"
__too_low_aQual
"
,
...
@@ -260,11 +260,11 @@ def sum_feature_counts(counts_filename, nb_bams=1):
...
@@ -260,11 +260,11 @@ def sum_feature_counts(counts_filename, nb_bams=1):
This determines which columns should be used.
"""
This determines which columns should be used.
"""
# Counts are in the 7-th column, starting from third row.
# Counts are in the 7-th column, starting from third row.
# The first sum is over the the rows, the second over the columns
# The first sum is over the the rows, the second over the columns
return
pd
.
read_
table
(
counts_filename
,
skiprows
=
2
,
usecols
=
range
(
6
,
6
+
nb_bams
),
header
=
None
).
sum
().
sum
()
return
pd
.
read_
csv
(
counts_filename
,
sep
=
"
\t
"
,
skiprows
=
2
,
usecols
=
range
(
6
,
6
+
nb_bams
),
header
=
None
).
sum
().
sum
()
def
read_feature_counts
(
counts_filename
,
nb_bams
=
1
):
def
read_feature_counts
(
counts_filename
,
nb_bams
=
1
):
return
pd
.
read_
table
(
counts_filename
,
skiprows
=
1
,
usecols
=
[
0
,
*
range
(
6
,
6
+
nb_bams
)],
index_col
=
0
)
return
pd
.
read_
csv
(
counts_filename
,
sep
=
"
\t
"
,
skiprows
=
1
,
usecols
=
[
0
,
*
range
(
6
,
6
+
nb_bams
)],
index_col
=
0
)
# I 3746 3909 "WBGene00023193" - . 17996
# I 3746 3909 "WBGene00023193" - . 17996
...
@@ -281,7 +281,7 @@ def sum_intersect_counts(counts_filename):
...
@@ -281,7 +281,7 @@ def sum_intersect_counts(counts_filename):
"""
Sums all counts in a bedtools intersect generated *counts_filename*, where the annotation was in bed format.
"""
"""
Sums all counts in a bedtools intersect generated *counts_filename*, where the annotation was in bed format.
"""
# Counts are in the 7-th column
# Counts are in the 7-th column
try
:
try
:
return
pd
.
read_
table
(
counts_filename
,
usecols
=
[
6
],
header
=
None
).
sum
().
iloc
[
0
]
return
pd
.
read_
csv
(
counts_filename
,
sep
=
"
\t
"
,
usecols
=
[
6
],
header
=
None
).
sum
().
iloc
[
0
]
except
pd
.
errors
.
EmptyDataError
:
except
pd
.
errors
.
EmptyDataError
:
return
"
NA
"
return
"
NA
"
...
@@ -289,7 +289,7 @@ def read_intersect_counts(counts_filename):
...
@@ -289,7 +289,7 @@ def read_intersect_counts(counts_filename):
# index_col takes effect after column selection with usecols, hence index_col=0 (ex-third column):
# index_col takes effect after column selection with usecols, hence index_col=0 (ex-third column):
# https://stackoverflow.com/a/45943627/1878788
# https://stackoverflow.com/a/45943627/1878788
try
:
try
:
return
pd
.
read_
table
(
counts_filename
,
usecols
=
[
3
,
6
],
header
=
None
,
index_col
=
0
)
return
pd
.
read_
csv
(
counts_filename
,
sep
=
"
\t
"
,
usecols
=
[
3
,
6
],
header
=
None
,
index_col
=
0
)
except
pd
.
errors
.
EmptyDataError
:
except
pd
.
errors
.
EmptyDataError
:
return
pd
.
DataFrame
(
index
=
[],
columns
=
[
"
gene
"
,
"
counts
"
]).
set_index
(
"
gene
"
)
return
pd
.
DataFrame
(
index
=
[],
columns
=
[
"
gene
"
,
"
counts
"
]).
set_index
(
"
gene
"
)
...
...
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