File: getType.R

package info (click to toggle)
r-cran-seqinr 3.3-3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,844 kB
  • ctags: 69
  • sloc: ansic: 1,955; makefile: 13
file content (31 lines) | stat: -rw-r--r-- 1,285 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
###################################################################################################
#                                                                                                 #
#                                         getType                                                 #
#                                                                                                 #
#                                                                                                 #
#                      To get available subsequence types in an opened ACNUC database             #
#                                                                                                 #
###################################################################################################

getType <- function(socket = autosocket()){
  #
  # Get the number of records in SMJYT index file:
  #
  nl <- readfirstrec(type = "SMJ")
  
  #
  # Read the SMJYT index file:
  #
  
  smj <- readsmj(libel.add = TRUE, sname.add = TRUE, nl = nl)
  
  #
  # Return available type:
  #
  ntype <- sum(smj$nature == "type", na.rm = TRUE)
  if( is.na(ntype) || ntype == 0 ){
    return(NA)
  } else {
    return( smj[!is.na(smj$nature) & smj$nature == "type", c("sname","libel")] ) 
  }
}