-
-
Save mcandre/6222139 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# sample data: | |
# | |
# row_num,gene_id,ensembl_gene_symbol,gene_symbol,entrez_id | |
# 1,66982,"ENSG00000000003","TSPAN6",7105 | |
# 2,66983,"ENSG00000000005","TNMD",64102 | |
# 3,66984,"ENSG00000000419","DPM1",8813 | |
# 4,66985,"ENSG00000000457","SCYL3",57147 | |
# ... | |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my ($gene, $info, @info, $row, $data, @data, $opt); | |
$gene = $ARGV[0]; $opt = $ARGV[1]; | |
$info = `cat genes_rows_metadata.csv |egrep -w $gene`; | |
chomp($info); | |
@info = split(",",$info); | |
$row = $info[0]; | |
$info = join("\t",@info); | |
$data = `cat genes_matrix.csv |head -$row |tail -1`; | |
chomp($data); | |
@data = split(",",$data); | |
$data = join("\t",@data[1..$#data]); | |
if ($opt == 2 && $info[1] == $data[0]) { | |
print "$info[3]\t$data\n"; | |
} | |
elsif ($opt == 1) { | |
print "$info\t$data[0]\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment