47
47
import requests as rq
48
48
# Import from 'bulkDGD'.
49
49
from . import defaults
50
- from bulkDGD import util
51
50
52
51
53
52
#######################################################################
@@ -285,7 +284,7 @@ def get_query_string(query_string):
285
284
286
285
Returns
287
286
-------
288
- ``str``
287
+ query_str : ``str``
289
288
The query string.
290
289
"""
291
290
@@ -370,7 +369,7 @@ def get_gene_sums(project_name,
370
369
371
370
Returns
372
371
-------
373
- ``pandas.DataFrame``
372
+ df_gene_sums : ``pandas.DataFrame``
374
373
A data frame containing the RNA-seq counts for the samples
375
374
associated with the given category.
376
375
"""
@@ -531,7 +530,7 @@ def get_metadata(project_name,
531
530
532
531
Returns
533
532
-------
534
- ``pandas.DataFrame``
533
+ df_metadata : ``pandas.DataFrame``
535
534
A data frame containing the metadata for the samples associated
536
535
with the given category.
537
536
"""
@@ -780,7 +779,7 @@ def merge_gene_sums_and_metadata(df_gene_sums,
780
779
781
780
Returns
782
781
-------
783
- df : ``pandas.DataFrame``
782
+ df_merged : ``pandas.DataFrame``
784
783
The data frame containing both RNA-seq counts and metadata
785
784
for the samples.
786
785
"""
@@ -814,7 +813,7 @@ def filter_by_metadata(df,
814
813
815
814
Returns
816
815
-------
817
- ``pandas.DataFrame``
816
+ df_filtered : ``pandas.DataFrame``
818
817
The filtered data frame. This data frame will only contain the
819
818
RNA-seq counts (no metadata).
820
819
"""
@@ -829,8 +828,11 @@ def filter_by_metadata(df,
829
828
[col for col in df .columns \
830
829
if not col .startswith ("ENSG" )]
831
830
832
- # Remove the index column from the fields containing metadata.
833
- metadata_fields .remove ("external_id" )
831
+ # If the 'external_id' column is in the metadata
832
+ if "external_id" in metadata_fields :
833
+
834
+ # Remove the index column from the fields containing metadata.
835
+ metadata_fields .remove ("external_id" )
834
836
835
837
# Drop these columns from the data frame.
836
838
df = df .drop (metadata_fields ,
0 commit comments