diff --git a/breakseq2/breakseq_index.py b/breakseq2/breakseq_index.py index 439c87a..190ea6e 100755 --- a/breakseq2/breakseq_index.py +++ b/breakseq2/breakseq_index.py @@ -22,7 +22,7 @@ def get_seq(sv, jn_type, seq, format_version): return ">%s:%s:%s\n%s" % (sv.id, sv.size(), jn_type, seq) -def generate_bplib(gff, reference, output, junction_length=DEFAULT_JUNCTION_LENGTH, format_version=DEFAULT_FORMAT_VERSION): +def generate_bplib(gff, reference, output, junction_length=DEFAULT_JUNCTION_LENGTH, format_version=DEFAULT_FORMAT_VERSION, chromosomes=[]): logger = logging.getLogger(generate_bplib.__name__) if not gff or not os.path.isfile(gff): @@ -37,6 +37,9 @@ def generate_bplib(gff, reference, output, junction_length=DEFAULT_JUNCTION_LENG logger.error("Insertion sequence file %s not found. Insertions will be skipped" % ins_file) for sv in SV.parse(gff, Fasta.Seqs(reference, junction_length)): + if chromosomes and sv.name not in chromosomes: + continue + if sv.is_insertion() and ins_file_absent: logger.warn("Omitting entry %s due to missing insertion sequence file" % sv.id) continue diff --git a/scripts/breakseq2_gen_bplib.py b/scripts/breakseq2_gen_bplib.py index 8deee61..90d0df6 100755 --- a/scripts/breakseq2_gen_bplib.py +++ b/scripts/breakseq2_gen_bplib.py @@ -11,6 +11,7 @@ breakseq_index.add_options(parser) parser.add_argument("--reference", help="Reference FASTA", required=True) parser.add_argument("--output", help="Output FASTA to generate. Leave unspecified for stdout") + parser.add_argument("--chromosomes", nargs="+", help="List of chromosomes to process", default=[]) parser.add_argument('--version', action='version', version='%(prog)s ' + _version.__version__) parser.add_argument('--log', help="Log level", default="INFO") @@ -26,4 +27,4 @@ logger = logging.getLogger(__file__) logger.info("Command-line: " + " ".join(sys.argv)) - breakseq_index.generate_bplib(args.bplib_gff, args.reference, args.output, args.junction_length, args.format_version) + breakseq_index.generate_bplib(args.bplib_gff, args.reference, args.output, args.junction_length, args.format_version, args.chromosomes)