parameters: (self, reads, region, baseline_graph, test_graphs, score_baseline_graph=None,
                        positive_control=None, negative_control=None, sample=None,
                        source_path_names=set(), mappers=['map'], paired_only=False,
                        assembly="hg38", tag_ext="", acc_threshold=0, auc_threshold=0,
                        sim_opts='-l 150 -p 500 -v 50 -e 0.05 -i 0.01', sim_fastq=None,
                        more_mpmap_opts=None)
docstring: Run simulation on a bakeoff graph
          
          Simulate the given number of reads from the given baseline_graph
          (snp1kg, primary, etc.) and realign them against all the graphs in the
          test_graph list.
          
          If a sample is specified, baseline_graph must be a graph with allele
          paths in it (--alt_paths passed to toil-vg construct) so that the subset
          of the graph for that sample can be used for read simulation.
          
          If instead source_path_names is specified, it must be a collection of
          path names that exist in baseline_graph. Reads will be simulated evenly
          across the named paths (not weighted according to path length).
          
          Needs to know the bekeoff region that is being run, in order to look up
          the actual graphs files for each graph type.
          
          Verifies that the realignments are sufficiently good.
          
          If score_baseline_graph is set to a graph name from test_graphs,
          computes score differences for reach read against that baseline.
  
          If postive_control or negative_control in tests_graphs, compute separate
          ROC/QQ plots with just those and the baseline graph (and don't plot them
          in the normal plots)
  
          If a sample name is specified, extract a thread for each of its haplotype
          from the baseline graph using the gpbwt and simulate only from the threads
docstring_summary: Run simulation on a bakeoff graph
          
          Simulate the given number of reads from the given baseline_graph
          (snp1kg, primary, etc.) and realign them against all the graphs in the
          test_graph list.
          
          If a sample is specified, baseline_graph must be a graph with allele
          paths in it (--alt_paths passed to toil-vg construct) so that the subset
          of the graph for that sample can be used for read simulation.
          
          If instead source_path_names is specified, it must be a collection of
          path names that exist in baseline_graph. Reads will be simulated evenly
          across the named paths (not weighted according to path length).
          
          Needs to know the bekeoff region that is being run, in order to look up
          the actual graphs files for each graph type.
          
          Verifies that the realignments are sufficiently good.
          
          If score_baseline_graph is set to a graph name from test_graphs,
          computes score differences for reach read against that baseline.
docstring_tokens: Run simulation on a bakeoff graph Simulate the given number of reads from the given baseline_graph ( snp1kg primary etc . ) and realign them against all the graphs in the test_graph list . If a sample is specified baseline_graph must be a graph with allele paths in it ( -- alt_paths passed to toil - vg construct ) so that the subset of the graph for that sample can be used for read simulation . If instead source_path_names is specified it must be a collection of path names that exist in baseline_graph . Reads will be simulated evenly across the named paths ( not weighted according to path length ) . Needs to know the bekeoff region that is being run in order to look up the actual graphs files for each graph type . Verifies that the realignments are sufficiently good . If score_baseline_graph is set to a graph name from test_graphs computes score differences for reach read against that baseline .
function: def _test_mapeval(self, reads, region, baseline_graph, test_graphs, score_baseline_graph=None,
                        positive_control=None, negative_control=None, sample=None,
                        source_path_names=set(), mappers=['map'], paired_only=False,
                        assembly="hg38", tag_ext="", acc_threshold=0, auc_threshold=0,
                        sim_opts='-l 150 -p 500 -v 50 -e 0.05 -i 0.01', sim_fastq=None,
                        more_mpmap_opts=None):
          """ Run simulation on a bakeoff graph
          
          Simulate the given number of reads from the given baseline_graph
          (snp1kg, primary, etc.) and realign them against all the graphs in the
          test_graph list.
          
          If a sample is specified, baseline_graph must be a graph with allele
          paths in it (--alt_paths passed to toil-vg construct) so that the subset
          of the graph for that sample can be used for read simulation.
          
          If instead source_path_names is specified, it must be a collection of
          path names that exist in baseline_graph. Reads will be simulated evenly
          across the named paths (not weighted according to path length).
          
          Needs to know the bekeoff region that is being run, in order to look up
          the actual graphs files for each graph type.
          
          Verifies that the realignments are sufficiently good.
          
          If score_baseline_graph is set to a graph name from test_graphs,
          computes score differences for reach read against that baseline.
  
          If postive_control or negative_control in tests_graphs, compute separate
          ROC/QQ plots with just those and the baseline graph (and don't plot them
          in the normal plots)
  
          If a sample name is specified, extract a thread for each of its haplotype
          from the baseline graph using the gpbwt and simulate only from the threads
          
          """
          assert not tag_ext or tag_ext.startswith('-')
          tag = 'sim-{}-{}{}'.format(region, baseline_graph, tag_ext)
          
          # compute the xg indexes from scratch
          for graph in set([baseline_graph] + test_graphs):
              chrom, offset = self._bakeoff_coords(region)        
              vg_path = self._input('{}-{}.vg'.format(graph, region))
              self._toil_vg_index(str(chrom), vg_path, None, self._input('{}-{}.gcsa'.format(graph, region)),
                                  None, tag, '{}-{}'.format(graph, region))
  
          # compute the haplotype graphs to simulate from
          if sample:
              # Can't use source paths with a sample
              assert(len(source_path_names) == 0)
              
              # We need to make one XG per sample haplotype
              if sample in self.bakeoff_removed_samples:
                  # Unlike the other bakeoff graphs (snp1kg-region.vg), this one contains NA12878 and family
                  vg_path = self._input('{}_all_samples-{}.vg'.format(baseline_graph, region))
              else:
                  vg_path = self._input('{}-{}.vg'.format(baseline_graph, region))
              vcf_path = self._input('1kg_{}-{}.vcf.gz'.format(assembly, region))            
              xg_path, thread1_xg_path, thread2_xg_path = self._make_thread_indexes(
                  sample, vg_path, vcf_path, region, tag)
              sim_xg_paths = [thread1_xg_path, thread2_xg_path]
          else:
              # Just use the one XG, and maybe restrict to paths in it.
              xg_path = os.path.join(self._outstore(tag), '{}-{}'.format(baseline_graph, region) + '.xg')
              sim_xg_paths = [xg_path]            
              
          fasta_path = self._input('{}.fa'.format(region))
          test_index_bases = []
          for test_graph in test_graphs:
              test_tag = '{}-{}'.format(test_graph, region)
              test_index_bases.append(os.path.join(self._outstore(tag), test_tag))
          self._mapeval_vg_run(reads, xg_path, sim_xg_paths, source_path_names, fasta_path, test_index_bases,
                               test_graphs, score_baseline_graph, mappers, paired_only, sim_opts, sim_fastq,
                               more_mpmap_opts, tag)
          if self.verify:
              self._verify_mapeval(reads, baseline_graph, score_baseline_graph,
                                   positive_control, negative_control, tag,
                                   acc_threshold, auc_threshold)
