Exemplo n.º 1
0
def main():
  parser = argparse.ArgumentParser(
    description='Write JSON files describing trees',
		formatter_class=argparse.ArgumentDefaultsHelpFormatter,
  )
  parser.add_argument('--include-ssm-names', dest='include_ssm_names', action='store_true',
    help='Include SSM names in output (which may be sensitive data)')
  parser.add_argument('--min-ssms', dest='min_ssms', type=float, default=0.01,
    help='Minimum number or percent of SSMs to retain a subclone')
  parser.add_argument('dataset_name',
    help='Name identifying dataset')
  parser.add_argument('tree_file',
    help='File containing sampled trees')
  parser.add_argument('tree_summary_output',
    help='Output file for JSON-formatted tree summaries')
  parser.add_argument('mutlist_output',
    help='Output file for JSON-formatted list of mutations')
  parser.add_argument('mutass_output',
    help='Output file for JSON-formatted list of SSMs and CNVs assigned to each subclone')
  args = parser.parse_args()

  summaries, mutlist, mutass = ResultGenerator().generate(args.tree_file, args.include_ssm_names)

  munger = ResultMunger(summaries, mutlist, mutass, args.min_ssms)
  summaries, mutass = munger.munge()

  writer = JsonWriter(args.dataset_name)
  writer.write_summaries(summaries, args.tree_summary_output)
  writer.write_mutlist(mutlist, args.mutlist_output)
  writer.write_mutass(mutass, args.mutass_output)
Exemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser(
        description='Write JSON files describing trees',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument(
        '--include-ssm-names',
        dest='include_ssm_names',
        action='store_true',
        help='Include SSM names in output (which may be sensitive data)')
    parser.add_argument(
        '--min-ssms',
        dest='min_ssms',
        type=float,
        default=0.01,
        help='Minimum number or percent of SSMs to retain a subclone')
    parser.add_argument('dataset_name', help='Name identifying dataset')
    parser.add_argument('tree_file', help='File containing sampled trees')
    parser.add_argument('tree_summary_output',
                        help='Output file for JSON-formatted tree summaries')
    parser.add_argument(
        'mutlist_output',
        help='Output file for JSON-formatted list of mutations')
    parser.add_argument(
        'mutass_output',
        help=
        'Output file for JSON-formatted list of SSMs and CNVs assigned to each subclone'
    )
    args = parser.parse_args()

    summaries, mutlist, mutass = ResultGenerator().generate(
        args.tree_file, args.include_ssm_names)

    munger = ResultMunger(summaries, mutlist, mutass, args.min_ssms)
    summaries, mutass = munger.munge()

    writer = JsonWriter(args.dataset_name)
    writer.write_summaries(summaries, args.tree_summary_output)
    writer.write_mutlist(mutlist, args.mutlist_output)
    writer.write_mutass(mutass, args.mutass_output)
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(
        description='Write JSON files describing trees',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument(
        '--include-ssm-names',
        dest='include_ssm_names',
        action='store_true',
        help='Include SSM names in output (which may be sensitive data)')
    parser.add_argument(
        '--min-ssms',
        dest='min_ssms',
        type=float,
        default=0.01,
        help='Minimum number or percent of SSMs to retain a subclone')
    parser.add_argument('--include-multiprimary',
                        dest='include_multiprimary',
                        action='store_true',
                        help='Whether to include multiprimary trees in result')
    parser.add_argument('--max-multiprimary', dest='max_multiprimary', type=restricted_float, default=0.8,
      help='Maximum proportion of trees that may be multiprimary if ' \
      '--include=multiprimary=False. In that case, an exception will be thrown if ' \
      'the proportion of multiprimary trees exceeds this value.')
    parser.add_argument('dataset_name', help='Name identifying dataset')
    parser.add_argument('tree_file', help='File containing sampled trees')
    parser.add_argument('tree_summary_output',
                        help='Output file for JSON-formatted tree summaries')
    parser.add_argument(
        'mutlist_output',
        help='Output file for JSON-formatted list of mutations')
    parser.add_argument(
        'mutass_output',
        help=
        'Output file for JSON-formatted list of SSMs and CNVs assigned to each subclone'
    )
    args = parser.parse_args()

    summaries, mutlist, mutass, params = ResultGenerator().generate(
        args.tree_file, args.include_ssm_names)

    munger = ResultMunger(summaries, mutlist, mutass)
    summaries, mutass = munger.remove_small_nodes(args.min_ssms)
    munger.remove_superclones()
    if not args.include_multiprimary:
        munger.remove_multiprimary_trees(args.max_multiprimary)

    writer = JsonWriter(args.dataset_name)
    writer.write_summaries(summaries, params, args.tree_summary_output)
    writer.write_mutlist(mutlist, args.mutlist_output)
    writer.write_mutass(mutass, args.mutass_output)
def munge(treesummfn, mutlistfn, mutassfn):
    loader = ResultLoader(treesummfn, mutlistfn, mutassfn)
    dataset_name = loader.dataset_name
    treesumm, mutlist, mutass = loader.tree_summary, loader.mutlist, loader.load_all_mut_assignments_into_memory(
    )

    munger = ResultMunger(treesumm, mutlist, mutass)
    munger.remove_superclones()
    munger.remove_polyclonal_trees()

    writer = JsonWriter(dataset_name)
    writer.write_summaries(treesumm, treesummfn)
    writer.write_mutlist(mutlist, mutlistfn)
    writer.write_mutass(mutass, mutassfn)