Skip to content
Snippets Groups Projects
Commit e077dff2 authored by Helene Rimbert's avatar Helene Rimbert
Browse files

Merge branch...

Merge branch '5-improve-renamegffids-py-build-chromosome-map-based-on-input-gff-and-not-mapping-file' into 'missing_conda_rules'

IMPROVE: initialise chromosomeMap dict while reading input GFF

See merge request !5
parents 1553a64b 5b2c2706
No related branches found
No related tags found
2 merge requests!7Missing conda rules,!5IMPROVE: initialise chromosomeMap dict while reading input GFF
......@@ -24,7 +24,7 @@ class renameIDs (object):
self.checkInputs()
# load inputs
self.loadChromosomeMap()
#self.loadChromosomeMap()
# open filehandler for output files
self.prepareOutputFiles()
......@@ -251,6 +251,14 @@ class renameIDs (object):
coord=line.rstrip('\n').split('\t')[3]
stop=line.rstrip('\n').split('\t')[4]
geneId=self.getFeatureAttribute(gff=line, attribute='ID')
# check if this chromosome is in the mapping dictionaries
if (chrom not in self.chromosomeMap.keys()):
self.chromosomeMap[chrom] = chrom
self.geneMapCoord[chrom] = defaultdict()
self.newGeneMapCoord[chrom] = defaultdict()
if featureType == 'gene':
while coord in self.geneMapCoord[chrom].keys():
sys.stderr.write(" WARNING: gene {} has same coordinate as gene {} \n".format(geneId, self.geneMapCoord[chrom][coord]))
......@@ -289,9 +297,6 @@ class renameIDs (object):
for line in maprecord.readlines():
if not line.startswith('#'):
(name, id) = line.rstrip('\n').split('\t')
#self.chromosomeMap[name] = id
#self.geneMapCoord[name] = defaultdict()
#self.newGeneMapCoord[name] = defaultdict()
self.chromosomeMap[id] = name
self.geneMapCoord[id] = defaultdict()
self.newGeneMapCoord[id] = defaultdict()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment