Skip to content

Instantly share code, notes, and snippets.

@tfaris
Created March 7, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfaris/5749e8590901c627d62b3fe9f76253b1 to your computer and use it in GitHub Desktop.
Save tfaris/5749e8590901c627d62b3fe9f76253b1 to your computer and use it in GitHub Desktop.
[ArmedXpert Plugin] Get OSIRIS allele fit for all alleles
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