Пример #1
0
 def homer2narrow(self, options, peak_files, output_dir=None):
     '''
     Convert passed Homer peak files to narrowPeak files as specified by 
     the IdrUtilities object.
     
     Returns the set of filenames for generated narrowPeak files.
     '''
     output_dir = output_dir or options.output_dir
     self.check_output_dir(output_dir)
          
     idrutils = IdrUtilities()
     output_files = []
     for peak_file in peak_files:
         # Get extensionless name of file
         basename = os.path.splitext(os.path.basename(peak_file))[0]
         # Add a randint to avoid name collision
         basename = basename + '_' + str(randint(1,999))
         output_file = os.path.join(output_dir, basename + '.narrowPeak')
         
         data = idrutils.import_homer_peaks(peak_file)
         idrutils.homer_to_narrow_peaks(data, output_file)
         
         print('NarrowPeak file output to {}'.format(output_file))
         output_files.append(output_file)
     return output_files
Пример #2
0
    def homer2narrow(self, options, peak_files, output_dir=None):
        """
        Convert passed Homer peak files to narrowPeak files as specified by 
        the IdrUtilities object.
        
        Returns the set of filenames for generated narrowPeak files.
        """
        output_dir = output_dir or options.output_dir
        self.check_output_dir(output_dir)

        idrutils = IdrUtilities()
        output_files = []
        for peak_file in peak_files:
            # Get extensionless name of file
            basename = os.path.splitext(os.path.basename(peak_file))[0]
            # Add a randint to avoid name collision
            basename = basename + "_" + str(randint(1, 999))
            output_file = os.path.join(output_dir, basename + ".narrowPeak")

            data = idrutils.import_homer_peaks(peak_file)
            idrutils.homer_to_narrow_peaks(data, output_file)

            print("NarrowPeak file output to {}".format(output_file))
            output_files.append(output_file)
        return output_files
Пример #3
0
 def homer2narrow(self, options, peak_files, output_dir=None):
     '''
     Convert passed Homer peak files to narrowPeak files as specified by 
     the IdrUtilities object.
     
     Returns the set of filenames for generated narrowPeak files.
     '''
     self.check_output_dir(output_dir or options.output_dir)
          
     idrutils = IdrUtilities()
     output_files = []
     for peak_file in peak_files:
         # Get extensionless name of file
         basename = os.path.splitext(os.path.basename(peak_file))[0]
         output_file = os.path.join(output_dir, basename + '.narrowPeak')
         
         data = idrutils.import_homer_peaks(peak_file)
         idrutils.homer_to_narrow_peaks(data, output_file)
         
         print('NarrowPeak file output to {}'.format(output_file))
         output_files.append(output_file)
     return output_files