IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Perl Discussion :

parsing de fichiers texte


Sujet :

Langage Perl

  1. #1
    Membre du Club
    Femme Profil pro
    Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Inscrit en
    Mars 2012
    Messages
    69
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2012
    Messages : 69
    Points : 68
    Points
    68
    Par défaut parsing de fichiers texte
    Bonjour,
    J'aimerais faire du parsing de fichiers texte mais je ne sait pas comment m'y prendre.
    j'ai plusieurs fichiers de comparaison :
    au début j'ai quelques fichiers du type ecantillon1,echantillon2....
    après comparaison de fichiers deux a deux j'obtiens des fichiers de la forme
    echantillon1_echantillon1.txt
    echantillon1_echantillon2.txt
    echantillon1_echantillon3.txt
    ...
    echantillon2_echantillon1.txt
    echantillon2_echantillon2.txt
    echantillon2_echantillon3.txt

    A partir de ces fichiers la j'aimerai les regrouper en fonction du début de leur nom commun cad de faire un fichier echantillon1_vs_tous , echantillon2_vs_tous.
    J'ai une grande quantité de fichiers car je pourrais avoir jusqu’à 100 échantillons et chaque fichier contient 999 lignes.
    D'ou l'utilité d'un script "d'automatisation".
    Quelqu'un pourrait il m'aider?
    Merci

  2. #2
    Membre averti
    Avatar de magicshark
    Homme Profil pro
    Dans une SS2I donc pas que JAVA
    Inscrit en
    Octobre 2011
    Messages
    133
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Dans une SS2I donc pas que JAVA
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 133
    Points : 320
    Points
    320
    Par défaut
    Bonjour je comprend pas tout tout quel est le résultat souhaitez ...
    Pourquoi faire simple quand on peut faire compliqué.

  3. #3
    Membre du Club
    Femme Profil pro
    Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Inscrit en
    Mars 2012
    Messages
    69
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2012
    Messages : 69
    Points : 68
    Points
    68
    Par défaut parsing de fichiers
    Par exemple j'aimerai regrouper tous les résultats des fichiers dont le début du nom est identique :
    les fichiers de départ sont :
    echantillon1-echantillon1
    echantillon1-echantillon2
    echantillon1-echantillon3
    echantillon1-echantillon4

    dans chacun de ses fichiers j'ai une colonne de 999 éléments
    Et j'aimerai regrouper ces 4 fichiers en un seul du type
    element1 1-1 1-2 1-3 1-4
    element2 1-1 1-2 1-3 1-4
    element3 1-1 1-2 1-3 1-4
    ....
    element999 1-1 1-2 1-3 1-4

  4. #4
    Membre averti
    Avatar de magicshark
    Homme Profil pro
    Dans une SS2I donc pas que JAVA
    Inscrit en
    Octobre 2011
    Messages
    133
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Dans une SS2I donc pas que JAVA
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 133
    Points : 320
    Points
    320
    Par défaut
    t'es fichiers sont sous quel système d'exploitation ?
    Pourquoi faire simple quand on peut faire compliqué.

  5. #5
    Membre du Club
    Femme Profil pro
    Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Inscrit en
    Mars 2012
    Messages
    69
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2012
    Messages : 69
    Points : 68
    Points
    68
    Par défaut parsing de fichiers txt
    Ce sont des fichiers sous linux

  6. #6
    Membre averti
    Avatar de magicshark
    Homme Profil pro
    Dans une SS2I donc pas que JAVA
    Inscrit en
    Octobre 2011
    Messages
    133
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Dans une SS2I donc pas que JAVA
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 133
    Points : 320
    Points
    320
    Par défaut
    pour recuperer chaque fichiers dont le nom est "echantillon?.txt" une commande find est pas mal sinon s'il sont tous regrouper et qu'il n'y a qu'eux dans le dossier un "ls" serai mieux.

    par contre après je vois pas trop ce que tu veux dans le fichier
    si
    echantillon1.txt =1-1 1-2 1-3 1-4
    echantillon2.txt =1-1 1-2 1-1 1-4
    le résultat sera ?
    (j'ai du louper une partie importante.)
    Pourquoi faire simple quand on peut faire compliqué.

  7. #7
    Membre du Club
    Femme Profil pro
    Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Inscrit en
    Mars 2012
    Messages
    69
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2012
    Messages : 69
    Points : 68
    Points
    68
    Par défaut parsing de fichiers txt
    J'ai 5 échantillons
    Je les compare 2 a 2
    J'obtiens donc les fichiers suivants
    echantillon 1-echantillon 1
    ech 1-ech 2
    ech 1-ech 3
    ech 1-ech 4
    ech 1-ech 5

    ech 2-ech 1
    ech 2-ech 2
    ech 2 -ech 3
    ech2 -ech 4
    ech 2 -ech 5
    .....
    Chaque fichier ech?-ech? contient une colonne de 999 éléments
    J'aimerai obtenir un fichier de type matrice du type
    ech 1 ech 2 ech 3 ech4 ech5
    ech 1 XXX XXX XXX XXX XXX
    XXX XXX XXX XXX XXX
    XXX XXX XXX XXX XXX
    ....


    Puis un autre
    ech 1 ech 2 ech 3 ech4 ech5
    ech 2

  8. #8
    Expert confirmé

    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2009
    Messages
    3 577
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 577
    Points : 5 753
    Points
    5 753
    Par défaut
    Ca n'est toujours pas clair... car tu mélanges la description de ce qui existe déjà, avec la description de ce que tu voudrais faire.
    Pour ton nouveau script de regroupement, combien de fichiers seront en entrée ?
    Montre un exemple concret de ce que contiendra ce ou ces fichiers et de son nom exact.
    A partir de ce ou ces fichiers d'exemple, montre ce que tu souhaites obtenir en résultat, mais sans nous embrouiller l'esprit avec ce qui a permis de produire les fichiers d'entrée de ton nouveau script.
    Plus j'apprends, et plus je mesure mon ignorance (philou67430)
    Toute technologie suffisamment avancée est indiscernable d'un script Perl (Llama book)
    Partagez vos problèmes pour que l'on partage ensemble nos solutions : je ne réponds pas aux questions techniques par message privé
    Si c'est utile, say

  9. #9
    Membre du Club
    Femme Profil pro
    Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Inscrit en
    Mars 2012
    Messages
    69
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur d'étude et de développement en bioinformatique en recherche d'emploi
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2012
    Messages : 69
    Points : 68
    Points
    68
    Par défaut parsing de fichiers txt
    Mes fichiers de départ sont les suivants:
    normCov_normalisations_echantillon_CNV_repartis.txt_normCov_normalisations_echantillon_CNV_repartis.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_repartis.txt_normCov_normalisations_echantillon_CNV_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_repartis.txt_normCov_normalisations_echantillon_CNV.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_repartis.txt_normCov_normalisations_echantillon_deletion.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_repartis.txt_normCov_normalisations_echantillon_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_SNP.txt_normCov_normalisations_echantillon_CNV_repartis.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_SNP.txt_normCov_normalisations_echantillon_CNV_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_SNP.txt_normCov_normalisations_echantillon_CNV.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_SNP.txt_normCov_normalisations_echantillon_deletion.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV_SNP.txt_normCov_normalisations_echantillon_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV.txt_normCov_normalisations_echantillon_CNV_repartis.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV.txt_normCov_normalisations_echantillon_CNV_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV.txt_normCov_normalisations_echantillon_CNV.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV.txt_normCov_normalisations_echantillon_deletion.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_CNV.txt_normCov_normalisations_echantillon_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_deletion.txt_normCov_normalisations_echantillon_CNV_repartis.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_deletion.txt_normCov_normalisations_echantillon_CNV_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_deletion.txt_normCov_normalisations_echantillon_CNV.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_deletion.txt_normCov_normalisations_echantillon_deletion.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_deletion.txt_normCov_normalisations_echantillon_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_SNP.txt_normCov_normalisations_echantillon_CNV_repartis.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_SNP.txt_normCov_normalisations_echantillon_CNV_SNP.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_SNP.txt_normCov_normalisations_echantillon_CNV.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_SNP.txt_normCov_normalisations_echantillon_deletion.txt_comp_intervalle_logR.txt
    normCov_normalisations_echantillon_SNP.txt_normCov_normalisations_echantillon_SNP.txt_comp_intervalle_logR.txt

    Je voulais regrouper tous les
    normCov_normalisations_echantillon_CNV_repartis.txt_* ensemble
    normCov_normalisations_echantillon_CNV_SNP.txt_* ensemble
    normCov_normalisations_echantillon_CNV.txt_* ensemble
    normCov_normalisations_echantillon_SNP_repartis.txt_* ensemble
    normCov_normalisations_echantillon_deletion_repartis.txt_* ensemble

    Et j'ai réussi a parser mes fichiers a l'aide d'un script R intégré dans mon script perl.
    MERCI
    bon week end

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. parsing de fichier texte log
    Par shalfat dans le forum Langage
    Réponses: 16
    Dernier message: 19/06/2014, 10h00
  2. Parsing de fichier texte
    Par gege2009 dans le forum C++
    Réponses: 10
    Dernier message: 22/12/2010, 14h32
  3. Parsing de fichiers texte
    Par ChristopheD dans le forum Entrée/Sortie
    Réponses: 1
    Dernier message: 29/07/2010, 02h50
  4. parsing de fichier texte
    Par robert_trudel dans le forum Access
    Réponses: 4
    Dernier message: 03/06/2006, 17h45
  5. Parsing d'un fichier texte
    Par anibal dans le forum C
    Réponses: 2
    Dernier message: 18/04/2006, 14h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo