4747import requests as rq
4848# Import from 'bulkDGD'.
4949from . import defaults
50- from bulkDGD import util
5150
5251
5352#######################################################################
@@ -285,7 +284,7 @@ def get_query_string(query_string):
285284
286285 Returns
287286 -------
288- ``str``
287+ query_str : ``str``
289288 The query string.
290289 """
291290
@@ -370,7 +369,7 @@ def get_gene_sums(project_name,
370369
371370 Returns
372371 -------
373- ``pandas.DataFrame``
372+ df_gene_sums : ``pandas.DataFrame``
374373 A data frame containing the RNA-seq counts for the samples
375374 associated with the given category.
376375 """
@@ -531,7 +530,7 @@ def get_metadata(project_name,
531530
532531 Returns
533532 -------
534- ``pandas.DataFrame``
533+ df_metadata : ``pandas.DataFrame``
535534 A data frame containing the metadata for the samples associated
536535 with the given category.
537536 """
@@ -780,7 +779,7 @@ def merge_gene_sums_and_metadata(df_gene_sums,
780779
781780 Returns
782781 -------
783- df : ``pandas.DataFrame``
782+ df_merged : ``pandas.DataFrame``
784783 The data frame containing both RNA-seq counts and metadata
785784 for the samples.
786785 """
@@ -814,7 +813,7 @@ def filter_by_metadata(df,
814813
815814 Returns
816815 -------
817- ``pandas.DataFrame``
816+ df_filtered : ``pandas.DataFrame``
818817 The filtered data frame. This data frame will only contain the
819818 RNA-seq counts (no metadata).
820819 """
@@ -829,8 +828,11 @@ def filter_by_metadata(df,
829828 [col for col in df .columns \
830829 if not col .startswith ("ENSG" )]
831830
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" )
834836
835837 # Drop these columns from the data frame.
836838 df = df .drop (metadata_fields ,
0 commit comments