Last active
October 5, 2017 14:30
-
-
Save bsipos/038240e7a3de45c030d6a360152f7f94 to your computer and use it in GitHub Desktop.
A SAM sanitiser in go.
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 ( | |
"fmt" | |
"github.com/biogo/hts/sam" | |
"io" | |
"os" | |
) | |
func main() { | |
reader, err := sam.NewReader(os.Stdin) | |
if err != nil { | |
panic(err) | |
} | |
writer, err := sam.NewWriter(os.Stdout, reader.Header(), 0) | |
for { | |
record, err := reader.Read() | |
if err == io.EOF { | |
break | |
} | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "Parse error: %s\n", err) | |
} else { | |
writer.Write(record) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment