Skip to content

Commit

Permalink
Merge pull request #19 from Zymo-Research/kerikssonNamingStandard
Browse files Browse the repository at this point in the history
Merging on new naming standard
  • Loading branch information
michael-weinstein authored Sep 13, 2020
2 parents bc8c5e4 + 1ba6323 commit 5f41ba9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions figaroSupport/fileNamingStandards.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
aliasList = {"zymo": "zymo",
"zymoservicesnamingstandard": "zymo",
"zymoservices": "zymo",
"illumina": "illumina"}
"illumina": "illumina",
"keriksson": "keriksson"}

class NamingStandard(object):

Expand Down Expand Up @@ -71,6 +72,21 @@ def getSampleInfo(self, fileName:str):
raise ValueError("%s does not appear to be a valid Illumina file name. Please check file naming convention argument." % fileName)


class KErickssonStandard(NamingStandard):

def getSampleInfo(self, fileName:str):
group, sampleAndDirection = fileName.split(".")[:2]
try:
sample, direction = sampleAndDirection.split("_")
direction = direction.replace("R", "")
direction = direction.replace("r", "")
direction = int(direction)
except ValueError:
raise ValueError("%s does not appear to be a valid file for this standard. Please check file naming convention argument." %fileName)

return group, sample, direction


class ManualNamingStandard(NamingStandard):
__slots__ = ["fileName", "fileDirectory", "filePath", "sampleNumber", "group", "direction", "sampleID"]

Expand All @@ -87,7 +103,8 @@ def __init__(self, filePath: str, group:str, number:int, direction:int):

def loadNamingStandard(name:str):
aliasObjectKey = {"zymo" : ZymoServicesNamingStandard,
"illumina" : IlluminaStandard}
"illumina" : IlluminaStandard,
"keriksson": KErickssonStandard}
nameLower = name.lower()
if not nameLower in aliasList:
raise ValueError("%s is not a valid naming standard identifier" %name)
Expand Down

0 comments on commit 5f41ba9

Please sign in to comment.