[Biojava-dev] [Bug 2432] non conventional fasta header && RichSequence.IOTools

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Fri Jan 25 12:28:08 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2432


mark.schreiber at novartis.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from mark.schreiber at novartis.com  2008-01-25 07:28 EST -------
I have added a class called FastaHeader. This class lets you specify which
fields you want to see in the fasta header output. There are overloaded
writeFasta methods in RichSequence.IOTools that let you use this class easily.

For example the following test program reads in a fasta file from Genbank with
a full header and outputs it with only the accession number and description
after the '>'

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package io;

import java.io.BufferedReader;
import java.io.FileReader;
import org.biojavax.bio.seq.RichSequenceIterator;
import org.biojavax.bio.seq.io.FastaHeader;
import static org.biojavax.bio.seq.RichSequence.IOTools;

/**
 *
 * @author Mark
 */
public class WriteFasta {
    public static void main(String[] args) throws Exception{ 
        BufferedReader br = new BufferedReader(
                new FileReader("files/dna.fasta"));
        RichSequenceIterator iter = IOTools.readFastaDNA(br, null);
        //IOTools.writeFasta(System.out, iter, null);

        FastaHeader header = new FastaHeader();
        header.setShowDescription(true);
        header.setShowIdentifier(false);
        header.setShowNamespace(false);
        header.setShowName(false);
        header.setShowVersion(false);

        IOTools.writeFasta(System.out, iter, null, header);
    }
}


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the biojava-dev mailing list