Wrapper Module

The Wrapper module is used to run PANDORA in parallel on multiple cases. All the cases must be provided in a .csv/.tsv file, and various information can be added to them (template, anchor positions, M chain seq).

Wrapper Example:

>>> from PANDORA import Pandora
>>> from PANDORA import Database
>>> from PANDORA import Wrapper
>>>
>>> ## A. Load the pre-generated templates database
>>> db = Database.load()
>>>
>>> ## B. Create and run wrapper with 24 concurrent jobs
>>> wrap =  Wrapper.Wrapper(data_file='datafile.tsv', database=db, IDs_col=0,
>>>                         peptides_col=1, allele_name_col, n_jobs=24)
>>>

Wrapper

class PANDORA.Wrapper.Wrapper.Wrapper(data_file, database, MHC_class, num_cores=1, delimiter='\t', header=True, IDs_col=None, peptides_col=0, allele_name_col=1, anchors_col=None, M_chain_col=None, N_chain_col=None, outdir_col=None, template_col=None, benchmark=False, verbose=False, start_row=None, end_row=None, use_netmhcpan=False, use_templ_seq=False, n_loop_models=20, n_jobs=None, collective_output_dir=False, pickle_out=False, clip_C_domain=False, restraints_stdev=False, archive=False, wrapper_id=False, rm_netmhcpan_output=True)[source]

Bases: object

Pandora wrapper object. Create PANDORA targets from csv or tsv file and models them. :param data_file: Path to the input tsv/csv file containing targets :type data_file: str :param information.: :param database: Database object. :type database: PANDORA.Database.Database :param MHC_class: MHC class of the targets, as ‘I’ or ‘II’. :type MHC_class: str :param num_cores: Number of parallel PANDORA jobs. :type num_cores: int, optional :param Each one will be sent to a different core. Defaults to 1.: :param delimiter: data_file delimiter. Do not use :type delimiter: str, optional :param semicolons: :type semicolons: ‘;’ :param header: If True, assumes the data_file has a :type header: bool, optional :param header line and skips it. If your file has no header line: :param : :param set it as False. Defaults to True.: :param IDs_col: Column of data_file containing :type IDs_col: int or None, optional :param the targets IDs. If None: :param will automatically assign an ID: :param according to the row number. Defaults to None.: :param peptides_col: Column of data_file containing :type peptides_col: int, optional :param the targets peptides. Defaults to 0.: :param allele_name_col: Column of data_file containing :type allele_name_col: int, optional :param the targets alleles. Umbiguous allele cases (where the allele: :param might have multiple names) should be separated by a: :param semicolon: :type semicolon: ‘;’ :param anchors_col: Column of data_file containing :type anchors_col: int, optional :param the targets anchors. Anchors should be two numbers separated: :param by a semicolon: :type by a semicolon: ‘;’ :param M_chain_col: Column of data_file containing :type M_chain_col: None or int, optional :param the targets M chain sequences.: :param N_chain_col: Column of data_file containing :type N_chain_col: None or int, optional :param the targets N chain sequences: :type the targets N chain sequences: only for MHCII :param outdir_col: Column of data_file containing :type outdir_col: None or int, optional :param the paths to the output folder for each case.: :param template_col: 0-index column containing the template :type template_col: None or int, optional :param ID to be used for each case. Defaults to None.: :param collective_output_dir: Output directory path for :type collective_output_dir: str, optional :param all the cases. Note: This argument will be ignored if ‘outdir_col’ :param has been used to generate targets with Wrapper.create_targets().: :param Defaults to False.: :param benchmark: Set True only for benchmarking purpose, :type benchmark: bool, optional :param if target structures are available. Defaults to False.: :param start_row: Starting row of data_file, to use when :type start_row: None or int :param splitting the data_file into multiple batches. This allows to: :param specify from which row the samples for this job start.: :param end_row: Ending row of data_file, to use when :type end_row: None or int :param splitting the data_file into multiple batches. This allows to: :param specify at which row the samples for this job end.: :param use_netmhcpan: If True, uses local installation :type use_netmhcpan: bool, optional :param of netMHCPan to predict anchor positions for each target.: :param use_templ_seq: If true, it uses the template MHC sequence :type use_templ_seq: bool, optional :param for each chain a sequence could not be found. This function is mainly: :param for benchmarking purposes. Defaults to False.: :param num_cores: Number of parallel PANDORA jobs. :type num_cores: int, optional :param Each one will be sent to a different core. Defaults to 1.: :param n_loop_models: Number of loop models. :type n_loop_models: int, optional :param Defaults to 20.: :param n_jobs: Number of parallel MODELLER loop jobs. :type n_jobs: int, optional :param Do not increase further than n_loop_models. Defaults to None.: :param pickle_out: If True, outputs a pickle file :type pickle_out: bool, optional :param containing every model object. Defaults to False.: :param clip_C_domain: if True, clips away the C-like domain, levaing only :type clip_C_domain: bool or list :param the G-domain according to IMGT. If a listcontaining the G domain: :type the G-domain according to IMGT. If a listcontaining the G domain: s :param span is provided: :param will use it to cut the sequence. The list should have: :param this format: [(1,182)] for MHCI and [(1,91),(1,86)] for MHCII. :param restraints_stdev: if True, keeps the whole peptide flexible. Increases computational time by 50-90% :type restraints_stdev: bool or float :param but increases accuracy and prevents from artifacts at the anchor positions.: :param If float: :param it used as standard deviation of modelling restraints. Higher = more flexible restraints.: :param Defaults to False. Setting it to True only will set the default standard deviation to 0.1.: :param wrapper_id: id of the wrapper. Should be alphanumeric only. :type wrapper_id: string :param If not: :param non-alphanumeric characters will be replaced with dashes.: :param If False: :param it will be randomly generated. Defaults to False.: :param rm_netmhcpan_output: (bool) If True, removes the netmhcpan infile and :param outfile after having used them for netmhcpan.:

Returns:

None.

prep_collective_output_dir()[source]
Create an output directory and move the template pdb there

Uses self.output_dir (str): Path to output directory. Defaults to os.getcwd().

Parameters:

None

PANDORA.Wrapper.Wrapper.archive_and_remove(case)[source]

Archives the case folder as a .tar file to save inode space

Parameters:

case (str) – directory name of case to be archived

PANDORA.Wrapper.Wrapper.run_case(args)[source]

Runs one modelling job. Meant to be runned from Pandora.Wrapper

Parameters:
  • args (list) – List of arguments. Should be containing the following, in

  • order.

  • target_id (str) – Target id.

  • n_loop_models (int, optional) – Number of loop models. Defaults to 20.

  • benchmark (bool, optional) – Set True if running a benchmark to retrieve

  • False. (models RMSD with reference structures. Defaults to)

Returns:

None.