Commit 0d3dcbf7 authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files


parent 2c22fc66
#!/usr/bin/env python3
import networkx as nx
import argparse
import sys
import d2_graph as d2
def parse_arguments():
parser = argparse.ArgumentParser(description='Transform a 10X barcode graph into a d2 graph. The program dig for the d-graphs and then merge them into a d2-graph.')
parser.add_argument('barcode_graph', help='The barcode graph file. Must be a gefx formated file.')
parser.add_argument('--output_prefix', '-o', default="d2_graph", help="Output file prefix.")
args = parser.parse_args()
return args
def main():
# Parsing the input file
args = parse_arguments()
filename = args.barcode_graph
if not filename.endswith('.gexf'):
print("Input file must be gexf formatted", file=sys.stderr)
G = nx.read_gexf(filename)
# Index size must be changed for general purpose. 8 is good for d=5
d2g = d2.D2Graph(G, index_size=8)"{args.output_prefix}.tsv")
G, names = d2g.to_nx_graph()
nx.write_gexf(G, f"{args.output_prefix}.gexf")
if __name__ == "__main__":
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment