Last active
October 21, 2017 17:50
-
-
Save bsipos/49418cdf48ce9b87f042f993aea4e755 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// Import the standard formatting library: | |
import "fmt" | |
// Import the os library - needed for opening files: | |
import "os" | |
// Import the io library - needed for checking for EOF: | |
import "io" | |
//Import the necessary biogo fastq input/output library: | |
import ( | |
"github.com/biogo/biogo/alphabet" | |
"github.com/biogo/biogo/io/seqio/fastq" | |
"github.com/biogo/biogo/seq/linear" | |
) | |
func main() { | |
// Open the fastq file specified on the command line | |
// for reading: | |
fh, err := os.Open(os.Args[1]) | |
// Check for open errors and abort: | |
if err != nil { | |
panic(err) | |
} | |
// Create a template seuence for the reader: | |
template := linear.NewQSeq("", alphabet.QLetters{}, alphabet.DNA, alphabet.Sanger) | |
// Create a fastq reader: | |
reader := fastq.NewReader(fh, template) | |
for { | |
// Read the next record: | |
seq, err := reader.Read() | |
// Break loop if we reached the end of the file: | |
if err == io.EOF { | |
break | |
} | |
fmt.Println(seq.CloneAnnotation().ID) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment