func FetchGenes() ([]Gene, error) {
	fileBytes, err := embeddedTemplates.ReadFile(fmt.Sprintf("lookups/%s", BioMartFilename))
	if err != nil {
		return nil, pfx.Err(err)
	}

	buf := bytes.NewReader(fileBytes)
	cr := csv.NewReader(buf)
	cr.Comma = '\t'
	cr.Comment = '#'

	results := make([]Gene, 0)

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

		i++
		if i == 1 {
			continue
		}

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

		// Note: this excludes proteins like ABO, so removing this.
		// if strings.TrimSpace(rec[ProteinStableID]) == "" {
		// // No protein product - not relevant to this program.
		// continue
		// }

		start, err := strconv.Atoi(rec[TranscriptStartOneBased])
		if err != nil {
			return nil, err
		}

		end, err := strconv.Atoi(rec[TranscriptEndOneBased])
		if err != nil {
			return nil, err
		}

		// Reverse start and end for minus strand
		if rec[Strand] == "-1" {
			start, end = end, start
		}

		results = append(results, Gene{Symbol: rec[GeneName], Chromosome: rec[Chromosome], EarliestTranscriptStart: start, LatestTranscriptEnd: end})
	}

	return results, nil
}
// FetchGenes pulls in all transcripts
FetchGenes pulls in all transcripts
// FetchGenes pulls in all transcripts
func FetchGenes() ([]Gene, error) {
	fileBytes, err := embeddedTemplates.ReadFile(fmt.Sprintf("lookups/%s", BioMartFilename))
	if err != nil {
		return nil, pfx.Err(err)
	}
	buf := bytes.NewReader(fileBytes)
	cr := csv.NewReader(buf)
	cr.Comma = '\t'
	cr.Comment = '#'
	results := make([]Gene, 0)
	var i int64
	for {
		rec, err := cr.Read()
		if err != nil && err == io.EOF {
			break
		} else if err != nil {
			return nil, err
		}
		i++
		if i == 1 {
			continue
		}
		if len(rec[Chromosome]) > 2 {
			continue
		}
		start, err := strconv.Atoi(rec[TranscriptStartOneBased])
		if err != nil {
			return nil, err
		}
		end, err := strconv.Atoi(rec[TranscriptEndOneBased])
		if err != nil {
			return nil, err
		}
		if rec[Strand] == "-1" {
			start, end = end, start
		}
		results = append(results, Gene{Symbol: rec[GeneName], Chromosome: rec[Chromosome], EarliestTranscriptStart: start, LatestTranscriptEnd: end})
	}
	return results, nil
}
func FetchGenes ( ) ( [ ] Gene , error ) { fileBytes , err := embeddedTemplates . ReadFile ( fmt . Sprintf ( " " , BioMartFilename ) ) if err != nil { return nil , pfx . Err ( err ) } buf := bytes . NewReader ( fileBytes ) cr := csv . NewReader ( buf ) cr . Comma = '\t' cr . Comment = '#' results := make ( [ ] Gene , 0 ) var i int64 for { rec , err := cr . Read ( ) if err != nil && err == io . EOF { break } else if err != nil { return nil , err } i ++ if i == 1 { continue } if len ( rec [ Chromosome ] ) > 2 { continue } start , err := strconv . Atoi ( rec [ TranscriptStartOneBased ] ) if err != nil { return nil , err } end , err := strconv . Atoi ( rec [ TranscriptEndOneBased ] ) if err != nil { return nil , err } if rec [ Strand ] == " " { start , end = end , start } results = append ( results , Gene { Symbol : rec [ GeneName ] , Chromosome : rec [ Chromosome ] , EarliestTranscriptStart : start , LatestTranscriptEnd : end } ) } return results , nil }
FetchGenes pulls in all transcripts
FetchGenes pulls in all transcripts
// Longer chromosome names probably represent patches, which we are // not equipped to handle. // Note: this excludes proteins like ABO, so removing this. // if strings.TrimSpace(rec[ProteinStableID]) == "" { // // No protein product - not relevant to this program. // continue // } // Reverse start and end for minus strand