Created
March 7, 2018 16:45
-
-
Save tfaris/5749e8590901c627d62b3fe9f76253b1 to your computer and use it in GitHub Desktop.
[ArmedXpert Plugin] Get OSIRIS allele fit for all alleles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src = Sources[0] | |
src.OpenOriginalDocument() | |
try: | |
for sample in src.AllEntries: | |
for locus in sample.Loci: | |
for allele in locus.Alleles: | |
peak_name = str(allele.Name) | |
if peak_name.endswith(' OL'): | |
peak_name = peak_name.replace(' OL', '') | |
if 'amel' in allele.Locus.lower(): | |
# OSIRIS Amelogenin alleles are numbered, X=1, Y=2 | |
peak_name = {'x': 1, 'y': 2}.get(allele.Name.lower(), '') | |
fit = src.GetSampleElementValue( | |
sample, | |
"Locus[LocusName='%s']/Allele[Name='%s']/Fit" % ( | |
allele.Locus, | |
peak_name | |
) | |
) | |
if fit is None: | |
artifact_fit = src.GetSampleElementValue( | |
sample, | |
'ChannelAlerts/Channel/Artifact/Allele[Locus="%s"][Name="%s"]/../Fit' % ( | |
allele.Locus, | |
peak_name | |
) | |
) | |
print 'Sample %s, Locus %s, Allele %s, Fit %s' % ( | |
sample.SampleName, locus.Identifier, allele.Name, fit | |
) | |
finally: | |
src.CloseOriginalDocument() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment