Skip to content

Commit

Permalink
ability to specify chromosomes to process for bplib building
Browse files Browse the repository at this point in the history
  • Loading branch information
marghoob committed Nov 21, 2015
1 parent 4d162a5 commit 8cf3cdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion breakseq2/breakseq_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion scripts/breakseq2_gen_bplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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)

0 comments on commit 8cf3cdb

Please sign in to comment.