Hi,

it was not clear from your first message that you wanted to move CEL
files (there are many Affymetrix files that have a chip type).

The most low-level way to query a CEL file for its chip type is
provided by the affxparser package:

library(affxparser);
pathnames <- list.files(path=dataPath, pattern="[.](cel|CEL)$",
full.names=TRUE, recursive=TRUE);
chipTypes <- sapply(pathnames, function(pathname) {
  readCelHeader(pathname)$chiptype;
});

/Henrik


On Tue, Jul 7, 2009 at 10:46 AM, mbaudis<mbau...@gmail.com> wrote:
>
> This is a comment to my own question. I basically went for a Q&D Perl
> solution. Pls. be aware of the different path requirements if using
> Windows.
>
> Michael.
>
> ###############################################################################################
> # array type sorter for the aroma.affymetrix data structure
> # script is run from within a directory inside the Aroma root; pls.
> adjust
> # and be careful with the rename paths ...
> # Michael Baudis 2009, www.progenetix.net
> ###############################################################################################
>
> #!/usr/bin/perl
> use strict;
>
> my $dataSet = $ARGV[0];
> unless ($dataSet) {die;}
> my $dataPath = '../rawData/'.$dataSet;
>
> my $annotationPath = '../annotationData/chipTypes';
>
> opendir ANNOTATIONROOT, "$annotationPath";
> my @chipTypes = grep {/[^.]/} readdir(ANNOTATIONROOT);
> close ANNOTATIONROOT;
>
> opendir CELFILES, "$dataPath";
> my @celFileNames = grep {/\.CEL/} readdir(CELFILES);
> close CELFILES;
>
> foreach my $celfileName (@celFileNames) {
>        open CELFILE, "$dataPath/$celfileName";
>        my @celFileContent = <CELFILE>;
>        close CELFILE;
>        foreach my $chipType (@chipTypes) {
>                if (grep /$chipType/, @celFileContent) {
>                        if (-e "$dataPath/$chipType") {
>                        } else {
>                                mkdir("$dataPath/$chipType");
>                        }
>                        rename("$dataPath/$celfileName", "$dataPath/$chipType/
> $celfileName");
>                }
>        }
> }
> >
>

--~--~---------~--~----~------------~-------~--~----~
When reporting problems on aroma.affymetrix, make sure 1) to run the latest 
version of the package, 2) to report the output of sessionInfo() and 
traceback(), and 3) to post a complete code example.


You received this message because you are subscribed to the Google Groups 
"aroma.affymetrix" group.
To post to this group, send email to aroma-affymetrix@googlegroups.com
To unsubscribe from this group, send email to 
aroma-affymetrix-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/aroma-affymetrix?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to