Skip to content

Commit

Permalink
Merge pull request #117 from mskilab/zc_dev
Browse files Browse the repository at this point in the history
Zc dev
  • Loading branch information
zining01 authored Jan 30, 2023
2 parents 8fda1da + 698c747 commit 2f65330
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions R/converters.R
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ read.juncs = function(rafile,
seqlengths = seqlengths,
chr.convert = chr.convert,
standard.only = standard.only,
flipstrand = flipstrand)
flipstrand = !flipstrand)
return(grl)
}

Expand Down Expand Up @@ -1067,7 +1067,7 @@ read.juncs = function(rafile,
seqlengths = seqlengths,
chr.convert = chr.convert,
standard.only = standard.only,
flipstrand = flipstrand)
flipstrand = !flipstrand)
return(grl)
}

Expand Down Expand Up @@ -1315,31 +1315,35 @@ read.juncs = function(rafile,
}

## create GRanges/GRangesList
bp1.gr = GRanges(seqnames = all.bedpe.dt[, chr1],
ranges = IRanges(start = all.bedpe.dt[, start1],
width = 1),
strand = all.bedpe.dt[, strand1],
seqlengths = sl)
bp2.gr = GRanges(seqnames = all.bedpe.dt[, chr2],
ranges = IRanges(start = all.bedpe.dt[, start2],
width = 1),
strand = all.bedpe.dt[, strand2],
seqlengths = sl)

grl = gUtils::grl.pivot(GRangesList(bp1.gr, bp2.gr))

## add metadata using rearrangement id
if (keep.features)
grl = GRangesList()
if (all.bedpe.dt[, .N])
{
values(grl) = cbind(VariantAnnotation::info(vcf)[all.bedpe.dt$rearrangement.id,],
mcols(MatrixGenerics::rowRanges(vcf))[all.bedpe.dt$rearrangement.id,])
}
bp1.gr = GRanges(seqnames = all.bedpe.dt[, chr1],
ranges = IRanges(start = all.bedpe.dt[, start1],
width = 1),
strand = all.bedpe.dt[, strand1],
seqlengths = sl)
bp2.gr = GRanges(seqnames = all.bedpe.dt[, chr2],
ranges = IRanges(start = all.bedpe.dt[, start2],
width = 1),
strand = all.bedpe.dt[, strand2],
seqlengths = sl)

grl = gUtils::grl.pivot(GRangesList(bp1.gr, bp2.gr))

## add metadata using rearrangement id
if (keep.features)
{
values(grl) = cbind(VariantAnnotation::info(vcf)[all.bedpe.dt$rearrangement.id,],
mcols(MatrixGenerics::rowRanges(vcf))[all.bedpe.dt$rearrangement.id,])
}

grl = finalize.grl(grl,
seqlengths = seqlengths,
chr.convert = chr.convert,
standard.only = standard.only,
flipstrand = flipstrand)
grl = finalize.grl(grl,
seqlengths = seqlengths,
chr.convert = chr.convert,
standard.only = standard.only,
flipstrand = flipstrand)
}
return(grl)
}
else
Expand Down

0 comments on commit 2f65330

Please sign in to comment.