write.pir {bio3d} | R Documentation

## Write PIR Formated Sequences

### Description

Write aligned or un-aligned sequences to a PIR format file.

### Usage

    write.pir(alignment=NULL, ids=NULL, seqs=alignment$ali,
       pdb.file = NULL, chain.first = NULL, resno.first = NULL,
       chain.last = NULL, resno.last = NULL, file, append = FALSE)

### Arguments

`alignment` | an alignment list object with `id` and `ali` components, similar to that generated by `read.fasta`.
`ids` | a vector of sequence names to serve as sequence identifers
`seqs` | an sequence or alignment character matrix or vector with a row per sequence
`pdb.file` | a vector of pdb filenames; For sequence, provide "".
`chain.first` | a vector of chain id for the first residue.
`resno.first` | a vector of residue number for the first residue.
`chain.last` | a vector of chain id for the last residue.
`resno.last` | a vector of residue number for the last residue.
`file` | name of output file.
`append` | logical, if TRUE output will be appended to `file`; otherwise, it will overwrite the contents of `file`.

### Value

Called for its effect.

### Note

PIR is required format for input alignment file to use Modeller. For a description of PIR format see: https://salilab.org/modeller/manual/node488.html.

### Author(s)

Xin-Qiu Yao

### References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695–2696.

### See Also

`read.fasta`, `read.fasta.pdb`, `write.fasta`

### Examples

    # Needs MUSCLE installed - testing excluded

    if(check.utility("muscle")) {

    ## Generate an input file for structural modeling of
    ## transducin G-alpha subunit using the template 3SN6_A

    ## Read transducin alpha subunit sequence
    seq <- get.seq("P04695", db = "uniprot", outfile = tempfile())

    ## Read structure template
    path = tempdir()
    pdb.file <- get.pdb("3sn6_A", path = path, split = TRUE)
    pdb <- read.pdb(pdb.file)

    ## Build an alignment between template and target
    aln <- seqaln(seqbind(pdbseq(pdb), seq), id = c("3sn6_A", seq$id), outfile = tempfile())

    ## Write PIR format alignment file
    outfile = file.path(tempdir(), "eg.pir")
    write.pir(aln, pdb.file = c(pdb.file, ""), file = outfile)

    invisible( cat("\nSee the output file:", outfile, sep = "\n") )

    }

[Package bio3d version 2.3-4 Index]