function_tokens: def _test_mapeval ( self , reads , region , baseline_graph , test_graphs , score_baseline_graph = None , positive_control = None , negative_control = None , sample = None , source_path_names = set ( ) , mappers = [ 'map' ] , paired_only = False , assembly = "hg38" , tag_ext = "" , acc_threshold = 0 , auc_threshold = 0 , sim_opts = '-l 150 -p 500 -v 50 -e 0.05 -i 0.01' , sim_fastq = None , more_mpmap_opts = None ) : assert not tag_ext or tag_ext . startswith ( '-' ) tag = 'sim-{}-{}{}' . format ( region , baseline_graph , tag_ext ) # compute the xg indexes from scratch for graph in set ( [ baseline_graph ] + test_graphs ) : chrom , offset = self . _bakeoff_coords ( region ) vg_path = self . _input ( '{}-{}.vg' . format ( graph , region ) ) self . _toil_vg_index ( str ( chrom ) , vg_path , None , self . _input ( '{}-{}.gcsa' . format ( graph , region ) ) , None , tag , '{}-{}' . format ( graph , region ) ) # compute the haplotype graphs to simulate from if sample : # Can't use source paths with a sample assert ( len ( source_path_names ) == 0 ) # We need to make one XG per sample haplotype if sample in self . bakeoff_removed_samples : # Unlike the other bakeoff graphs (snp1kg-region.vg), this one contains NA12878 and family vg_path = self . _input ( '{}_all_samples-{}.vg' . format ( baseline_graph , region ) ) else : vg_path = self . _input ( '{}-{}.vg' . format ( baseline_graph , region ) ) vcf_path = self . _input ( '1kg_{}-{}.vcf.gz' . format ( assembly , region ) ) xg_path , thread1_xg_path , thread2_xg_path = self . _make_thread_indexes ( sample , vg_path , vcf_path , region , tag ) sim_xg_paths = [ thread1_xg_path , thread2_xg_path ] else : # Just use the one XG, and maybe restrict to paths in it. xg_path = os . path . join ( self . _outstore ( tag ) , '{}-{}' . format ( baseline_graph , region ) + '.xg' ) sim_xg_paths = [ xg_path ] fasta_path = self . _input ( '{}.fa' . format ( region ) ) test_index_bases = [ ] for test_graph in test_graphs : test_tag = '{}-{}' . format ( test_graph , region ) test_index_bases . append ( os . path . join ( self . _outstore ( tag ) , test_tag ) ) self . _mapeval_vg_run ( reads , xg_path , sim_xg_paths , source_path_names , fasta_path , test_index_bases , test_graphs , score_baseline_graph , mappers , paired_only , sim_opts , sim_fastq , more_mpmap_opts , tag ) if self . verify : self . _verify_mapeval ( reads , baseline_graph , score_baseline_graph , positive_control , negative_control , tag , acc_threshold , auc_threshold )