swamp.mr.mr module

class Mr(id, target_fa, target_mtz, workdir, phased_mtz=None, logger=None, silent=False)[source]

Bases: abc.ABC

This is an abstract class for MR pipelines. It implements data structures and methods commonly used in MR tasks.

Parameters:
  • id (str) – unique identifier for the Mr instance
  • target_fa (str) – target’s fasta filename
  • target_mtz (str) – target’s mtz filename
  • workdir (str) – working directory where the MR pipeline will be executed
  • phased_mtz (str) – filename of the target’s mtz containing phase information (default None)
  • logger (SwampLogger) – logging interface for the MR pipeline (default None)
  • silent (bool) – if set to True the logger will not print messages (default False)
Variables:
  • results (list) – A list with the figures of merit obtained after the completion of the pipeline
  • error (bool) – True if errors have occurred at some point on the pipeline
  • results – contains the results obtained in the MR pipeline
append_results()[source]

Abstract method to append the results obtained so far into results

cleanup_dir_list

Abstract property to hold the location of the directories to cleanup after completion of the pipeline

create_result_table_outfile(fname=None)[source]

Method to write string representation of table_contents into result_table_fname or into a specific file if fname is set.

Parameters:fname (str) – filename where the result table will be created (default None)
init_params

A dictionary to store the initial parameters used to instantiate the Mr

make_workdir()[source]

Method to create the working directory of the Mr instance

pipeline_header

Header displayed when initiating SwampLogger

result_pickle_fname

Filename where the Mr instance will be pickled

result_table_fname

Filename where the string representation of table_contents will be written

run()[source]

Abstract method to run the mr pipeline

store_pickle(fname=None, mode='ab')[source]

Method to pickle the Mr instance into a file

Parameters:
  • fname (str) – filename where the pickle will be created (default None)
  • mode (str) – mode that will be used to open the file handle (default ‘ab’)
table_contents

String representation of results displayed as a table