コード例 #1
0
ファイル: scanTDT.py プロジェクト: vdhankani/scanFBAT
	#Note: thought of checking if chrX marker has heterozygous males, but it's not possible since the feature matrix comes in with encoded genotypes. 
	#So all you can check is whether autosomal chrs have any genotypes other than 0/1/2/NA and chrX has any genotypes other that 0/1/NA for males, 0/1/2/NA for females
	#for chrX
	#TODO: verify that hasValidGenotypes() works
	if isinstance(thisMarker,ChrXMarker) and not thisMarker.hasValidGenotypes(pedNBGender,pedMemberType):
		print 'Invalid genotype found at ',thisMarker.markerID,'. This marker will not be tested.'
		continue
	#for autosomal chromosomes
	elif not isinstance(thisMarker,ChrXMarker) and not thisMarker.hasValidGenotypes():
		print 'Invalid genotype found at ',thisMarker.markerID,'. This marker will not be tested.'
                continue
		
	#COMPUTE ALLELE FREQUENCY
	#compute regardless of whether 'mi' has been selected or not, because allele frequency will be reported in the output
	if isinstance(thisMarker,ChrXMarker):
		thisMarker.computeMAF(pedNBGender,pedMemberType)
	else:
		thisMarker.computeMAF()
	
	try:
		#assert that MAF is always positive
		assert(thisMarker.maf >= 0)
	except(AssertionError):
		print 'Marker ',thisMarker.markerID,', MAF=',thisMarker.maf
		exit(1)	

        #DEBUG
#	print 'Ref and Alt Frequencies'
#       print vcfValues[0],thisMarker.maf
#       raw_input('continue')
	
コード例 #2
0
ファイル: scanFBAT.py プロジェクト: IlyaLab/FamSuite
	#Note: thought of checking if chrX marker has heterozygous males, but it's not possible since the feature matrix comes in with encoded genotypes. 
	#So all you can check is whether autosomal chrs have any genotypes other than 0/1/2/NA and chrX has any genotypes other that 0/1/NA for males, 0/1/2/NA for females
	#for chrX
	#TODO: verify that hasValidGenotypes() works
	if isinstance(thisMarker,ChrXMarker) and not thisMarker.hasValidGenotypes(NBGenderDict):
		print 'Invalid genotype found at ',thisMarker.markerID,'. This marker will not be tested.'
		continue
	#for autosomal chromosomes
	elif not isinstance(thisMarker,ChrXMarker) and not thisMarker.hasValidGenotypes():
		print 'Invalid genotype found at ',thisMarker.markerID,'. This marker will not be tested.'
                continue
		
	#COMPUTE ALLELE FREQUENCY
	#compute regardless of whether 'mi' has been selected or not, because allele frequency will be reported in the output
	if isinstance(thisMarker,ChrXMarker):
		thisMarker.computeMAF(NBGenderDict)
	else:
		thisMarker.computeMAF()
	
	try:
		#assert that MAF is always positive
		assert(thisMarker.maf >= 0)
	except(AssertionError):
		print 'Marker ',thisMarker.markerID,', MAF=',thisMarker.maf
		exit(1)	

        #DEBUG
#	print 'Ref and Alt Frequencies'
#       print vcfValues[0],thisMarker.maf
#       raw_input('continue')