Skip to content

Commit

Permalink
Actually include block in includeInStrand
Browse files Browse the repository at this point in the history
  • Loading branch information
mboudet committed Aug 11, 2023
1 parent 4937323 commit 855f286
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion askomics/libaskomics/BedFile.py
Expand Up @@ -329,9 +329,11 @@ def generate_rdf_content(self):
block_reference = self.rdfize(self.format_uri("{}_{}".format(feature.chrom, slice_block)))
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))
if faldo_strand:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], faldo_strand))
strand_ref = self.get_reference_strand_uri(feature.chrom, faldo_strand, slice_block)
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInReferenceStrand"], sref))
strand_ref = self.get_reference_strand_uri(None, faldo_strand, slice_block)
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], sref))

yield
7 changes: 3 additions & 4 deletions askomics/libaskomics/CsvFile.py
Expand Up @@ -737,9 +737,8 @@ def generate_rdf_content(self):
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInReferenceStrand"], sref))
if faldo_strand:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], faldo_strand))
if faldo_strand == self.faldo.BothStrandPosition:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], self.faldo.ForwardStrandPosition))
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], self.faldo.ReverseStrandPosition))
strand_ref = self.get_reference_strand_uri(None, faldo_strand, slice_block)
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], sref))

yield
6 changes: 6 additions & 0 deletions askomics/libaskomics/File.py
Expand Up @@ -464,6 +464,12 @@ def get_reference_strand_uri(self, reference, strand, block=None):
self.faldo.ReverseStrandPosition: "ReverseStrand",
self.faldo.BothStrandPosition: "BothStrand"
}
if reference is None:
if strand == self.faldo.BothStrandPosition:
return [self.rdfize(self.format_uri("s{}_{}".format(dstrand, block))) for dstrand in faldo_dict.values()]

return [self.rdfize(self.format_uri("s{}_{}".format(faldo_dict[strand], block)))]

if block is None:
if strand == self.faldo.BothStrandPosition:
return [self.rdfize(self.format_uri("{}_s{}s".format(reference, dstrand))) for dstrand in faldo_dict.values()]
Expand Down
4 changes: 3 additions & 1 deletion askomics/libaskomics/GffFile.py
Expand Up @@ -434,10 +434,12 @@ def generate_rdf_content(self):
block_reference = self.rdfize(self.format_uri("{}_{}".format(rec.id, slice_block)))
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))
if faldo_strand:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], faldo_strand))
strand_ref = self.get_reference_strand_uri(rec.id, faldo_strand, slice_block)
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInReferenceStrand"], sref))
strand_ref = self.get_reference_strand_uri(None, faldo_strand, slice_block)
for sref in strand_ref:
self.graph_chunk.add((entity, self.namespace_internal["includeInStrand"], sref))

yield

Expand Down

0 comments on commit 855f286

Please sign in to comment.