Skip to content

Commit af842eb

Browse files
committed
minor
1 parent 827d3b7 commit af842eb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

R/pseudoRef.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
pseudoRef <- function(fa, snpdt, sidx=5:ncol(snpdt), arules=NULL, outdir){
2727

2828
### load reference genome fasta file into DNAStringSet
29-
29+
library("data.table")
30+
library("Biostrings")
3031
if(class(fa) == "character"){fa <- readDNAStringSet(filepath = fa, format="fasta")}
3132
if(class(fa) != "DNAStringSet" & class(fa) != "DNAString"){stop("fa should be a DNAStringSet or DNAString")}
3233
if(!is.null(arules) & sum(names(arules) %in% c("from", "to")) !=2)
@@ -37,8 +38,6 @@ pseudoRef <- function(fa, snpdt, sidx=5:ncol(snpdt), arules=NULL, outdir){
3738
wd0 <- width(fa)
3839
nm0 <- names(fa)
3940

40-
message(sprintf("###>>> 1"))
41-
4241
### chr id, get only the first element of the blank seperated vector.
4342
chrid <- gsub(" .*", "", names(fa))
4443
res <- list()
@@ -47,6 +46,7 @@ pseudoRef <- function(fa, snpdt, sidx=5:ncol(snpdt), arules=NULL, outdir){
4746
myfa <- fa
4847
#tab0 <- table(snpdt[, s, with=FALSE])
4948
sub <- snpdt[, c(1:4, s), with=FALSE]
49+
sub <- as.data.frame(sub)
5050
sid <- names(snpdt)[s]
5151
names(sub)[5] <- "SAMPLE"
5252
## remove missing sites and sites that are the same as ref
@@ -56,8 +56,6 @@ pseudoRef <- function(fa, snpdt, sidx=5:ncol(snpdt), arules=NULL, outdir){
5656
sub <- subset(sub, SAMPLE != "./." & ref != SAMPLE)
5757

5858
### replace for each chrom
59-
sub <- as.data.frame(sub)
60-
#message(sprintf("###>>> [%s]", class(sub)))
6159
for(i in 1:length(chrid)){
6260
subchr <- subset(sub, chr == chrid[i])
6361
if(nrow(subchr) > 0){

0 commit comments

Comments
 (0)