func LookupTranscripts(geneName string) error {
	lookups := packr.NewBox("./lookups")

	file := lookups.Bytes("ensembl.grch38.p12.genes")
	buf := bytes.NewBuffer(file)
	cr := csv.NewReader(buf)
	cr.Comma = '\t'

	results := make([][]string, 0)

	header := make([]string, 0)
	var i int64
	for {
		rec, err := cr.Read()
		if err != nil && err == io.EOF {
			break
		} else if err != nil {
			return err
		}

		i++
		if i == 1 {
			header = append(header, rec...)

			continue
		}

		if len(rec[Chromosome]) > 2 {
			// Longer chromosome names probably represent patches, which we are
			// not equipped to handle.
			continue
		}

		if rec[GeneName] != geneName {
			continue
		}

		strand := "-"
		if rec[Strand] == "1" {
			strand = "+"
		}

		results = append(results, []string{rec[GeneName], rec[Chromosome], rec[TranscriptStartOneBased], rec[TranscriptEndOneBased], rec[TranscriptLengthIncludingUTRAndCDS], strand})
	}

	if len(results) < 1 {
		return fmt.Errorf("No results were found for %s. Were you using a transcript name instead of a gene name?", geneName)
	}

	fmt.Println("Gene\tChromosome\tTranscriptStart\tTranscriptEnd\tTranscriptLength\tStrand")
	for _, result := range results {
		fmt.Println(strings.Join(result, "\t"))
	}

	return nil
}
// Fetches all transcripts for a named symbol
Fetches all transcripts for a named symbol
// Fetches all transcripts for a named symbol
func LookupTranscripts(geneName string) error {
	lookups := packr.NewBox("./lookups")
	file := lookups.Bytes("ensembl.grch38.p12.genes")
	buf := bytes.NewBuffer(file)
	cr := csv.NewReader(buf)
	cr.Comma = '\t'
	results := make([][]string, 0)
	header := make([]string, 0)
	var i int64
	for {
		rec, err := cr.Read()
		if err != nil && err == io.EOF {
			break
		} else if err != nil {
			return err
		}
		i++
		if i == 1 {
			header = append(header, rec...)
			continue
		}
		if len(rec[Chromosome]) > 2 {
			continue
		}
		if rec[GeneName] != geneName {
			continue
		}
		strand := "-"
		if rec[Strand] == "1" {
			strand = "+"
		}
		results = append(results, []string{rec[GeneName], rec[Chromosome], rec[TranscriptStartOneBased], rec[TranscriptEndOneBased], rec[TranscriptLengthIncludingUTRAndCDS], strand})
	}
	if len(results) < 1 {
		return fmt.Errorf("No results were found for %s. Were you using a transcript name instead of a gene name?", geneName)
	}
	fmt.Println("Gene\tChromosome\tTranscriptStart\tTranscriptEnd\tTranscriptLength\tStrand")
	for _, result := range results {
		fmt.Println(strings.Join(result, "\t"))
	}
	return nil
}
func LookupTranscripts ( geneName string ) error { lookups := packr . NewBox ( " " ) file := lookups . Bytes ( " " ) buf := bytes . NewBuffer ( file ) cr := csv . NewReader ( buf ) cr . Comma = '\t' results := make ( [ ] [ ] string , 0 ) header := make ( [ ] string , 0 ) var i int64 for { rec , err := cr . Read ( ) if err != nil && err == io . EOF { break } else if err != nil { return err } i ++ if i == 1 { header = append ( header , rec ... ) continue } if len ( rec [ Chromosome ] ) > 2 { continue } if rec [ GeneName ] != geneName { continue } strand := " " if rec [ Strand ] == " " { strand = " " } results = append ( results , [ ] string { rec [ GeneName ] , rec [ Chromosome ] , rec [ TranscriptStartOneBased ] , rec [ TranscriptEndOneBased ] , rec [ TranscriptLengthIncludingUTRAndCDS ] , strand } ) } if len ( results ) < 1 { return fmt . Errorf ( " " , geneName ) } fmt . Println ( " \t \t \t \t \t " ) for _ , result := range results { fmt . Println ( strings . Join ( result , " \t " ) ) } return nil }
Fetches all transcripts for a named symbol
Fetches all transcripts for a named symbol
// Longer chromosome names probably represent patches, which we are // not equipped to handle.