Skip to content

Commit

Permalink
updated readme; cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
SooLee committed Apr 5, 2017
1 parent 5204f53 commit 3c80792
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion R/px_chr1_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_chr1_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_chr1_col(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_chr2_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_chr2_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_chr2_col(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_endpos1_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_endpos1_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_endpos1_col(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_endpos2_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_endpos2_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_endpos2_col(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' res = px_exists(filename, key)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' key = "10|20"
#' res = px_exists(filename, key)
#' print(res)
Expand Down
2 changes: 1 addition & 1 deletion R/px_keylist.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' res = px_keylist(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_keylist(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' res = px_query(filename, querystr, autoflip=TRUE)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz", package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz", package="Rpairix")
#' querystr = "10:1-1000000|20"
#' res = px_query(filename, querystr)
#' print(res)
Expand Down
2 changes: 1 addition & 1 deletion R/px_seq1list.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' res = px_seq1list(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_seq1list(filename)
#' print(res)
px_seq1list<-function(filename){
Expand Down
2 changes: 1 addition & 1 deletion R/px_seq2list.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' res = px_seq2list(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_seq2list(filename)
#' print(res)
px_seq2list<-function(filename){
Expand Down
2 changes: 1 addition & 1 deletion R/px_seqlist.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' res = px_seqlist(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_seqlist(filename)
#' print(res)
px_seqlist<-function(filename){
Expand Down
2 changes: 1 addition & 1 deletion R/px_startpos1_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_startpos1_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_startpos1_col(filename)
#' print(res)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/px_startpos2_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' res = px_startpos2_col(filename)
#' print(res)
#'
#' filename = system.file(".","merged_nodup.tab.chrblock_sorted.txt.gz",package="Rpairix")
#' filename = system.file(".","merged_nodups.space.chrblock_sorted.subsample1.txt.gz",package="Rpairix")
#' res = px_startpos2_col(filename)
#' print(res)
#'
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ px_get_column_names(filename)
> querystr = "chr10:1-3000000|chr20"
> res = px_query(filename,querystr)
> print(res)
V1 V2 V3 V4 V5 V6 V7
1 SRR1658581.51740952 chr10 157600 chr20 167993 - -
2 SRR1658581.33457260 chr10 2559777 chr20 7888262 - +
readID chr1 pos1 chr2 pos2 strand1 strand2
1 SRR1658581.51740952 chr10 157600 chr20 167993 - -
2 SRR1658581.33457260 chr10 2559777 chr20 7888262 - +
>
> # line-count-only
> n = px_query(filename,querystr, linecount.only=TRUE)
Expand All @@ -186,9 +186,9 @@ px_get_column_names(filename)
> px_query("inst/test_4dn.pairs.gz","chr20|chr10:1-3000000")
data frame with 0 columns and 0 rows
> px_query("inst/test_4dn.pairs.gz","chr20|chr10:1-3000000", autoflip=TRUE)
V1 V2 V3 V4 V5 V6 V7
1 SRR1658581.51740952 chr10 157600 chr20 167993 - -
2 SRR1658581.33457260 chr10 2559777 chr20 7888262 - +
readID chr1 pos1 chr2 pos2 strand1 strand2
1 SRR1658581.51740952 chr10 157600 chr20 167993 - -
2 SRR1658581.33457260 chr10 2559777 chr20 7888262 - +
> px_query("inst/test_4dn.pairs.gz","chr20|chr10:1-3000000", linecount.only=TRUE)
[1] 0
> px_query("inst/test_4dn.pairs.gz","chr20|chr10:1-3000000", autoflip=TRUE, linecount.only=TRUE)
Expand Down Expand Up @@ -238,6 +238,10 @@ data frame with 0 columns and 0 rows
> # checking if the file is 1D-indexed or 2D-indexed
> px_check_dim("inst/test_4dn.pairs.gz")
[1] 2
>
> # get column names
> px_get_column_names("inst/test_4dn.pairs.gz")
[1] "readID" "chr1" "pos1" "chr2" "pos2" "strand1" "strand2"
```


Expand Down
Binary file removed inst/merged_nodup.tab.chrblock_sorted.txt.gz
Binary file not shown.
Binary file removed inst/merged_nodup.tab.chrblock_sorted.txt.gz.px2
Binary file not shown.
2 changes: 1 addition & 1 deletion man/px_chr1_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_chr2_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_endpos1_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_endpos2_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_keylist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_query.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_seq1list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_seq2list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_seqlist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_startpos1_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/px_startpos2_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/rpairixlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ SEXP get_lines(SEXP _r_pfn, SEXP _r_pquerystr, SEXP _r_pnquery, SEXP _r_pn){
PROTECT(_r_presultstr = allocVector(VECSXP, *pn));
int flag=0;

int len=-1;
char *s;
int k=0;

pairix_t *tb = load(*pfn);

int ncols=0;
Expand All @@ -303,6 +299,8 @@ SEXP get_lines(SEXP _r_pfn, SEXP _r_pquerystr, SEXP _r_pnquery, SEXP _r_pn){
int i, ires=0; // i is index for querystr, ires is index for result line
for(i=0;i<*pnquery;i++){
ti_iter_t iter = ti_querys_2d(tb, pquerystr[i]);
char *s;
int len=-1,k=0;
while ((s = ti_read(tb, iter, &len)) != 0) {
int j,start=0,m=0; // j is position on result line, start is start position of the current column, m is the index of the current column
if(ncols==0) for(j=0;j<=len;j++) if(s[j]==pconf->delimiter||s[j]==0) ncols++;
Expand Down

0 comments on commit 3c80792

Please sign in to comment.