Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import csv
- # Read in list of gene identifiers
- geneinfile = open('gene_ids.txt', 'r')
- # create list "currentgene" stripping whitespace and separating by newline, then closing file
- currentgene = geneinfile.read().strip().split('\n')
- geneinfile.close()
- #print (currentgene)
- #define function to search csv pages
- def expressionsearch(page):
- open(page, 'r')
- # read in values from columns 1 & 10 from expression sheet
- identifier = sh.col_values(0)
- foldex = sh.col_values(9)
- x = 0
- # uses for loop to read through "identifier" and if loop to identify presence of "clnID"
- for line in identifier:
- tissue = sheet.strip("TGAC_gene_exp_")
- if line == clnID:
- print "Gene " indentifier.pop(x) "has " foldex.pop(x) "expression in " tissue.strip(".csv")
- else x = x + 1
- # generate IDs in same format as spreadsheet
- for gene in currentgene:
- clnID = gene.strip("Ms_v2_scaf_")
- # commit tissue files to array and run function on genes in .txt file for all three tissues
- sheet = ["TGAC_gene_exp_rhizome.csv" "TGAC_gene_exp_stem.csv" "TGAC_gene_exp_leaf.csv"]
- for page in sheet:
- expressionsearch(page)
- close(page)
Add Comment
Please, Sign In to add comment