def load_primary_contigs(reference_path):
'''Load set of primary contigs for variant and SV calling from reference_path.
If now primary_contigs.txt file is specified, return all contigs. If reference_path
is a known 10x reference genome and has no primary_contigs.txt, filter the known bad contigs '''
if not reference_path is None and os.path.exists(get_primary_contigs(reference_path)):
# If we have a primary_contigs.txt file, use it
with open(get_primary_contigs(reference_path), 'r') as f:
primary_contigs = set([line.strip() for line in f.readlines()])
else:
# Default is to include all contigs
# Otherwise implement the old contig filters
ref = open_reference(reference_path)
primary_contigs = set(ref.keys())
if is_tenx(reference_path):
primary_contigs = set(chrom for chrom in primary_contigs if not ('random' in chrom or 'U' in chrom or 'hap' in chrom or chrom == 'hs37d5'))
return primary_contigs
评论列表
文章目录