我需要幫助解析文本文件CSV。我的文本文件看起來像這樣:解析文本文件以CSV在python
12: IBD08; ANALYSIS AND CHARACTERISATION OF THE FAECAL MICROBIAL DEGRADOME IN INFLAMMATORY BOWEL DISEASE
Identifiers: BioSample: SAMEA3914946; SRA: ERS1102080
Organism: Homo sapiens
Attributes:
/sample name="ERS1102080"
/collection date="2011"
/environment biome="Intestine"
/environment feature="Colon"
/environment material="Faecal"
/geographic location (country and/or sea)="United Kingdom"
/host body product="Faeces"
/host disease status="Healthy"
/human gut environmental package="human-gut"
/investigation type="metagenome"
/latitude (raw)="51??31'03.3"
/longitude (raw)="0??10'25.2"
/project name="IBD gut"
/sequencing method="Illumina Miseq"
Description:
Multi 'omic analysis of the gut microbiome in IBD
Accession: SAMEA3914946 ID: 5788180
2: qiita_sid_833:833.Sweden.IBD.102A; 833.Sweden.IBD.102A
Identifiers: BioSample: SAMEA3924619; SRA: ERS1111753
Organism: gut metagenome
Attributes:
/sample name="ERS1111753"
/sex="male"
/age="3.9"
/age group="2.0"
/age unit="years"
/altitude="0"
/anonymized name="Sweden.IBD.102A"
/antibiotics="definite_no"
/assigned from geo="False"
/barcodesequence="CTGCTATTCCTC"
/body habitat="UBERON:feces"
/body product="UBERON:feces"
/tissue="UBERON:feces"
/breed="Great_Dane"
/breed grouping="Working"
/collection date="1/30/12"
/collection timestamp="1/30/12"
/common name="gut metagenome"
/geographic location="Sweden: GAZ"
/depth="0"
/disease="IBD"
/dna extracted="True"
/elevation="13.02"
/emp status="NOT_EMP"
/environment biome="ENVO:urban biome"
/environment feature="ENVO:animal-associated habitat"
/env matter="ENVO:feces"
/experiment center="Texas A&M"
/experiment design description="Fecal samples from dogs of various breeds, places of origin, and severity of bowel disorder were sequencing to obtain a dog gut metagenome."
/experiment title="suchodolski_dog_ibd"
/gender specific="M"
/has extracted data="True"
/has physical specimen="True"
/histo="both"
/host="domestic dog"
/host="Canis lupus familiaris"
/host subject id="Sweden.IBD.102A"
/host taxonomy ID="9615"
/illumina technology="HiSeq"
/latitude="60.13"
/library construction protocol="This analysis was done as in Caporaso et al 2011 Genome research. The PCR primers F515 and R806 were developed against the V4 region of the 16S rRNA, both bacteria and archaea, which we determined would yield optimal community clustering with reads of this length The reverse PCR primer is barcoded with a 12-base error-correcting Golay code to facilitate multiplexing of up to 1,500 samples per lane, and both PCR primers contain sequencer adapter regions."
/linker="GT"
/linkerprimersequence="GTGCCAGCMGCCGCGGTAA"
/longitude="18.64"
/pcr primers="FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT"
/physical location="CCME"
/physical specimen location="Texas A&M"
/physical specimen remaining="False"
/platform="Illumina"
/platformchemistry="HiSeq_V4"
/pool name="R.K.1.20.12"
/primer plate="1"
/public="False"
/required sample info status="completed"
/run center="CCME"
/run date="1/30/12"
/run prefix="Suchodolski_dog_ibd"
/sample size="0.1, gram"
/sample center="Texas A&M"
/sample plate="IBD1"
/sequencing meth="sequencing by synthesis"
/size grouping="large"
/study center="Texas A&M"
/target gene="16S rRNA"
/target subfragment="V4"
/title="Suchodolski_dog_ibd"
/total mass="54.0"
/weight group="5.0"
/weight kg="54.0"
/well id="H6"
Description:
IBD1_Sweden_IBD_102A_H6_R.K.1.20.12
Accession: SAMEA3924619 ID: 5507372
輸出格式: 項目名稱生物標本SRA生物樣品名稱等... IBD08 SAMEA3914946 ERS1102080智人ERS1102080
每個項目都具有不同的字段。如何製作所有項目中的每個領域的專欄。在此先感謝
是你想達到什麼樣的輸出格式?請編輯該問題以包含此內容。 –
[Python的解析CSV正確(https://stackoverflow.com/questions/12296585/python-parse-csv-correctly) –