Skip to content

Commit

Permalink
first pass at tped processing handling X chromosome
Browse files Browse the repository at this point in the history
The VCF->TPED processing code now separates out record into files
separated by count of genotypes present, to account for sections of
haploid, diploid, and mixed regions, as in the case of sample
populations containing male and female genotypes, and chromosome
positions within pseudoautosomal regions. Diploid sections are written
out with the standard file names (following the convention of autosomal
files), while regions deviating from polidy*(number of samples) are
written out to separate files with the genotype count appended (ex.
chrX_AFR2_1003.tped.gz, for chrX_AFR2 as the file output prefix, and
“_1003” indicating that there are 1003 genotypes for each of the loci
present in the file).
  • Loading branch information
tomkinsc committed Jun 11, 2015
1 parent 6b8532a commit 3f9269a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cms/scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def parser_selscan_file_conversion(parser=argparse.ArgumentParser()):
help="""Coordinate in bp of start position. (default: %(default)s).""")
parser.add_argument('--endBp', type=int,
help="""Coordinate in bp of end position.""")
parser.add_argument('--ploidy', default=2, type=int,
help="""Number of chromosomes expected for each genotype. (default: %(default)s).""")
#parser.add_argument("--ancestralVcf", type=str,
# help="""A one-sample VCF file describing the ancestral allele for all
# SNPs. File must be built on the same reference and coordinate space as inVcf. All
Expand Down Expand Up @@ -78,6 +80,9 @@ def main_selscan_file_conversion(args):

# define coding functions here, in accordance with spec arg preferences

if args.ploidy < 1:
raise argparse.ArgumentError('Argument "--ploidy" must be one or greater.')

if (args.filterPops or args.filterSuperPops) and not args.sampleMembershipFile:
raise argparse.ArgumentTypeError('Argument "--sampleMembershipFile" must be specifed if --filterPops or --filterSuperPops are used.')

Expand Down Expand Up @@ -114,7 +119,7 @@ def coding_function(current_value, reference_allele, ancestral_allele):
chromosome_num = args.chromosomeNum,
start_pos_bp = args.startBp,
end_pos_bp = args.endBp,
ploidy = 2,
ploidy = args.ploidy,
consider_multi_allelic = args.considerMultiAllelic,
include_variants_with_low_qual_ancestral = args.includeLowQualAncestral,
coding_function = coding_function)
Expand Down

0 comments on commit 3f9269a

Please sign in to comment.