code: def gct2gctx_main(args):
      
  
      in_gctoo = parse_gct.parse(args.filename, convert_neg_666=False)
  
      if args.output_filepath is None:
          basename = os.path.basename(args.filename)
          out_name = os.path.splitext(basename)[0] + ".gctx"
      else:
          out_name = args.output_filepath
  
      """ If annotations are supplied, parse table and set metadata_df """
      if args.row_annot_path is None:
          pass
      else:
          row_metadata = pd.read_csv(args.row_annot_path, sep='\t', index_col=0, header=0, low_memory=False)
          assert all(in_gctoo.data_df.index.isin(row_metadata.index)), \
              "Row ids in matrix missing from annotations file"
          in_gctoo.row_metadata_df = row_metadata.loc[row_metadata.index.isin(in_gctoo.data_df.index)]
  
      if args.col_annot_path is None:
          pass
      else:
          col_metadata = pd.read_csv(args.col_annot_path, sep='\t', index_col=0, header=0, low_memory=False)
          assert all(in_gctoo.data_df.columns.isin(col_metadata.index)), \
              "Column ids in matrix missing from annotations file"
          in_gctoo.col_metadata_df = col_metadata.loc[col_metadata.index.isin(in_gctoo.data_df.columns)]
  
      write_gctx.write(in_gctoo, out_name)
docs: Separate from main() in order to make command-line tool.