.. deprecated:: 0.1.0
           GSSC has removed the sample_stats.json file since the entire folder it was in has been 
           removed. Use :meth:`get_barcode_stats` instead. 
     
        Retrieves the JSON object for the stats in the file named sample_stats.json in the project 
        specified by self.dx_project_id.  This file is located in the DNAnexus folder stage\d_qc_report.
    
        Args:
            barcode: `str`. The barcode for the sample. Currently, the sample_stats.json file is of the 
                following form when there isn't a genome mapping: 
    
                [{"Sample name": "AGTTCC"}, {"Sample name": "CAGATC"}, {"Sample name": "GCCAAT"}, ...}]. 
    
                When there is a mapping, each dictionary has many more keys in addition to the "Sample name" one.
    
        Returns: 
            `list` of dicts if barcode=None, otherwise a dict for the given barcode.

def get_sample_stats_json(self,barcode=None):
        """
        .. deprecated:: 0.1.0
           GSSC has removed the sample_stats.json file since the entire folder it was in has been 
           removed. Use :meth:`get_barcode_stats` instead. 
     
        Retrieves the JSON object for the stats in the file named sample_stats.json in the project 
        specified by self.dx_project_id.  This file is located in the DNAnexus folder stage\d_qc_report.
    
        Args:
            barcode: `str`. The barcode for the sample. Currently, the sample_stats.json file is of the 
                following form when there isn't a genome mapping: 
    
                [{"Sample name": "AGTTCC"}, {"Sample name": "CAGATC"}, {"Sample name": "GCCAAT"}, ...}]. 
    
                When there is a mapping, each dictionary has many more keys in addition to the "Sample name" one.
    
        Returns: 
            `list` of dicts if barcode=None, otherwise a dict for the given barcode.
        """
        sample_stats_json_filename = "sample_stats.json"
        sample_stats_json_id = dxpy.find_one_data_object(more_ok=False,zero_ok=False,project=self.dx_project_id,name=sample_stats_json_filename)["id"]
        #dxpy.download_dxfile(dxid=sample_stats_json_id,project=self.dx_project_id,filename=sample_stats_json_filename)
        json_data = json.loads(dxpy.open_dxfile(sample_stats_json_id).read())
      
        if not barcode:
            return json_data
      
        for d in json_data: #d is a dictionary
            sample_barcode = d["Sample name"]
            if sample_barcode == barcode:
                return d
        if barcode:
            raise DnanexusBarcodeNotFound("Barcode {barcode} for {library_name} not found in {sample_stats_json_filename} in project {project}.".format(barcode=barcode,library_name=self.library_name,sample_stats_json_filename=sample_stats_json_filename,project=self.dx_project_id))