Previous changeset 4:1fc014126d55 (2013-01-18) Next changeset 6:769e306b7933 (2013-01-18) |
Commit message:
Deleted selected files |
removed:
smart_toolShed/README.txt smart_toolShed/SMART/Java/File.java smart_toolShed/SMART/Java/Files.java smart_toolShed/SMART/Java/FormatType.java smart_toolShed/SMART/Java/FormatsContainer.java smart_toolShed/SMART/Java/FormatsReader.java smart_toolShed/SMART/Java/Global.java smart_toolShed/SMART/Java/Installer/Old/PasswordAsker.java smart_toolShed/SMART/Java/Installer/Old/SmartInstaller.java smart_toolShed/SMART/Java/Installer/Old/SmartInstallerTask.java smart_toolShed/SMART/Java/Installer/PasswordAsker.java smart_toolShed/SMART/Java/Installer/SmartInstaller.jar smart_toolShed/SMART/Java/Installer/SmartInstaller.java smart_toolShed/SMART/Java/Installer/SmartInstallerTask.java smart_toolShed/SMART/Java/Installer/build.sh smart_toolShed/SMART/Java/Installer/manifest.txt smart_toolShed/SMART/Java/Installer/s-mart.zip smart_toolShed/SMART/Java/LICENSE.txt smart_toolShed/SMART/Java/Program.java smart_toolShed/SMART/Java/ProgramFileReader.java smart_toolShed/SMART/Java/ProgramLauncher.java smart_toolShed/SMART/Java/ProgramOption.java smart_toolShed/SMART/Java/Python/.gitignore smart_toolShed/SMART/Java/Python/CleanTranscriptFile.py smart_toolShed/SMART/Java/Python/ClusterizeByTags.py smart_toolShed/SMART/Java/Python/CollapseReads.py smart_toolShed/SMART/Java/Python/CombineTags.py smart_toolShed/SMART/Java/Python/CompareOverlapping.py smart_toolShed/SMART/Java/Python/CompareOverlappingSmallQuery.py smart_toolShed/SMART/Java/Python/CompareOverlappingSmallRef.py smart_toolShed/SMART/Java/Python/ComputeCoverage.py smart_toolShed/SMART/Java/Python/CountReadGCPercent.py smart_toolShed/SMART/Java/Python/FindOverlapsOptim.py smart_toolShed/SMART/Java/Python/GetDifferentialExpression.py smart_toolShed/SMART/Java/Python/GetDistribution.py smart_toolShed/SMART/Java/Python/GetFlanking.py smart_toolShed/SMART/Java/Python/GetRandomSubset.py smart_toolShed/SMART/Java/Python/GetReadDistribution.py smart_toolShed/SMART/Java/Python/GetReadSizes.py smart_toolShed/SMART/Java/Python/GetUpDownStream.py smart_toolShed/SMART/Java/Python/RestrictFromCoverage.py smart_toolShed/SMART/Java/Python/SelectByTag.py smart_toolShed/SMART/Java/Python/WrappGetDistribution.py smart_toolShed/SMART/Java/Python/WrappGetReadDistribution.py smart_toolShed/SMART/Java/Python/WrappPlotCoverage.py smart_toolShed/SMART/Java/Python/WrappPlotRepartition.py smart_toolShed/SMART/Java/Python/__init__.py smart_toolShed/SMART/Java/Python/__init__.pyc smart_toolShed/SMART/Java/Python/adaptorStripper.py smart_toolShed/SMART/Java/Python/changeGffFeatures.sh smart_toolShed/SMART/Java/Python/changeTagName.py smart_toolShed/SMART/Java/Python/cleanGff.py smart_toolShed/SMART/Java/Python/cleaning/CleanerChooser.py smart_toolShed/SMART/Java/Python/cleaning/DefaultCleaner.py smart_toolShed/SMART/Java/Python/cleaning/GffCleaner.py smart_toolShed/SMART/Java/Python/cleaning/GtfCleaner.py smart_toolShed/SMART/Java/Python/cleaning/TranscriptListCleaner.py smart_toolShed/SMART/Java/Python/cleaning/__init__.py smart_toolShed/SMART/Java/Python/clusterize.py smart_toolShed/SMART/Java/Python/clusterizeBySlidingWindows.py smart_toolShed/SMART/Java/Python/compareOverlapping.py smart_toolShed/SMART/Java/Python/convertTranscriptFile.py smart_toolShed/SMART/Java/Python/coordinatesToSequence.py smart_toolShed/SMART/Java/Python/fastqToFasta.py smart_toolShed/SMART/Java/Python/findTss.py smart_toolShed/SMART/Java/Python/fold.py smart_toolShed/SMART/Java/Python/getDifference.py smart_toolShed/SMART/Java/Python/getDistance.py smart_toolShed/SMART/Java/Python/getDistribution.py smart_toolShed/SMART/Java/Python/getElement.py smart_toolShed/SMART/Java/Python/getExons.py smart_toolShed/SMART/Java/Python/getInfoPerCoverage.py smart_toolShed/SMART/Java/Python/getIntrons.py smart_toolShed/SMART/Java/Python/getLetterDistribution.py smart_toolShed/SMART/Java/Python/getNb.py smart_toolShed/SMART/Java/Python/getRandomRegions.py smart_toolShed/SMART/Java/Python/getReadDistribution.py smart_toolShed/SMART/Java/Python/getSequence.py smart_toolShed/SMART/Java/Python/getSizes.py smart_toolShed/SMART/Java/Python/getWigData.py smart_toolShed/SMART/Java/Python/getWigDistance.py smart_toolShed/SMART/Java/Python/getWigProfile.py smart_toolShed/SMART/Java/Python/mapperAnalyzer.py smart_toolShed/SMART/Java/Python/mappingToCoordinates.py smart_toolShed/SMART/Java/Python/mergeSlidingWindowsClusters.py smart_toolShed/SMART/Java/Python/mergeTranscriptLists.py smart_toolShed/SMART/Java/Python/misc/MultipleRPlotter.py smart_toolShed/SMART/Java/Python/misc/Progress.py smart_toolShed/SMART/Java/Python/misc/Progress.pyc smart_toolShed/SMART/Java/Python/misc/RPlotter.py smart_toolShed/SMART/Java/Python/misc/UnlimitedProgress.py smart_toolShed/SMART/Java/Python/misc/UnlimitedProgress.pyc smart_toolShed/SMART/Java/Python/misc/Utils.py smart_toolShed/SMART/Java/Python/misc/Utils.pyc smart_toolShed/SMART/Java/Python/misc/__init__.py smart_toolShed/SMART/Java/Python/misc/__init__.pyc smart_toolShed/SMART/Java/Python/misc/test/Test_Utils.py smart_toolShed/SMART/Java/Python/misc/test/__init__.py smart_toolShed/SMART/Java/Python/modifyFasta.py smart_toolShed/SMART/Java/Python/modifyGenomicCoordinates.py smart_toolShed/SMART/Java/Python/modifySequenceList.py smart_toolShed/SMART/Java/Python/mySql/MySqlConnection.py smart_toolShed/SMART/Java/Python/mySql/MySqlExonTable.py smart_toolShed/SMART/Java/Python/mySql/MySqlExonTable.pyc smart_toolShed/SMART/Java/Python/mySql/MySqlQuery.py smart_toolShed/SMART/Java/Python/mySql/MySqlTable.py smart_toolShed/SMART/Java/Python/mySql/MySqlTable.pyc smart_toolShed/SMART/Java/Python/mySql/MySqlTranscriptTable.py smart_toolShed/SMART/Java/Python/mySql/MySqlTranscriptTable.pyc smart_toolShed/SMART/Java/Python/mySql/__init__.py smart_toolShed/SMART/Java/Python/mySql/__init__.pyc smart_toolShed/SMART/Java/Python/mySql/test/Test_MySqlTranscriptTable.py smart_toolShed/SMART/Java/Python/mySql/test/__init__.py smart_toolShed/SMART/Java/Python/ncList/ConvertToNCList.py smart_toolShed/SMART/Java/Python/ncList/FileSorter.py smart_toolShed/SMART/Java/Python/ncList/FindOverlapsWithOneInterval.py smart_toolShed/SMART/Java/Python/ncList/FindOverlapsWithSeveralIntervals.py smart_toolShed/SMART/Java/Python/ncList/FindOverlapsWithSeveralIntervalsBin.py smart_toolShed/SMART/Java/Python/ncList/FindOverlapsWithSeveralIntervalsIndex.py smart_toolShed/SMART/Java/Python/ncList/FindOverlaps_naif.py smart_toolShed/SMART/Java/Python/ncList/NCIndex.py smart_toolShed/SMART/Java/Python/ncList/NCIndex.pyc smart_toolShed/SMART/Java/Python/ncList/NCList.py smart_toolShed/SMART/Java/Python/ncList/NCList.pyc smart_toolShed/SMART/Java/Python/ncList/NCListCursor.py smart_toolShed/SMART/Java/Python/ncList/NCListCursor.pyc smart_toolShed/SMART/Java/Python/ncList/NCListFilePickle.py smart_toolShed/SMART/Java/Python/ncList/NCListFilePickle.pyc smart_toolShed/SMART/Java/Python/ncList/NCListHandler.py smart_toolShed/SMART/Java/Python/ncList/NCListMerger.py smart_toolShed/SMART/Java/Python/ncList/NCListParser.py smart_toolShed/SMART/Java/Python/ncList/__init__.py smart_toolShed/SMART/Java/Python/ncList/__init__.pyc smart_toolShed/SMART/Java/Python/ncList/test/MockFindOverlapsWithSeveralIntervals.py smart_toolShed/SMART/Java/Python/ncList/test/MockFindOverlaps_randomExample.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_FileSorter.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_FindOverlapsWithOneInterval.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_FindOverlapsWithSeveralIntervals.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_FindOverlaps_naif.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_FindOverlaps_randomExample.py smart_toolShed/SMART/Java/Python/ncList/test/Test_F_NCList.py smart_toolShed/SMART/Java/Python/ncList/test/Test_FindOverlapsWithOneInterval.py smart_toolShed/SMART/Java/Python/ncList/test/Test_FindOverlapsWithSeveralIntervals.py smart_toolShed/SMART/Java/Python/ncList/test/Test_FindOverlaps_randomExample.py smart_toolShed/SMART/Java/Python/ncList/test/Test_randExample.py smart_toolShed/SMART/Java/Python/ncList/test/__init__.py smart_toolShed/SMART/Java/Python/plot.py smart_toolShed/SMART/Java/Python/plotCoverage.py smart_toolShed/SMART/Java/Python/plotCsv.py smart_toolShed/SMART/Java/Python/plotGenomeCoverage.py smart_toolShed/SMART/Java/Python/plotRepartition.py smart_toolShed/SMART/Java/Python/plotTranscriptList.py smart_toolShed/SMART/Java/Python/qualToFastq.py smart_toolShed/SMART/Java/Python/removeAllTmpTables.py smart_toolShed/SMART/Java/Python/removeEmptySequences.py smart_toolShed/SMART/Java/Python/removeExonLines.sh smart_toolShed/SMART/Java/Python/repetGffConverter.py smart_toolShed/SMART/Java/Python/restrictFromNucleotides.py smart_toolShed/SMART/Java/Python/restrictFromSize.py smart_toolShed/SMART/Java/Python/restrictSequenceList.py smart_toolShed/SMART/Java/Python/restrictTranscriptList.py smart_toolShed/SMART/Java/Python/runRandomJobs.py smart_toolShed/SMART/Java/Python/selectByNbOccurrences.py smart_toolShed/SMART/Java/Python/sequenceListSplitter.py smart_toolShed/SMART/Java/Python/splitByTag.py smart_toolShed/SMART/Java/Python/splitMultiFasta.py smart_toolShed/SMART/Java/Python/structure/Bins.py smart_toolShed/SMART/Java/Python/structure/Bins.pyc smart_toolShed/SMART/Java/Python/structure/Interval.py smart_toolShed/SMART/Java/Python/structure/Interval.pyc smart_toolShed/SMART/Java/Python/structure/Mapping.py smart_toolShed/SMART/Java/Python/structure/Mapping.pyc smart_toolShed/SMART/Java/Python/structure/Sequence.py smart_toolShed/SMART/Java/Python/structure/Sequence.pyc smart_toolShed/SMART/Java/Python/structure/SequenceList.py smart_toolShed/SMART/Java/Python/structure/SequenceList.pyc smart_toolShed/SMART/Java/Python/structure/SubMapping.py smart_toolShed/SMART/Java/Python/structure/SubMapping.pyc smart_toolShed/SMART/Java/Python/structure/Transcript.py smart_toolShed/SMART/Java/Python/structure/Transcript.pyc smart_toolShed/SMART/Java/Python/structure/TranscriptContainer.py smart_toolShed/SMART/Java/Python/structure/TranscriptContainer.pyc smart_toolShed/SMART/Java/Python/structure/TranscriptList.py smart_toolShed/SMART/Java/Python/structure/TranscriptList.pyc smart_toolShed/SMART/Java/Python/structure/TranscriptListIterator.py smart_toolShed/SMART/Java/Python/structure/TranscriptListsComparator.py smart_toolShed/SMART/Java/Python/structure/__init__.py smart_toolShed/SMART/Java/Python/structure/__init__.pyc smart_toolShed/SMART/Java/Python/structure/test/Test_Interval.py smart_toolShed/SMART/Java/Python/structure/test/Test_Mapping.py smart_toolShed/SMART/Java/Python/structure/test/Test_Sequence.py smart_toolShed/SMART/Java/Python/structure/test/Test_SubMapping.py smart_toolShed/SMART/Java/Python/structure/test/Test_Transcript.py smart_toolShed/SMART/Java/Python/structure/test/Test_TranscriptListsComparator.py smart_toolShed/SMART/Java/Python/structure/test/__init__.py smart_toolShed/SMART/Java/Python/testInstall.py smart_toolShed/SMART/Java/Python/toolLauncher/RnaFoldLauncher.py smart_toolShed/SMART/Java/Python/toolLauncher/__init__.py smart_toolShed/SMART/Java/Python/trimAdaptor.py smart_toolShed/SMART/Java/Python/trimSequence.py smart_toolShed/SMART/Java/Python/trimSequences.py smart_toolShed/SMART/Java/Python/txtToFasta.py smart_toolShed/SMART/Java/Python/updateQual.py smart_toolShed/SMART/Java/Python/wigExploder.py smart_toolShed/SMART/Java/Python/wrongFastqToQual.py smart_toolShed/SMART/Java/PythonHelperReader.java smart_toolShed/SMART/Java/PythonProgramFinder.java smart_toolShed/SMART/Java/Sav/File.java smart_toolShed/SMART/Java/Sav/Files.java smart_toolShed/SMART/Java/Sav/FormatType.java smart_toolShed/SMART/Java/Sav/FormatsContainer.java smart_toolShed/SMART/Java/Sav/FormatsReader.java smart_toolShed/SMART/Java/Sav/Global.java smart_toolShed/SMART/Java/Sav/Program.java smart_toolShed/SMART/Java/Sav/ProgramFileReader.java smart_toolShed/SMART/Java/Sav/ProgramLauncher.java smart_toolShed/SMART/Java/Sav/ProgramOption.java smart_toolShed/SMART/Java/Sav/PythonHelperReader.java smart_toolShed/SMART/Java/Sav/PythonProgramFinder.java smart_toolShed/SMART/Java/Sav/Smart.java smart_toolShed/SMART/Java/Smart.jar smart_toolShed/SMART/Java/Smart.java smart_toolShed/SMART/Java/SmartInstaller.jar smart_toolShed/SMART/Java/WindowsRegistry.java smart_toolShed/SMART/Java/__init__.py smart_toolShed/SMART/Java/__init__.pyc smart_toolShed/SMART/Java/formats.txt smart_toolShed/SMART/Java/manifest.txt smart_toolShed/SMART/__init__.py smart_toolShed/SMART/galaxy/CleanTranscriptFile.xml smart_toolShed/SMART/galaxy/Clusterize.xml smart_toolShed/SMART/galaxy/CollapseReads.xml smart_toolShed/SMART/galaxy/CompareOverlappingSmallQuery.xml smart_toolShed/SMART/galaxy/CompareOverlappingSmallRef.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BedToCsv.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BedToGff2.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BedToGff3.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BedToSam.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BlastToCsv.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BlastToGff2.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BlastToGff3.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_BlastToSam.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_FastqToFasta.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff2ToCsv.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff2ToGff3.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff2ToSam.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff3ToCsv.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff3ToGff2.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff3ToSam.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_Gff3ToWig.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_SamToCsv.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_SamToGff2.xml smart_toolShed/SMART/galaxy/ConvertTranscriptFile_SamToGff3.xml smart_toolShed/SMART/galaxy/CountReadGCPercent.xml smart_toolShed/SMART/galaxy/DiffExpAnal.xml smart_toolShed/SMART/galaxy/FindOverlaps_optim.xml smart_toolShed/SMART/galaxy/GetDifferentialExpression.xml smart_toolShed/SMART/galaxy/GetFlanking.xml smart_toolShed/SMART/galaxy/SelectByTag.xml smart_toolShed/SMART/galaxy/WrappGetLetterDistribution.py smart_toolShed/SMART/galaxy/WrappGetLetterDistribution.xml smart_toolShed/SMART/galaxy/__init__.py smart_toolShed/SMART/galaxy/changeGffFeatures.xml smart_toolShed/SMART/galaxy/changeTagName.xml smart_toolShed/SMART/galaxy/cleanGff.xml smart_toolShed/SMART/galaxy/clusterize.xml smart_toolShed/SMART/galaxy/clusterizeBySlidingWindows.xml smart_toolShed/SMART/galaxy/compareOverlapping.xml smart_toolShed/SMART/galaxy/computeCoverage.xml smart_toolShed/SMART/galaxy/coordinatesToSequence.xml smart_toolShed/SMART/galaxy/findTss.xml smart_toolShed/SMART/galaxy/getDifference.xml smart_toolShed/SMART/galaxy/getDistance.xml smart_toolShed/SMART/galaxy/getDistribution.xml smart_toolShed/SMART/galaxy/getExons.xml smart_toolShed/SMART/galaxy/getIntrons.xml smart_toolShed/SMART/galaxy/getNb.xml smart_toolShed/SMART/galaxy/getReadDistribution.xml smart_toolShed/SMART/galaxy/getSequence.xml smart_toolShed/SMART/galaxy/getSizes.xml smart_toolShed/SMART/galaxy/getWigData.xml smart_toolShed/SMART/galaxy/getWigDistance.xml smart_toolShed/SMART/galaxy/getWigProfile.xml smart_toolShed/SMART/galaxy/mapperAnalyzer.xml smart_toolShed/SMART/galaxy/mappingToCoordinates.xml smart_toolShed/SMART/galaxy/mergeSlidingWindowsClusters.xml smart_toolShed/SMART/galaxy/mergeTranscriptLists.xml smart_toolShed/SMART/galaxy/modifyFasta.xml smart_toolShed/SMART/galaxy/modifyGenomicCoordinates.xml smart_toolShed/SMART/galaxy/modifySequenceList.xml smart_toolShed/SMART/galaxy/plot.xml smart_toolShed/SMART/galaxy/plotCoverage.xml smart_toolShed/SMART/galaxy/plotGenomeCoverage.xml smart_toolShed/SMART/galaxy/plotRepartition.xml smart_toolShed/SMART/galaxy/plotTranscriptList.xml smart_toolShed/SMART/galaxy/qualToFastq.xml smart_toolShed/SMART/galaxy/removeExonLines.sh smart_toolShed/SMART/galaxy/removeExonLines.xml smart_toolShed/SMART/galaxy/restrictFromSize.xml smart_toolShed/SMART/galaxy/restrictSequenceList.xml smart_toolShed/SMART/galaxy/restrictTranscriptList.xml smart_toolShed/SMART/galaxy/test/CollapseReads.xml smart_toolShed/SMART/galaxy/test/Test_F_WrappGetLetterDistribution.py smart_toolShed/SMART/galaxy/test/__init__.py smart_toolShed/SMART/galaxy/testArgum.xml smart_toolShed/SMART/galaxy/testR.xml smart_toolShed/SMART/galaxy/trimAdaptor.xml smart_toolShed/SMART/galaxy/trimSequences.xml smart_toolShed/__init__.py smart_toolShed/commons/__init__.py smart_toolShed/commons/__init__.pyc smart_toolShed/commons/core/__init__.py smart_toolShed/commons/core/__init__.pyc smart_toolShed/commons/core/checker/AbstractChecker.py smart_toolShed/commons/core/checker/CheckerException.py smart_toolShed/commons/core/checker/CheckerUtils.py smart_toolShed/commons/core/checker/ConfigChecker.py smart_toolShed/commons/core/checker/ConfigException.py smart_toolShed/commons/core/checker/ConfigValue.py smart_toolShed/commons/core/checker/IChecker.py smart_toolShed/commons/core/checker/OldConfigChecker.py smart_toolShed/commons/core/checker/RepetException.py smart_toolShed/commons/core/checker/__init__.py smart_toolShed/commons/core/checker/test/TestSuite_Checker.py smart_toolShed/commons/core/checker/test/Test_CheckerUtils.py smart_toolShed/commons/core/checker/test/Test_ConfigChecker.py smart_toolShed/commons/core/checker/test/Test_ConfigValue.py smart_toolShed/commons/core/checker/test/Test_F_ConfigChecker.py smart_toolShed/commons/core/checker/test/Test_OldConfigChecker.py smart_toolShed/commons/core/checker/test/__init__.py smart_toolShed/commons/core/coord/Align.py smart_toolShed/commons/core/coord/Align.pyc smart_toolShed/commons/core/coord/AlignUtils.py smart_toolShed/commons/core/coord/ConvCoord.py smart_toolShed/commons/core/coord/Map.py smart_toolShed/commons/core/coord/Map.pyc smart_toolShed/commons/core/coord/MapUtils.py smart_toolShed/commons/core/coord/Match.py smart_toolShed/commons/core/coord/MatchUtils.py smart_toolShed/commons/core/coord/MergedRange.py smart_toolShed/commons/core/coord/Path.py smart_toolShed/commons/core/coord/PathUtils.py smart_toolShed/commons/core/coord/Range.py smart_toolShed/commons/core/coord/Range.pyc smart_toolShed/commons/core/coord/Set.py smart_toolShed/commons/core/coord/SetUtils.py smart_toolShed/commons/core/coord/SlidingWindow.py smart_toolShed/commons/core/coord/__init__.py smart_toolShed/commons/core/coord/__init__.pyc smart_toolShed/commons/core/coord/align2set.py smart_toolShed/commons/core/coord/test/TestSuite_coord.py smart_toolShed/commons/core/coord/test/Test_Align.py smart_toolShed/commons/core/coord/test/Test_AlignUtils.py smart_toolShed/commons/core/coord/test/Test_ConvCoord.py smart_toolShed/commons/core/coord/test/Test_F_ConvCoord.py smart_toolShed/commons/core/coord/test/Test_Map.py smart_toolShed/commons/core/coord/test/Test_MapUtils.py smart_toolShed/commons/core/coord/test/Test_Match.py smart_toolShed/commons/core/coord/test/Test_MatchUtils.py smart_toolShed/commons/core/coord/test/Test_MergedRange.py smart_toolShed/commons/core/coord/test/Test_Path.py smart_toolShed/commons/core/coord/test/Test_PathUtils.py smart_toolShed/commons/core/coord/test/Test_Range.py smart_toolShed/commons/core/coord/test/Test_Set.py smart_toolShed/commons/core/coord/test/Test_SetUtils.py smart_toolShed/commons/core/coord/test/Test_SlidingWindow.py smart_toolShed/commons/core/coord/test/__init__.py smart_toolShed/commons/core/launcher/JobScriptTemplate.py smart_toolShed/commons/core/launcher/JobScriptTemplateLight.py smart_toolShed/commons/core/launcher/JobScriptWithFilesCopyTemplate.py smart_toolShed/commons/core/launcher/Launcher.py smart_toolShed/commons/core/launcher/LauncherUtils.py smart_toolShed/commons/core/launcher/WriteScript.py smart_toolShed/commons/core/launcher/__init__.py smart_toolShed/commons/core/launcher/test/Test_Launcher.py smart_toolShed/commons/core/launcher/test/Test_LauncherUtils.py smart_toolShed/commons/core/launcher/test/Test_WriteScript.py smart_toolShed/commons/core/launcher/test/__init__.py smart_toolShed/commons/core/launcher/test/expFiles/expJobScriptSQLiteWithFilesCopyTemplate.py smart_toolShed/commons/core/launcher/test/expFiles/expJobScriptTemplate.py smart_toolShed/commons/core/launcher/test/expFiles/expJobScriptTemplateLight.py smart_toolShed/commons/core/launcher/test/expFiles/expJobScriptTemplate_cmdWith2Lines.py smart_toolShed/commons/core/launcher/test/expFiles/expJobScriptWithFilesCopyTemplate.py smart_toolShed/commons/core/parsing/AxtParser.py smart_toolShed/commons/core/parsing/AxtParser.pyc smart_toolShed/commons/core/parsing/BamParser.py smart_toolShed/commons/core/parsing/BamParser.pyc smart_toolShed/commons/core/parsing/BedParser.py smart_toolShed/commons/core/parsing/BedParser.pyc smart_toolShed/commons/core/parsing/BlastParser.py smart_toolShed/commons/core/parsing/BlastParser.pyc smart_toolShed/commons/core/parsing/BlatFileParser.py smart_toolShed/commons/core/parsing/BlatParser.py smart_toolShed/commons/core/parsing/BlatToGff.py smart_toolShed/commons/core/parsing/BlatToGffForBesPaired.py smart_toolShed/commons/core/parsing/BowtieParser.py smart_toolShed/commons/core/parsing/BowtieParser.pyc smart_toolShed/commons/core/parsing/CoordsParser.py smart_toolShed/commons/core/parsing/CoordsParser.pyc smart_toolShed/commons/core/parsing/CrossSsrAndBesMappedByBlatToGff.py smart_toolShed/commons/core/parsing/ElandParser.py smart_toolShed/commons/core/parsing/ElandParser.pyc smart_toolShed/commons/core/parsing/ExoParser.py smart_toolShed/commons/core/parsing/ExoParser.pyc smart_toolShed/commons/core/parsing/FastaParser.py smart_toolShed/commons/core/parsing/FastaParser.pyc smart_toolShed/commons/core/parsing/FastqParser.py smart_toolShed/commons/core/parsing/FastqParser.pyc smart_toolShed/commons/core/parsing/FindRep.py smart_toolShed/commons/core/parsing/GbParser.py smart_toolShed/commons/core/parsing/GffParser.py smart_toolShed/commons/core/parsing/GffParser.pyc smart_toolShed/commons/core/parsing/GtfParser.py smart_toolShed/commons/core/parsing/GtfParser.pyc smart_toolShed/commons/core/parsing/MapParser.py smart_toolShed/commons/core/parsing/MapParser.pyc smart_toolShed/commons/core/parsing/MapperParser.py smart_toolShed/commons/core/parsing/MapperParser.pyc smart_toolShed/commons/core/parsing/MaqParser.py smart_toolShed/commons/core/parsing/MaqParser.pyc smart_toolShed/commons/core/parsing/MrepsToSet.py smart_toolShed/commons/core/parsing/Multifasta2SNPFile.py smart_toolShed/commons/core/parsing/MummerParser.py smart_toolShed/commons/core/parsing/NCListParser.py smart_toolShed/commons/core/parsing/NCListParser.pyc smart_toolShed/commons/core/parsing/NucmerParser.py smart_toolShed/commons/core/parsing/PalsToAlign.py smart_toolShed/commons/core/parsing/ParserChooser.py smart_toolShed/commons/core/parsing/ParserChooser.pyc smart_toolShed/commons/core/parsing/PathNum2Id.py smart_toolShed/commons/core/parsing/PilerTAToGrouperMap.py smart_toolShed/commons/core/parsing/PklParser.py smart_toolShed/commons/core/parsing/PklParser.pyc smart_toolShed/commons/core/parsing/PslParser.py smart_toolShed/commons/core/parsing/PslParser.pyc smart_toolShed/commons/core/parsing/README_MultiFasta2SNPFile smart_toolShed/commons/core/parsing/RmapParser.py smart_toolShed/commons/core/parsing/RmapParser.pyc smart_toolShed/commons/core/parsing/SamParser.py smart_toolShed/commons/core/parsing/SamParser.pyc smart_toolShed/commons/core/parsing/SeqmapParser.py smart_toolShed/commons/core/parsing/SeqmapParser.pyc smart_toolShed/commons/core/parsing/SequenceListParser.py smart_toolShed/commons/core/parsing/SequenceListParser.pyc smart_toolShed/commons/core/parsing/ShrimpParser.py smart_toolShed/commons/core/parsing/ShrimpParser.pyc smart_toolShed/commons/core/parsing/Soap2Parser.py smart_toolShed/commons/core/parsing/Soap2Parser.pyc smart_toolShed/commons/core/parsing/SoapParser.py smart_toolShed/commons/core/parsing/SoapParser.pyc smart_toolShed/commons/core/parsing/SsrParser.py smart_toolShed/commons/core/parsing/TranscriptListParser.py smart_toolShed/commons/core/parsing/TranscriptListParser.pyc smart_toolShed/commons/core/parsing/VarscanFile.py smart_toolShed/commons/core/parsing/VarscanFileForGnpSNP.py smart_toolShed/commons/core/parsing/VarscanHit.py smart_toolShed/commons/core/parsing/VarscanHitForGnpSNP.py smart_toolShed/commons/core/parsing/VarscanHit_WithTag.py smart_toolShed/commons/core/parsing/VarscanHit_v2_2_8.py smart_toolShed/commons/core/parsing/VarscanHit_v2_2_8_WithTag.py smart_toolShed/commons/core/parsing/WigParser.py smart_toolShed/commons/core/parsing/__init__.py smart_toolShed/commons/core/parsing/__init__.pyc smart_toolShed/commons/core/parsing/multifastaParserLauncher.py smart_toolShed/commons/core/parsing/test/Test_BedParser.py smart_toolShed/commons/core/parsing/test/Test_BlatFileParser.py smart_toolShed/commons/core/parsing/test/Test_BlatParser.py smart_toolShed/commons/core/parsing/test/Test_BlatToGff.py smart_toolShed/commons/core/parsing/test/Test_BlatToGffForBesPaired.py smart_toolShed/commons/core/parsing/test/Test_BowtieParser.py smart_toolShed/commons/core/parsing/test/Test_CoordsParser.py smart_toolShed/commons/core/parsing/test/Test_CrossSsrAndBesMappedByBlatToGff.py smart_toolShed/commons/core/parsing/test/Test_F_BlatToGff.py smart_toolShed/commons/core/parsing/test/Test_F_BlatToGffForBesPaired.py smart_toolShed/commons/core/parsing/test/Test_F_CrossSsrAndBesMappedByBlatToGff.py smart_toolShed/commons/core/parsing/test/Test_FastaParser.py smart_toolShed/commons/core/parsing/test/Test_FindRep.py smart_toolShed/commons/core/parsing/test/Test_GffParser.py smart_toolShed/commons/core/parsing/test/Test_MapParser.py smart_toolShed/commons/core/parsing/test/Test_MrepsToSet.py smart_toolShed/commons/core/parsing/test/Test_Multifasta2SNPFile.py smart_toolShed/commons/core/parsing/test/Test_Multifasta2SNPFileWriter.py smart_toolShed/commons/core/parsing/test/Test_PalsToAlign.py smart_toolShed/commons/core/parsing/test/Test_PathNum2Id.py smart_toolShed/commons/core/parsing/test/Test_PslParser.py smart_toolShed/commons/core/parsing/test/Test_SsrParser.py smart_toolShed/commons/core/parsing/test/Test_VarscanFile.py smart_toolShed/commons/core/parsing/test/Test_VarscanFileForGnpSNP.py smart_toolShed/commons/core/parsing/test/Test_VarscanHit.py smart_toolShed/commons/core/parsing/test/Test_VarscanHitForGnpSNP.py smart_toolShed/commons/core/parsing/test/Test_VarscanHit_WithTag.py smart_toolShed/commons/core/parsing/test/Test_VarscanHit_v2_2_8.py smart_toolShed/commons/core/parsing/test/Test_VarscanHit_v2_2_8_WithTag.py smart_toolShed/commons/core/parsing/test/Test_WigParser.py smart_toolShed/commons/core/parsing/test/Test_pilerTAToGrouperMap.py smart_toolShed/commons/core/parsing/test/__init__.py smart_toolShed/commons/core/parsing/test/data/ExpPotDooblonsSubSNP.csv smart_toolShed/commons/core/parsing/test/data/Wig/chr1.wig smart_toolShed/commons/core/parsing/test/data/realExpBatchLine.csv smart_toolShed/commons/core/parsing/test/data/realExpIndividual.csv smart_toolShed/commons/core/parsing/test/data/realExpSequences.fsa smart_toolShed/commons/core/parsing/test/data/realExpSubSNP.csv smart_toolShed/commons/core/parsing/test/data/real_multifasta_input.fasta smart_toolShed/commons/core/parsing/test/data/test.wig smart_toolShed/commons/core/parsing/test/data/test1.wig smart_toolShed/commons/core/parsing/test/data/test2.wig smart_toolShed/commons/core/parsing/test/data/testBedParser1.bed smart_toolShed/commons/core/parsing/test/data/testCoordsParser.coords smart_toolShed/commons/core/parsing/test/data/testCoordsParser_showcoord.coords smart_toolShed/commons/core/parsing/test/data/testCoordsParser_showcoord_promer.coords smart_toolShed/commons/core/parsing/test/data/testGffParser1.gff3 smart_toolShed/commons/core/seq/AlignedBioseqDB.py smart_toolShed/commons/core/seq/Bioseq.py smart_toolShed/commons/core/seq/Bioseq.pyc smart_toolShed/commons/core/seq/BioseqDB.py smart_toolShed/commons/core/seq/BioseqUtils.py smart_toolShed/commons/core/seq/ClusterConsensusCollection.py smart_toolShed/commons/core/seq/FastaUtils.py smart_toolShed/commons/core/seq/__init__.py smart_toolShed/commons/core/seq/__init__.pyc smart_toolShed/commons/core/seq/test/TestClusterConsensusCollection.py smart_toolShed/commons/core/seq/test/TestSuite_seq.py smart_toolShed/commons/core/seq/test/Test_AlignedBioseqDB.py smart_toolShed/commons/core/seq/test/Test_Bioseq.py smart_toolShed/commons/core/seq/test/Test_BioseqDB.py smart_toolShed/commons/core/seq/test/Test_BioseqUtils.py smart_toolShed/commons/core/seq/test/Test_FastaUtils.py smart_toolShed/commons/core/seq/test/Utils_for_T_FastaUtils.py smart_toolShed/commons/core/seq/test/__init__.py smart_toolShed/commons/core/sql/DbFactory.py smart_toolShed/commons/core/sql/DbMySql.py smart_toolShed/commons/core/sql/DbSQLite.py smart_toolShed/commons/core/sql/ITableMapAdaptator.py smart_toolShed/commons/core/sql/ITableMatchAdaptator.py smart_toolShed/commons/core/sql/ITablePathAdaptator.py smart_toolShed/commons/core/sql/ITableSeqAdaptator.py smart_toolShed/commons/core/sql/ITableSetAdaptator.py smart_toolShed/commons/core/sql/Job.py smart_toolShed/commons/core/sql/JobAdaptator.py smart_toolShed/commons/core/sql/OldRepetDB.py smart_toolShed/commons/core/sql/RepetJob.py smart_toolShed/commons/core/sql/TableAdaptator.py smart_toolShed/commons/core/sql/TableBinPathAdaptator.py smart_toolShed/commons/core/sql/TableBinSetAdaptator.py smart_toolShed/commons/core/sql/TableJobAdaptator.py smart_toolShed/commons/core/sql/TableJobAdaptatorFactory.py smart_toolShed/commons/core/sql/TableMapAdaptator.py smart_toolShed/commons/core/sql/TableMatchAdaptator.py smart_toolShed/commons/core/sql/TablePathAdaptator.py smart_toolShed/commons/core/sql/TableSeqAdaptator.py smart_toolShed/commons/core/sql/TableSetAdaptator.py smart_toolShed/commons/core/sql/__init__.py smart_toolShed/commons/core/sql/test/TestSuite_sql.py smart_toolShed/commons/core/sql/test/Test_DbFactory.py smart_toolShed/commons/core/sql/test/Test_DbMySql.py smart_toolShed/commons/core/sql/test/Test_DbSQLite.py smart_toolShed/commons/core/sql/test/Test_F_JobAdaptator.py smart_toolShed/commons/core/sql/test/Test_F_TableJobAdaptator.py smart_toolShed/commons/core/sql/test/Test_Job.py smart_toolShed/commons/core/sql/test/Test_TableBinPathAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableBinSetAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableJobAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableJobAdaptatorFactory.py smart_toolShed/commons/core/sql/test/Test_TableMapAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableMatchAdaptator.py smart_toolShed/commons/core/sql/test/Test_TablePathAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableSeqAdaptator.py smart_toolShed/commons/core/sql/test/Test_TableSetAdaptator.py smart_toolShed/commons/core/sql/test/Tst_F_RepetJob.py smart_toolShed/commons/core/sql/test/Tst_RepetJob.py smart_toolShed/commons/core/sql/test/__init__.py smart_toolShed/commons/core/stat/Stat.py smart_toolShed/commons/core/stat/__init__.py smart_toolShed/commons/core/stat/test/Test_F_Stat.py smart_toolShed/commons/core/stat/test/Test_Stat.py smart_toolShed/commons/core/stat/test/__init__.py smart_toolShed/commons/core/tree/Tree.py smart_toolShed/commons/core/tree/__init__.py smart_toolShed/commons/core/tree/test/Test_Tree.py smart_toolShed/commons/core/tree/test/__init__.py smart_toolShed/commons/core/tree/test/treeTestSuite.py smart_toolShed/commons/core/utils/FileUtils.py smart_toolShed/commons/core/utils/PipelineStepFTests.py smart_toolShed/commons/core/utils/RepetConfigParser.py smart_toolShed/commons/core/utils/RepetOptionParser.py smart_toolShed/commons/core/utils/__init__.py smart_toolShed/commons/core/utils/test/TestSuite_utils.py smart_toolShed/commons/core/utils/test/Test_FileUtils.py smart_toolShed/commons/core/utils/test/__init__.py smart_toolShed/commons/core/writer/BedWriter.py smart_toolShed/commons/core/writer/BedWriter.pyc smart_toolShed/commons/core/writer/CsvWriter.py smart_toolShed/commons/core/writer/CsvWriter.pyc smart_toolShed/commons/core/writer/EmblWriter.py smart_toolShed/commons/core/writer/EmblWriter.pyc smart_toolShed/commons/core/writer/FastaWriter.py smart_toolShed/commons/core/writer/FastaWriter.pyc smart_toolShed/commons/core/writer/FastqWriter.py smart_toolShed/commons/core/writer/FastqWriter.pyc smart_toolShed/commons/core/writer/GbWriter.py smart_toolShed/commons/core/writer/GbWriter.pyc smart_toolShed/commons/core/writer/Gff2Writer.py smart_toolShed/commons/core/writer/Gff2Writer.pyc smart_toolShed/commons/core/writer/Gff3Writer.py smart_toolShed/commons/core/writer/Gff3Writer.pyc smart_toolShed/commons/core/writer/GtfWriter.py smart_toolShed/commons/core/writer/GtfWriter.pyc smart_toolShed/commons/core/writer/MapWriter.py smart_toolShed/commons/core/writer/MapWriter.pyc smart_toolShed/commons/core/writer/MySqlTranscriptWriter.py smart_toolShed/commons/core/writer/MySqlTranscriptWriter.pyc smart_toolShed/commons/core/writer/SamWriter.py smart_toolShed/commons/core/writer/SamWriter.pyc smart_toolShed/commons/core/writer/SequenceListWriter.py smart_toolShed/commons/core/writer/SequenceListWriter.pyc smart_toolShed/commons/core/writer/TranscriptListWriter.py smart_toolShed/commons/core/writer/TranscriptListWriter.pyc smart_toolShed/commons/core/writer/TranscriptWriter.py smart_toolShed/commons/core/writer/TranscriptWriter.pyc smart_toolShed/commons/core/writer/UcscWriter.py smart_toolShed/commons/core/writer/UcscWriter.pyc smart_toolShed/commons/core/writer/WigWriter.py smart_toolShed/commons/core/writer/WigWriter.pyc smart_toolShed/commons/core/writer/WriterChooser.py smart_toolShed/commons/core/writer/WriterChooser.pyc smart_toolShed/commons/core/writer/__init__.py smart_toolShed/commons/core/writer/__init__.pyc smart_toolShed/commons/core/writer/test/Test_Gff3Writer.py smart_toolShed/commons/core/writer/test/Test_MapWriter.py smart_toolShed/commons/core/writer/test/__init__.py smart_toolShed/documentation.pdf |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/README.txt --- a/smart_toolShed/README.txt Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,58 +0,0 @@ ----------- -| NAME | ----------- -S-MART - - -Description ------------ -Several tools are now available for mapping high-throughput sequencing data from a genome, but few can extract biological knowledge from the mapped reads. We have developed a toolbox, S-MART, which handles mapped RNA-Seq and ChIP-Seq data. - -S-MART is an intuitive and lightweight tool, performing several tasks that are usually required during the analysis of mapped RNA-Seq and ChIP-Seq reads, including data selection and data visualization. - -S-MART does not require a computer science background and thus can be used by all biologists through a graphical interface. S-MART can run on any personal computer, yielding results within an hour for most queries. - - -Instructions ------------- -Environment Installation : -1). Put the downloaded S-MART directories into your Galaxy tools directory. -2). Open .bashrc (if it dosen't exist, create one). -Write or add the S-MART directory path to PYTHONPATH : -export PYTHONPATH=S-MART_PATH:/usr/lib/python2.7/ -(ex. export PYTHONPATH=/home/user/galaxy-dist/tools/smart_toolShed/) -3). Run .bashrc using . .bashrc command. - -Supplementary Softwares : - * R, under the GNU General Public License - * Python, under the Python License, compatible with the GNU General Public License -Installation instructions and the user guide are available in the file -"documentation.pdf". - - -Copyright ---------- -Copyright INRA-URGI 2009-2013 - - -Authors -------- -Matthias Zytnicki -Yufei Luo - -Contact -------- -urgi-support@versailles.inra.fr - - -License -------- -This library is distributed under the terms of the CeCILL license -(http://www.cecill.info/index.en.html). -See the LICENSE.txt file. - - -Acknowledgements ----------------- -Yufei Luo was supported by the Plant Breeding and Genetics research division of -the INRA, and by the Groupement d'intérêt scientifique IBISA. |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/File.java --- a/smart_toolShed/SMART/Java/File.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,55 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -public class File { - String name; - String formatType; - String format; - - - public File(String name, String type, String format) { - this.name = name; - this.formatType = type; - this.format = format; - } - - public String getName() { - return this.name; - } - - public String getFormatType() { - return this.formatType; - } - - public String getFormat() { - return this.format; - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Files.java --- a/smart_toolShed/SMART/Java/Files.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,75 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class Files { - HashMap <String, File> files; - - public Files () { - files = new HashMap < String, File> (); - } - - public void addFile(String fileName, String type, String format) { - this.addFile(new File(fileName, type, format)); - } - - public void addFile(File file) { - files.put(file.name, file); - } - - public void clear() { - files.clear(); - } - - public String getType(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format type of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).formatType; - } - - public String getFormat(String fileName) { - if (fileName == null) { - System.out.println("Error! Looking for format of empty file name!"); - } - if (! files.containsKey(fileName)) { - System.out.println("Oops! Format of file " + fileName + " is not found!"); - return null; - } - return files.get(fileName).format; - } -} - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/FormatType.java --- a/smart_toolShed/SMART/Java/FormatType.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,64 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatType { - String type; - Vector < String > formats; - - public FormatType (String type) { - this.type = type; - this.formats = new Vector < String > (); - } - - public String getType () { - return this.type; - } - - public void addFormat (String format) { - formats.add(format); - } - - public boolean containsFormat (String format) { - for (int i = 0; i < formats.size(); i++) { - if (((String) formats.get(i)).compareToIgnoreCase(format) == 0) { - return true; - } - } - return false; - } - - public Vector < String > getFormats () { - return formats; - } -} - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/FormatsContainer.java --- a/smart_toolShed/SMART/Java/FormatsContainer.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,90 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; - -public class FormatsContainer { - - HashMap < String, FormatType > formatTypes; - - - public FormatsContainer() { - this.formatTypes = new HashMap < String, FormatType > (); - } - - - public void addFormat(String type, String format) { - FormatType formatType; - if (formatTypes.containsKey(type)) { - formatType = this.formatTypes.get(type); - } - else { - formatType = new FormatType(type); - this.formatTypes.put(type, formatType); - } - formatType.addFormat(format); - } - - - public Vector < String > getFormatTypes () { - Vector < String > v = new Vector < String > (); - v.addAll(this.formatTypes.keySet()); - return v; - } - - - public FormatType getFormats (String type) { - if (! formatTypes.containsKey(type)) { - System.out.print("Format type " + type + " is unavailable. Got: "); - Iterator it = formatTypes.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry) it.next(); - System.out.print(pairs.getKey() + " "); - } - System.out.println(); - } - return formatTypes.get(type); - } - - - public String getFormatType (String format) { - for (Iterator it = formatTypes.keySet().iterator(); it.hasNext(); ) { - Object type = it.next(); - Object formatType = formatTypes.get(type); - if (((FormatType) formatType).containsFormat(format)) { - return (String) type; - } - } - return null; - } -} - - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/FormatsReader.java --- a/smart_toolShed/SMART/Java/FormatsReader.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,83 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class FormatsReader { - - String fileName; - Vector < FormatType > formatTypes; - Vector < String > typeNames; - - - public FormatsReader(String fileName) { - this.fileName = fileName; - this.formatTypes = new Vector < FormatType > (); - } - - - public boolean read() { - File file = new File(this.fileName); - - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line = null; - String[] lineElements; - String[] formats; - String typeName; - - while ((line = reader.readLine()) != null) { - if (line.length() > 0) { - lineElements = line.split(":"); - typeName = lineElements[0].trim(); - formats = lineElements[1].split(","); - for (int i = 0; i < formats.length; i++) { - Global.formats.addFormat(typeName, formats[i].trim()); - } - } - } - - reader.close(); - } - catch (FileNotFoundException e) { - return false; - } - catch (IOException e) { - return false; - } - - return true; - } -} - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Global.java --- a/smart_toolShed/SMART/Java/Global.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,70 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.Vector; -import java.util.HashMap; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JTextField; - -public class Global { - - public static int logAreaSize = 100; - - public static String smartConfFileName = "smart.conf"; - - public static String smartProgramsFileName = "programs.txt"; - - public static String smartFormatsFileName = "formats.txt"; - - public static String pythonPath = new String(); - - public static String pythonCommand = "python"; - - public static String mysqlCommand = "mysql"; - - public static String rCommand = "R"; - - public static Files files = new Files(); - - public static Vector < String > fileNames = new Vector < String >(); - - public static FormatsContainer formats = new FormatsContainer(); - - public static boolean programRunning = false; - - public static HashMap < JButton, JTextField > otherFilesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherDirectoriesChooser = new HashMap < JButton, JTextField >(); - - public static HashMap < JButton, JTextField > otherFileConcatenationChooser = new HashMap < JButton, JTextField >(); - -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/Old/PasswordAsker.java --- a/smart_toolShed/SMART/Java/Installer/Old/PasswordAsker.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,87 +0,0 @@ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class PasswordAsker { - - static String password; - static JFrame frame; - static CountDownLatch latch; - - - public PasswordAsker() { - password = null; - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - latch = new CountDownLatch(1); - } - - - private static void createAndShowGUI() { - //Create and set up the window. - frame = new JFrame("Password"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setContentPane(setMainPane()); - - //Display the window. - frame.pack(); - frame.setVisible(true); - } - - - private static JPanel setMainPane() { - JPanel rootPanel = new JPanel(false); - rootPanel.setLayout(new GridLayout(0, 1)); - - JPanel infoPanel = new JPanel(false); - JLabel infoLabel = new JLabel("Please write here the password that you entered for the mySQL root account.\r\nNo information is stored nor sent. I promise."); - infoPanel.add(infoLabel); - - JPanel passPanel = new JPanel(false); - passPanel.setLayout(new GridLayout(1, 0)); - JLabel passLabel = new JLabel("password"); - final JTextField passText = new JTextField(20); - passLabel.setLabelFor(passText); - passPanel.add(passLabel); - passPanel.add(passText); - - JPanel okPanel = new JPanel(false); - JButton okButton = new JButton("OK"); - okPanel.add(okButton); - - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - password = passText.getText(); - frame.setVisible(false); - frame.dispose(); - latch.countDown(); - } - }); - - rootPanel.add(infoPanel); - rootPanel.add(passPanel); - rootPanel.add(okPanel); - - return rootPanel; - } - - - public boolean waitForPassword() { - try { - latch.await(); - } - catch (InterruptedException e) { - return false; - } - return true; - } - - - public String getPassword() { - return password; - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/Old/SmartInstaller.java --- a/smart_toolShed/SMART/Java/Installer/Old/SmartInstaller.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,167 +0,0 @@ -import java.util.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; -import javax.swing.*; -import javax.swing.filechooser.*; -import javax.swing.border.*; -import javax.swing.SwingUtilities; -import java.net.*; - -public class SmartInstaller extends JPanel implements ActionListener { - int BUFFER = 1024; - - JFrame mainFrame; - JTextArea logArea; - - // configuration chooser buttons - String configurations[] = {"32 bits", "64 bits"}; - JRadioButton configurationButtons[]; - - // program chooser buttons - String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "MySQL", "MySQL account", "Python 2.6", "Python DB", "S-MART"}; - JCheckBox programChooserButtons[]; - - JButton goButton; - - // install directory - JButton installDirectoryChooserButton; - JTextField installDirectoryChooserTextField; - - - public SmartInstaller() { - super(); - - Box box = Box.createVerticalBox(); - - // Header - JPanel headerPanel = new JPanel(false); - JTextArea headerArea = new JTextArea("This is the S-MART installation tool.\r\nIt will download and install the needed softwares, as well as S-MART itself.\r\nYou can unselect the software that you already have installed.\r\nDuring the installation, accept all the default parameters.\r\nPlease remember the root password if you install MySQL!"); - TitledBorder headerBorder = BorderFactory.createTitledBorder("Wellcome to the S-MART installer!"); - headerArea.setEditable(false); - headerArea.setBackground(headerPanel.getBackground()); - headerPanel.add(headerArea); - headerPanel.setBorder(headerBorder); - - - // Configuration - JPanel configurationPanel = new JPanel(false); - configurationPanel.setLayout(new GridLayout(1, 0)); - configurationButtons = new JRadioButton[configurations.length]; - ButtonGroup configurationGroup = new ButtonGroup(); - for (int i = 0; i < configurations.length; i++) { - JRadioButton button = new JRadioButton(configurations[i]); - configurationPanel.add(button); - configurationButtons[i] = button; - configurationGroup.add(button); - } - configurationButtons[0].setSelected(true); - TitledBorder configurationBorder = BorderFactory.createTitledBorder("Configuration"); - configurationPanel.setBorder(configurationBorder); - - - // Program chooser panel - JPanel programPanel = new JPanel(false); - programPanel.setLayout(new GridLayout(0, 1)); - - JLabel programLabel = new JLabel("Choose which programs to install:"); - programPanel.add(programLabel); - programChooserButtons = new JCheckBox[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - JCheckBox button = new JCheckBox(programChoosers[i]); - button.setSelected(true); - programPanel.add(button); - programChooserButtons[i] = button; - } - TitledBorder programBorder = BorderFactory.createTitledBorder("Programs"); - programPanel.setBorder(programBorder); - - // Install directory chooser - JPanel installDirectoryChooserPanel = new JPanel(false); - installDirectoryChooserPanel.setLayout(new GridLayout(1, 0)); - JLabel installDirectoryChooserLabel = new JLabel("Choose a directory to install S-MART: "); - installDirectoryChooserTextField = new JTextField(); - installDirectoryChooserButton = new JButton("Open..."); - installDirectoryChooserButton.addActionListener(this); - - installDirectoryChooserPanel.add(installDirectoryChooserLabel); - installDirectoryChooserPanel.add(installDirectoryChooserTextField); - installDirectoryChooserPanel.add(installDirectoryChooserButton); - TitledBorder installDirectoryChooserBorder = BorderFactory.createTitledBorder("Installation directory"); - installDirectoryChooserPanel.setBorder(installDirectoryChooserBorder); - - // GO! - JPanel goPanel = new JPanel(false); - goButton = new JButton("GO!"); - goButton.addActionListener(this); - goButton.setSelected(true); - goPanel.add(goButton); - TitledBorder goBorder = BorderFactory.createTitledBorder("Start install"); - goPanel.setBorder(goBorder); - - // Log - logArea = new JTextArea(10, 120); - logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize())); - JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - TitledBorder logBorder = BorderFactory.createTitledBorder("Log"); - logScroll.setBorder(logBorder); - - GridLayout horizontalLayout = new GridLayout(1, 0); - - box.add(headerPanel); - box.add(configurationPanel); - box.add(programPanel); - box.add(installDirectoryChooserPanel); - box.add(goPanel); - box.add(logScroll); - - add(box); - } - - - public void actionPerformed(ActionEvent e) { - - // Install directories chooser - if (e.getSource() == goButton) { - boolean[] selectedPrograms = new boolean[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - selectedPrograms[i] = programChooserButtons[i].isSelected(); - } - SmartInstallerTask task = new SmartInstallerTask(logArea, selectedPrograms, installDirectoryChooserTextField.getText(), (configurationButtons[0].isSelected())? 0: 1); - task.execute(); - } - // Install directories chooser - else if (e.getSource() == installDirectoryChooserButton) { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) { - installDirectoryChooserTextField.setText(chooser.getSelectedFile().getPath()); - } - } - } - - private static void createAndShowGUI() { - // Create and set up the window. - JFrame mainFrame = new JFrame("S-Mart Installer"); - mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //Create and set up the content pane. - JComponent newContentPane = new SmartInstaller(); - newContentPane.setOpaque(true); - mainFrame.setContentPane(newContentPane); - - // Display the window. - mainFrame.pack(); - mainFrame.setVisible(true); - } - - - public static void main(String[] args) { - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/Old/SmartInstallerTask.java --- a/smart_toolShed/SMART/Java/Installer/Old/SmartInstallerTask.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,455 +0,0 @@\n-import java.util.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-import java.net.*;\n-import java.util.Stack;\n-import java.util.zip.ZipEntry;\n-import java.util.zip.ZipInputStream;\n-\n-public class SmartInstallerTask extends SwingWorker<Boolean, String> {\n-\n- int BUFFER = 1024;\n-\n- int architecture = 0;\n- String installDirectoryName = null;\n- JTextArea logArea = null;\n- boolean[] selectedPrograms = null;\n-\n- // program chooser buttons\n- String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "MySQL", "MySQL account", "Python 2.6", "Python DB", "S-MART"};\n-\n- // Web addresses for the tools\n- String packageAddresses[][] = {\n- {"http://cran.cict.fr/bin/windows/base/R-2.11.0-win32.exe", "http://cran.cict.fr/bin/windows64/base/R-2.11.0-win64.exe"},\n- {"", ""},\n- {"", ""},\n- {"http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-essential-5.1.47-win32.msi", "http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-essential-5.1.47-winx64.msi"},\n- {"", ""},\n- {"http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi", "http://www.python.org/ftp/python/2.6.5/python-2.6.5.amd64.msi"},\n- {"http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe", "http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe"},\n- {"http://urgi.versailles.inra.fr/download/s-mart/s-mart.zip", "http://urgi.versailles.inra.fr/download/s-mart/s-mart.zip"}\n- };\n-\n- // Packages to install\n- String rPackages[] = {"RColorBrewer", "Hmisc"};\n-\n- // Script lines\n- String scriptLines[][] = {\n- {"\\"<INSTALLDIR>\\\\R-2.11.0-win32.exe\\"", "\\"<INSTALLDIR>\\\\R-2.11.0-win64.exe\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\mysql-essential-5.1.47-win32.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\mysql-essential-5.1.47-winx64.msi\\""},\n- {"", ""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.amd64.msi\\""},\n- {"<INSTALLDIR>\\\\MySQL-python-1.2.2.win32-py2.6.exe", "<INSTALLDIR>\\\\MySQL-python-1.2.2.win32-py2.6.exe"},\n- {"", ""}\n- };\n-\n- // Files to uncompress\n- String compressedFiles[][] = {\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"<INSTALLDIR>\\\\s-mart.zip", "<INSTALLDIR>\\\\s-mart.zip"}\n- };\n-\n-\n- public SmartInstallerTask(JTextArea ta, boolean[] b, String s, int a) {\n- logArea = ta;\n- selectedPrograms = b;\n- installDirectoryName = s;\n- architecture = a;\n- }\n-\n-\n- @Override\n- public Boolean doInBackground() {\n- boolean installOk;\n- publish("Starting install\\n");\n- writeFiles();\n- for (int i = 0; i < selectedPrograms.length; i++) {\n- if (selectedPrograms[i]) {\n- if (! install(i)) {\n- return Boolean.FALSE;\n- }\n- }\n- }\n- removeFiles();\n- setEnvironmentVariables();\n- publish("Ending install\\n");\n- return Boolean.TRUE;\n- }\n-\n-\n- @Override\n- protected void process(List<String> chunks) {\n- for (String chunk: chunks) {\n- logArea.append(chunk);\n- }\n- }\n-\n-\n- private boolean launch(String command) {\n- return realLaunch(new ProcessBuilder(command), command);\n- }\n-\n- private boolean launch(String[] command) {\n- return realLaunch(new ProcessBuilder(command), Arrays.toString(command));\n- }\n-\n- private boolean realLaunch(ProcessBuilder pb, String command) {\n- BufferedReader outputReader;\n- pb = pb.redirectErrorStream(true);\n- Process process '..b' boolean uncompressPackage(int element) {\n- String file = compressedFiles[element][architecture];\n- if (! "".equals(file)) {\n- file = replaceSubstring(file);\n- publish(" Starting uncompressing file \'" + file + "\'\\n");\n- try {\n- FileInputStream fis = new FileInputStream(file);\n- BufferedInputStream bis = new BufferedInputStream(fis);\n- ZipInputStream zis = new ZipInputStream(bis);\n- ZipEntry entry;\n- while ((entry = zis.getNextEntry()) != null) {\n- if (! entry.isDirectory()) {\n- File newFile = new File(installDirectoryName + File.separator + entry.getName());\n- // create parent directories\n- File upDirectory = newFile.getParentFile();\n- while (upDirectory != null){\n- if (! upDirectory.exists()) {\n- upDirectory.mkdir();\n- publish(" Creating directory \'" + upDirectory.getAbsolutePath() + "\'\\n");\n- }\n- upDirectory = upDirectory.getParentFile();\n- }\n- // write the files to the disk\n- publish(" Extracting \'" + entry.getName() + "\' to \'" + newFile.getAbsolutePath() + "\'\\n");\n- int count;\n- byte data[] = new byte[BUFFER];\n- FileOutputStream fos = new FileOutputStream(newFile);\n- BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER);\n- while ((count = zis.read(data, 0, BUFFER)) != -1){\n- bos.write(data, 0, count);\n- }\n- bos.flush();\n- bos.close();\n- fos.close();\n- }\n- }\n- zis.close();\n- bis.close();\n- fis.close();\n- }\n- catch(FileNotFoundException e) {\n- publish(" !Cannot find file \'" + file + "\'!\\n");\n- return false;\n- }\n- catch(Exception e){\n- publish(" !Cannot uncompress file \'" + file + "\'!\\n");\n- return false;\n- }\n- publish(" Ending uncompressing file \'" + file + "\'\\n");\n- }\n- return true;\n- }\n-\n-\n- private boolean removePackage(int element) {\n- String packageName = packageAddresses[element][architecture];\n- if ("".equals(packageName)) {\n- return true;\n- }\n- String fileName = getLocalName(packageAddresses[element][architecture]);\n- return removeFile(fileName);\n- }\n-\n-\n- private boolean postProcess(int element) {\n- switch (element) {\n- case 4:\n- // Create mySQL user\n- PasswordAsker pa = new PasswordAsker();\n- if (! pa.waitForPassword()) {\n- publish("Problem in the password asker!\\n");\n- return false;\n- }\n- String command = "\\"<MYSQLFILE>\\" --user=root --password=" + pa.getPassword() + " -e \\"source <INSTALLDIR>\\\\createUser.sql\\"";\n- command = replaceSubstring(command);\n- if (! launch(command)) {\n- publish(" !Cannot create SQL accounts!\\n");\n- return false;\n- }\n- return true;\n- case 7:\n- // Move S-MART files to parent directory\n- File installDirectory = new File(installDirectoryName + File.separator + "S-Mart");\n- for (File file: installDirectory.listFiles()) {\n- File destinationFile = new File(file.getParentFile().getParentFile(), file.getName());\n- if (! file.renameTo(destinationFile)) {\n- publish(" !Cannot move \'" + file.getAbsolutePath() + "\' to \'" + destinationFile.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- if (! installDirectory.delete()) {\n- publish(" !Cannot remove installation S-MART directory \'" + installDirectory.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean setEnvironmentVariables() {\n- String[] command = {"REG", "ADD", "HKCU\\\\Environment", "/v", "PYTHONPATH", "/t", "REG_SZ", "/d", "\\"" + installDirectoryName + "\\\\Python\\"", "/f"};\n- return launch(command);\n- }\n-}\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/PasswordAsker.java --- a/smart_toolShed/SMART/Java/Installer/PasswordAsker.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,87 +0,0 @@ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class PasswordAsker { - - static String password; - static JFrame frame; - static CountDownLatch latch; - - - public PasswordAsker() { - password = null; - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - latch = new CountDownLatch(1); - } - - - private static void createAndShowGUI() { - //Create and set up the window. - frame = new JFrame("Password"); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setContentPane(setMainPane()); - - //Display the window. - frame.pack(); - frame.setVisible(true); - } - - - private static JPanel setMainPane() { - JPanel rootPanel = new JPanel(false); - rootPanel.setLayout(new GridLayout(0, 1)); - - JPanel infoPanel = new JPanel(false); - JLabel infoLabel = new JLabel("Please write here the password that you entered for the mySQL root account.\r\nNo information is stored nor sent. I promise."); - infoPanel.add(infoLabel); - - JPanel passPanel = new JPanel(false); - passPanel.setLayout(new GridLayout(1, 0)); - JLabel passLabel = new JLabel("password"); - final JTextField passText = new JTextField(20); - passLabel.setLabelFor(passText); - passPanel.add(passLabel); - passPanel.add(passText); - - JPanel okPanel = new JPanel(false); - JButton okButton = new JButton("OK"); - okPanel.add(okButton); - - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - password = passText.getText(); - frame.setVisible(false); - frame.dispose(); - latch.countDown(); - } - }); - - rootPanel.add(infoPanel); - rootPanel.add(passPanel); - rootPanel.add(okPanel); - - return rootPanel; - } - - - public boolean waitForPassword() { - try { - latch.await(); - } - catch (InterruptedException e) { - return false; - } - return true; - } - - - public String getPassword() { - return password; - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/SmartInstaller.jar |
b |
Binary file smart_toolShed/SMART/Java/Installer/SmartInstaller.jar has changed |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/SmartInstaller.java --- a/smart_toolShed/SMART/Java/Installer/SmartInstaller.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,167 +0,0 @@ -import java.util.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; -import javax.swing.*; -import javax.swing.filechooser.*; -import javax.swing.border.*; -import javax.swing.SwingUtilities; -import java.net.*; - -public class SmartInstaller extends JPanel implements ActionListener { - int BUFFER = 1024; - - JFrame mainFrame; - JTextArea logArea; - - // configuration chooser buttons - String configurations[] = {"32 bits", "64 bits"}; - JRadioButton configurationButtons[]; - - // program chooser buttons - String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "Python 2.6", "S-MART"}; - JCheckBox programChooserButtons[]; - - JButton goButton; - - // install directory - JButton installDirectoryChooserButton; - JTextField installDirectoryChooserTextField; - - - public SmartInstaller() { - super(); - - Box box = Box.createVerticalBox(); - - // Header - JPanel headerPanel = new JPanel(false); - JTextArea headerArea = new JTextArea("This is the S-MART installation tool.\r\nIt will download and install the needed softwares, as well as S-MART itself.\r\nYou can unselect the software that you already have installed.\r\nDuring the installation, accept all the default parameters."); - TitledBorder headerBorder = BorderFactory.createTitledBorder("Welcome to the S-MART installer!"); - headerArea.setEditable(false); - headerArea.setBackground(headerPanel.getBackground()); - headerPanel.add(headerArea); - headerPanel.setBorder(headerBorder); - - - // Configuration - JPanel configurationPanel = new JPanel(false); - configurationPanel.setLayout(new GridLayout(1, 0)); - configurationButtons = new JRadioButton[configurations.length]; - ButtonGroup configurationGroup = new ButtonGroup(); - for (int i = 0; i < configurations.length; i++) { - JRadioButton button = new JRadioButton(configurations[i]); - configurationPanel.add(button); - configurationButtons[i] = button; - configurationGroup.add(button); - } - configurationButtons[0].setSelected(true); - TitledBorder configurationBorder = BorderFactory.createTitledBorder("Configuration"); - configurationPanel.setBorder(configurationBorder); - - - // Program chooser panel - JPanel programPanel = new JPanel(false); - programPanel.setLayout(new GridLayout(0, 1)); - - JLabel programLabel = new JLabel("Choose which programs to install:"); - programPanel.add(programLabel); - programChooserButtons = new JCheckBox[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - JCheckBox button = new JCheckBox(programChoosers[i]); - button.setSelected(true); - programPanel.add(button); - programChooserButtons[i] = button; - } - TitledBorder programBorder = BorderFactory.createTitledBorder("Programs"); - programPanel.setBorder(programBorder); - - // Install directory chooser - JPanel installDirectoryChooserPanel = new JPanel(false); - installDirectoryChooserPanel.setLayout(new GridLayout(1, 0)); - JLabel installDirectoryChooserLabel = new JLabel("Choose a directory to install S-MART: "); - installDirectoryChooserTextField = new JTextField(); - installDirectoryChooserButton = new JButton("Open..."); - installDirectoryChooserButton.addActionListener(this); - - installDirectoryChooserPanel.add(installDirectoryChooserLabel); - installDirectoryChooserPanel.add(installDirectoryChooserTextField); - installDirectoryChooserPanel.add(installDirectoryChooserButton); - TitledBorder installDirectoryChooserBorder = BorderFactory.createTitledBorder("Installation directory"); - installDirectoryChooserPanel.setBorder(installDirectoryChooserBorder); - - // GO! - JPanel goPanel = new JPanel(false); - goButton = new JButton("GO!"); - goButton.addActionListener(this); - goButton.setSelected(true); - goPanel.add(goButton); - TitledBorder goBorder = BorderFactory.createTitledBorder("Start install"); - goPanel.setBorder(goBorder); - - // Log - logArea = new JTextArea(10, 120); - logArea.setFont(new Font("Monospaced", logArea.getFont().getStyle(), logArea.getFont().getSize())); - JScrollPane logScroll = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - TitledBorder logBorder = BorderFactory.createTitledBorder("Log"); - logScroll.setBorder(logBorder); - - GridLayout horizontalLayout = new GridLayout(1, 0); - - box.add(headerPanel); - box.add(configurationPanel); - box.add(programPanel); - box.add(installDirectoryChooserPanel); - box.add(goPanel); - box.add(logScroll); - - add(box); - } - - - public void actionPerformed(ActionEvent e) { - - // Install directories chooser - if (e.getSource() == goButton) { - boolean[] selectedPrograms = new boolean[programChoosers.length]; - for (int i = 0; i < programChoosers.length; i++) { - selectedPrograms[i] = programChooserButtons[i].isSelected(); - } - SmartInstallerTask task = new SmartInstallerTask(logArea, selectedPrograms, installDirectoryChooserTextField.getText(), (configurationButtons[0].isSelected())? 0: 1); - task.execute(); - } - // Install directories chooser - else if (e.getSource() == installDirectoryChooserButton) { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) { - installDirectoryChooserTextField.setText(chooser.getSelectedFile().getPath()); - } - } - } - - private static void createAndShowGUI() { - // Create and set up the window. - JFrame mainFrame = new JFrame("S-Mart Installer"); - mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //Create and set up the content pane. - JComponent newContentPane = new SmartInstaller(); - newContentPane.setOpaque(true); - mainFrame.setContentPane(newContentPane); - - // Display the window. - mainFrame.pack(); - mainFrame.setVisible(true); - } - - - public static void main(String[] args) { - javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { - createAndShowGUI(); - } - }); - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/SmartInstallerTask.java --- a/smart_toolShed/SMART/Java/Installer/SmartInstallerTask.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,419 +0,0 @@\n-import java.util.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-import java.net.*;\n-import java.util.Stack;\n-import java.util.zip.ZipEntry;\n-import java.util.zip.ZipInputStream;\n-\n-public class SmartInstallerTask extends SwingWorker<Boolean, String> {\n-\n- int BUFFER = 1024;\n-\n- int architecture = 0;\n- String installDirectoryName = null;\n- JTextArea logArea = null;\n- boolean[] selectedPrograms = null;\n-\n- // program chooser buttons\n- String programChoosers[] = {"R", "R Color Brewer Package", "R HMisc Package", "Python 2.6", "S-MART"};\n-\n- // Web addresses for the tools\n- String packageAddresses[][] = {\n- {"http://cran.cict.fr/bin/windows/base/R-2.11.0-win32.exe", "http://cran.cict.fr/bin/windows64/base/R-2.11.0-win64.exe"},\n- {"", ""},\n- {"", ""},\n- {"http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi", "http://www.python.org/ftp/python/2.6.5/python-2.6.5.amd64.msi"},\n- {"http://urgi.versailles.inra.fr/content/download/1929/17848/file/s-mart-1.0.15.zip", "http://urgi.versailles.inra.fr/content/download/1929/17848/file/s-mart-1.0.15.zip"}\n- };\n-\n- // Packages to install\n- String rPackages[] = {"RColorBrewer", "Hmisc"};\n-\n- // Script lines\n- String scriptLines[][] = {\n- {"\\"<INSTALLDIR>\\\\R-2.11.0-win32.exe\\"", "\\"<INSTALLDIR>\\\\R-2.11.0-win64.exe\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installRColorBrewer.R\\""},\n- {"\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\"", "\\"<RFILE>\\" CMD BATCH \\"<INSTALLDIR>\\\\installHmisc.R\\""},\n- {"msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.msi\\"", "msiexec /i \\"<INSTALLDIR>\\\\python-2.6.5.amd64.msi\\""},\n- {"", ""}\n- };\n-\n- // Files to uncompress\n- String compressedFiles[][] = {\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"", ""},\n- {"<INSTALLDIR>\\\\s-mart-1.0.15.zip", "<INSTALLDIR>\\\\s-mart-1.0.15.zip"}\n- };\n-\n-\n- public SmartInstallerTask(JTextArea ta, boolean[] b, String s, int a) {\n- logArea = ta;\n- selectedPrograms = b;\n- installDirectoryName = s;\n- architecture = a;\n- }\n-\n-\n- @Override\n- public Boolean doInBackground() {\n- boolean installOk;\n- publish("Starting install\\n");\n- writeFiles();\n- for (int i = 0; i < selectedPrograms.length; i++) {\n- if (selectedPrograms[i]) {\n- if (! install(i)) {\n- return Boolean.FALSE;\n- }\n- }\n- }\n- removeFiles();\n- setEnvironmentVariables();\n- publish("Ending install\\n");\n- return Boolean.TRUE;\n- }\n-\n-\n- @Override\n- protected void process(List<String> chunks) {\n- for (String chunk: chunks) {\n- logArea.append(chunk);\n- }\n- }\n-\n-\n- private boolean launch(String command) {\n- return realLaunch(new ProcessBuilder(command), command);\n- }\n-\n- private boolean launch(String[] command) {\n- return realLaunch(new ProcessBuilder(command), Arrays.toString(command));\n- }\n-\n- private boolean realLaunch(ProcessBuilder pb, String command) {\n- BufferedReader outputReader;\n- pb = pb.redirectErrorStream(true);\n- Process process = null;\n- publish(" Starting command \'" + command + "\'\\n");\n- try {\n- process = pb.start();\n- BufferedInputStream outputStream = new BufferedInputStream(process.getInputStream());\n- InputStream is = process.getInputStream();\n- InputStreamReader isr = new InputStreamReader(is);\n- outputReader = new BufferedReader(isr);\n- }\n- catch (Exception exception) {\n- publish(" !Process cannot be started (command is \'" + command + "\')!\\n");\n- exception.printStackTrace();\n- return false;\n- }\n- if (outputReader == null) {\n- publish(" !Problem in the outp'..b'turn false;\n- }\n- try {\n- process.waitFor();\n- }\n- catch (InterruptedException e) {\n- publish(" !Cannot wait for the end of the command \'" + command + "\'!\\n");\n- return false;\n- }\n- int exitValue = process.exitValue();\n- if (exitValue != 0) {\n- publish(" !Problem during the execution of the command \'" + command + "\'!\\n");\n- return false;\n- }\n- publish(" Ending command \'" + command + "\'\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean uncompressPackage(int element) {\n- String file = compressedFiles[element][architecture];\n- if (! "".equals(file)) {\n- file = replaceSubstring(file);\n- publish(" Starting uncompressing file \'" + file + "\'\\n");\n- try {\n- FileInputStream fis = new FileInputStream(file);\n- BufferedInputStream bis = new BufferedInputStream(fis);\n- ZipInputStream zis = new ZipInputStream(bis);\n- ZipEntry entry;\n- while ((entry = zis.getNextEntry()) != null) {\n- if (! entry.isDirectory()) {\n- File newFile = new File(installDirectoryName + File.separator + entry.getName());\n- // create parent directories\n- File upDirectory = newFile.getParentFile();\n- while (upDirectory != null){\n- if (! upDirectory.exists()) {\n- upDirectory.mkdir();\n- publish(" Creating directory \'" + upDirectory.getAbsolutePath() + "\'\\n");\n- }\n- upDirectory = upDirectory.getParentFile();\n- }\n- // write the files to the disk\n- publish(" Extracting \'" + entry.getName() + "\' to \'" + newFile.getAbsolutePath() + "\'\\n");\n- int count;\n- byte data[] = new byte[BUFFER];\n- FileOutputStream fos = new FileOutputStream(newFile);\n- BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER);\n- while ((count = zis.read(data, 0, BUFFER)) != -1){\n- bos.write(data, 0, count);\n- }\n- bos.flush();\n- bos.close();\n- fos.close();\n- }\n- }\n- zis.close();\n- bis.close();\n- fis.close();\n- }\n- catch(FileNotFoundException e) {\n- publish(" !Cannot find file \'" + file + "\'!\\n");\n- return false;\n- }\n- catch(Exception e){\n- publish(" !Cannot uncompress file \'" + file + "\'!\\n");\n- return false;\n- }\n- publish(" Ending uncompressing file \'" + file + "\'\\n");\n- }\n- return true;\n- }\n-\n-\n- private boolean removePackage(int element) {\n- String packageName = packageAddresses[element][architecture];\n- if ("".equals(packageName)) {\n- return true;\n- }\n- String fileName = getLocalName(packageAddresses[element][architecture]);\n- return removeFile(fileName);\n- }\n-\n-\n- private boolean postProcess(int element) {\n- switch (element) {\n- case 4:\n- // Move S-MART files to parent directory\n- File installDirectory = new File(installDirectoryName + File.separator + "S-Mart");\n- for (File file: installDirectory.listFiles()) {\n- File destinationFile = new File(file.getParentFile().getParentFile(), file.getName());\n- if (! file.renameTo(destinationFile)) {\n- publish(" !Cannot move \'" + file.getAbsolutePath() + "\' to \'" + destinationFile.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- if (! installDirectory.delete()) {\n- publish(" !Cannot remove installation S-MART directory \'" + installDirectory.getAbsolutePath() + "\'!\\n");\n- }\n- }\n- return true;\n- }\n-\n-\n- private boolean setEnvironmentVariables() {\n- String[] command = {"REG", "ADD", "HKCU\\\\Environment", "/v", "PYTHONPATH", "/t", "REG_SZ", "/d", "\\"" + installDirectoryName + "\\\\Python\\"", "/f"};\n- return launch(command);\n- }\n-}\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/build.sh --- a/smart_toolShed/SMART/Java/Installer/build.sh Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,5 +0,0 @@ -#! /bin/sh - -rm -rf SmartInstaller.jar -javac *.java -jar cvfm SmartInstaller.jar manifest.txt *.class |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/manifest.txt --- a/smart_toolShed/SMART/Java/Installer/manifest.txt Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Matthias Zytnicki -Main-Class: SmartInstaller |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Installer/s-mart.zip |
b |
Binary file smart_toolShed/SMART/Java/Installer/s-mart.zip has changed |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/LICENSE.txt --- a/smart_toolShed/SMART/Java/LICENSE.txt Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,506 +0,0 @@\n-\n-CeCILL FREE SOFTWARE LICENSE AGREEMENT\n-\n-\n- Notice\n-\n-This Agreement is a Free Software license agreement that is the result\n-of discussions between its authors in order to ensure compliance with\n-the two main principles guiding its drafting:\n-\n- * firstly, compliance with the principles governing the distribution\n- of Free Software: access to source code, broad rights granted to\n- users,\n- * secondly, the election of a governing law, French law, with which\n- it is conformant, both as regards the law of torts and\n- intellectual property law, and the protection that it offers to\n- both authors and holders of the economic rights over software.\n-\n-The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])\n-license are:\n-\n-Commissariat \xe0 l\'Energie Atomique - CEA, a public scientific, technical\n-and industrial research establishment, having its principal place of\n-business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.\n-\n-Centre National de la Recherche Scientifique - CNRS, a public scientific\n-and technological establishment, having its principal place of business\n-at 3 rue Michel-Ange, 75794 Paris cedex 16, France.\n-\n-Institut National de Recherche en Informatique et en Automatique -\n-INRIA, a public scientific and technological establishment, having its\n-principal place of business at Domaine de Voluceau, Rocquencourt, BP\n-105, 78153 Le Chesnay cedex, France.\n-\n-\n- Preamble\n-\n-The purpose of this Free Software license agreement is to grant users\n-the right to modify and redistribute the software governed by this\n-license within the framework of an open source distribution model.\n-\n-The exercising of these rights is conditional upon certain obligations\n-for users so as to preserve this status for all subsequent redistributions.\n-\n-In consideration of access to the source code and the rights to copy,\n-modify and redistribute granted by the license, users are provided only\n-with a limited warranty and the software\'s author, the holder of the\n-economic rights, and the successive licensors only have limited liability.\n-\n-In this respect, the risks associated with loading, using, modifying\n-and/or developing or reproducing the software by the user are brought to\n-the user\'s attention, given its Free Software status, which may make it\n-complicated to use, with the result that its use is reserved for\n-developers and experienced professionals having in-depth computer\n-knowledge. Users are therefore encouraged to load and test the\n-suitability of the software as regards their requirements in conditions\n-enabling the security of their systems and/or data to be ensured and,\n-more generally, to use and operate it in the same conditions of\n-security. This Agreement may be freely reproduced and published,\n-provided it is not altered, and that no provisions are either added or\n-removed herefrom.\n-\n-This Agreement may apply to any or all software for which the holder of\n-the economic rights decides to submit the use thereof to its provisions.\n-\n-\n- Article 1 - DEFINITIONS\n-\n-For the purpose of this Agreement, when the following expressions\n-commence with a capital letter, they shall have the following meaning:\n-\n-Agreement: means this license agreement, and its possible subsequent\n-versions and annexes.\n-\n-Software: means the software in its Object Code and/or Source Code form\n-and, where applicable, its documentation, "as is" when the Licensee\n-accepts the Agreement.\n-\n-Initial Software: means the Software in its Source Code and possibly its\n-Object Code form and, where applicable, its documentation, "as is" when\n-it is first distributed under the terms and conditions of the Agreement.\n-\n-Modified Software: means the Software modified by at least one\n-Contribution.\n-\n-Source Code: means all the Software\'s instructions and program lines to\n-which access is required so as to modify the Software.\n-\n-Object Code: means the binary files originating from the co'..b"a case-by-case basis between the relevant Licensor and the\n-Licensee pursuant to a memorandum of understanding. The Licensor\n-disclaims any and all liability as regards the Licensee's use of the\n-name of the Software. No warranty is given as regards the existence of\n-prior rights over the name of the Software or as regards the existence\n-of a trademark.\n-\n-\n- Article 10 - TERMINATION\n-\n-10.1 In the event of a breach by the Licensee of its obligations\n-hereunder, the Licensor may automatically terminate this Agreement\n-thirty (30) days after notice has been sent to the Licensee and has\n-remained ineffective.\n-\n-10.2 A Licensee whose Agreement is terminated shall no longer be\n-authorized to use, modify or distribute the Software. However, any\n-licenses that it may have granted prior to termination of the Agreement\n-shall remain valid subject to their having been granted in compliance\n-with the terms and conditions hereof.\n-\n-\n- Article 11 - MISCELLANEOUS\n-\n-\n- 11.1 EXCUSABLE EVENTS\n-\n-Neither Party shall be liable for any or all delay, or failure to\n-perform the Agreement, that may be attributable to an event of force\n-majeure, an act of God or an outside cause, such as defective\n-functioning or interruptions of the electricity or telecommunications\n-networks, network paralysis following a virus attack, intervention by\n-government authorities, natural disasters, water damage, earthquakes,\n-fire, explosions, strikes and labor unrest, war, etc.\n-\n-11.2 Any failure by either Party, on one or more occasions, to invoke\n-one or more of the provisions hereof, shall under no circumstances be\n-interpreted as being a waiver by the interested Party of its right to\n-invoke said provision(s) subsequently.\n-\n-11.3 The Agreement cancels and replaces any or all previous agreements,\n-whether written or oral, between the Parties and having the same\n-purpose, and constitutes the entirety of the agreement between said\n-Parties concerning said purpose. No supplement or modification to the\n-terms and conditions hereof shall be effective as between the Parties\n-unless it is made in writing and signed by their duly authorized\n-representatives.\n-\n-11.4 In the event that one or more of the provisions hereof were to\n-conflict with a current or future applicable act or legislative text,\n-said act or legislative text shall prevail, and the Parties shall make\n-the necessary amendments so as to comply with said act or legislative\n-text. All other provisions shall remain effective. Similarly, invalidity\n-of a provision of the Agreement, for any reason whatsoever, shall not\n-cause the Agreement as a whole to be invalid.\n-\n-\n- 11.5 LANGUAGE\n-\n-The Agreement is drafted in both French and English and both versions\n-are deemed authentic.\n-\n-\n- Article 12 - NEW VERSIONS OF THE AGREEMENT\n-\n-12.1 Any person is authorized to duplicate and distribute copies of this\n-Agreement.\n-\n-12.2 So as to ensure coherence, the wording of this Agreement is\n-protected and may only be modified by the authors of the License, who\n-reserve the right to periodically publish updates or new versions of the\n-Agreement, each with a separate number. These subsequent versions may\n-address new issues encountered by Free Software.\n-\n-12.3 Any Software distributed under a given version of the Agreement may\n-only be subsequently distributed under the same version of the Agreement\n-or a subsequent version, subject to the provisions of Article 5.3.4.\n-\n-\n- Article 13 - GOVERNING LAW AND JURISDICTION\n-\n-13.1 The Agreement is governed by French law. The Parties agree to\n-endeavor to seek an amicable solution to any disagreements or disputes\n-that may arise during the performance of the Agreement.\n-\n-13.2 Failing an amicable solution within two (2) months as from their\n-occurrence, and unless emergency proceedings are necessary, the\n-disagreements or disputes shall be referred to the Paris Courts having\n-jurisdiction, by the more diligent Party.\n-\n-\n-Version 2.0 dated 2006-09-05.\n" |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Program.java --- a/smart_toolShed/SMART/Java/Program.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,175 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.awt.*; -import javax.swing.*; - - -public class Program { - String shortName; - String name; - String section; - String description; - Vector <ProgramOption> options; - JPanel panel; - JButton button; - - - public Program() { - this.shortName = null; - this.name = null; - this.options = new Vector <ProgramOption> (); - } - - - public void setShortName(String shortName) { - this.shortName = shortName; - } - - - public void setName(String name) { - this.name = name; - } - - - public void setSection(String section) { - this.section = section; - } - - public void setDescription(String description) { - this.description = description; - } - - - public void addOption(ProgramOption option) { - options.add(option); - } - - - public String getShortName() { - return this.shortName; - } - - - public String getName() { - return this.name; - } - - - public String getSection() { - return this.section; - } - - public String getDescription() { - return this.description; - } - - - public String checkValues() { - for (int i = 0; i < options.size(); i++) { - String comment = options.get(i).checkValue(); - if (comment != null) { - return comment; - } - } - return null; - } - - - public LinkedList<String> getCommand() { - LinkedList<String> parameterList = new LinkedList<String>(); - parameterList.add(Global.pythonCommand); - parameterList.add("Python" + java.io.File.separator + this.shortName); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - parameterList.addAll(option.getCommand()); - } - return parameterList; - } - - - public JPanel getPanel() { - if (this.panel != null) { - return this.panel; - } - - this.panel = new JPanel(false); - this.panel.setLayout(new FlowLayout()); - Box box = Box.createVerticalBox(); - - JPanel descriptionPanel = new JPanel(false); - JLabel descriptionLabel = new JLabel(this.description); - descriptionPanel.add(descriptionLabel); - box.add(descriptionPanel); - - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - JPanel panel = option.getPanel(); - if (panel == null) { - System.out.println("Problem with Python program '" + this.shortName + "'."); - return null; - } - box.add(option.getPanel()); - } - - JPanel buttonPanel = new JPanel(false); - this.button = new JButton("GO!"); - - buttonPanel.add(button); - - box.add(buttonPanel); - - this.panel.add(box); - - return this.panel; - } - - - public JButton getButton() { - if (this.button == null) { - this.getPanel(); - } - return this.button; - } - - - public Vector < File > getOutputFiles() { - Vector < File > files = new Vector < File > (); - for (int i = 0; i < options.size(); i++) { - ProgramOption option = options.get(i); - if (! option.isInput()) { - files.add(option.getOutputFile()); - } - } - return files; - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/ProgramFileReader.java --- a/smart_toolShed/SMART/Java/ProgramFileReader.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,174 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.File; -import java.io.*; - - -public class ProgramFileReader { - String fileName; - Vector <Program> programs; - - - public ProgramFileReader(String fileName) { - this.fileName = fileName; - this.programs = new Vector <Program> (); - } - - - public boolean read() { -// File file = new File(this.fileName); -// Program program = null; -// int step = 0; -// TreeMap <String, ProgramOption> options = new TreeMap <String, ProgramOption> (); - -// try { -// BufferedReader reader = new BufferedReader(new FileReader(file)); -// String line = null; -// String section = null; - -// while ((line = reader.readLine()) != null) { - -// line = line.trim(); - -// if (line.length() == 0) { -// if (program != null) { -// programs.add(program); -// } -// program = null; -// step = 0; -// continue; -// } - -// if ((line.charAt(0) == '[') && (line.charAt(line.length() - 1) == ']')) { -// section = line.substring(1, line.length() - 1).trim(); -// continue; -// } -// switch (step) { -// case 0: -// program = new Program(); -// program.setName(line); -// if (section == null) { -// System.out.println("Error! Section of program '" + line + "' is not set!"); -// } -// program.setSection(section); -// step = 1; -// break; -// case 1: -// program.setShortName(line); -// step = 2; -// break; -// case 2: -// ProgramOption option = new ProgramOption(); - -// String[] elements = line.split(":"); -// boolean input = elements[0].trim().equalsIgnoreCase("input")? true: false; -// String[] subElements = elements[1].split(";"); -// String identifier = subElements[0].trim(); - -// option.setInput(input); - -// if (input) { - -// if (subElements.length < 4) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String type = subElements[1].trim(); -// String comment = subElements[2].trim(); -// boolean compulsory = subElements[3].trim().equalsIgnoreCase("0")? false: true; - -// option.setIdentifier(identifier); -// option.setType(type); -// option.setComment(comment); -// option.setCompulsory(compulsory); - -// if ("file".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String formatIdentifier = subElements[4].trim(); -// option.setFormatIdentifier(formatIdentifier); -// } -// else if ("choice".compareToIgnoreCase(type) == 0) { -// if (subElements.length < 5) { -// System.out.println("Line '" + line + "' is weird..."); -// } - -// String[] choices = subElements[4].trim().split(","); -// for (int i = 0; i < choices.length; i++) { -// choices[i] = choices[i].trim(); -// } -// option.setChoices(choices); -// } -// options.put(identifier, option); -// } -// else { -// String format = subElements[1].trim(); - -// option.setFormat(format); -// option.setAssociatedOption(options.get(identifier)); -// } - -// program.addOption(option); - -// break; -// default: -// return false; -// } -// } - -// reader.close(); -// } -// catch (FileNotFoundException e) { -// return false; -// } -// catch (IOException e) { -// return false; -// } - -// if (program != null) { -// programs.add(program); -// } - - return true; - } - - public int getNbPrograms() { - return programs.size(); - } - - public Program getProgram(int i) { - return programs.get(i); - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/ProgramLauncher.java --- a/smart_toolShed/SMART/Java/ProgramLauncher.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,209 +0,0 @@ -/** - * - * Copyright INRA-URGI 2009-2010 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - * - */ -import java.util.*; -import java.io.*; -import javax.swing.SwingUtilities; -import javax.swing.*; -import java.util.concurrent.CountDownLatch; - -public class ProgramLauncher extends SwingWorker<Boolean, String> { - - String[] command; - JTextArea logArea; - JLabel messageField; - JProgressBar progressBar; - JLabel etaField; - int exitValue; - CountDownLatch latch; - - - - public ProgramLauncher (LinkedList <String> c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = new String[c.size()]; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - c.toArray(command); - latch = new CountDownLatch(1); - } - - - public ProgramLauncher (String[] c, JTextArea la, JLabel mf, JProgressBar pb, JLabel ef) { - command = c; - logArea = la; - messageField = mf; - progressBar = pb; - etaField = ef; - exitValue = -1; - latch = new CountDownLatch(1); - } - - - @Override - public Boolean doInBackground() { - ProcessBuilder pb = new ProcessBuilder(command); - Process process = null; - BufferedReader outputReader = null; - pb = pb.redirectErrorStream(true); - Map<String, String> env = pb.environment(); - env.put("PYTHONPATH", System.getProperty("user.dir")); - env.put("SMARTPATH", System.getProperty("user.dir") + java.io.File.separator + "SMART" + java.io.File.separator + "Java" + java.io.File.separator + "Python"); - env.put("SMARTMYSQLPATH", Global.mysqlCommand); - env.put("SMARTRPATH", Global.rCommand); - String commandJoined = Arrays.toString(command); - - try { - publish("=== Starting command '" + commandJoined.trim() + "' ===\n"); - process = pb.start(); - - BufferedInputStream outputStream = new BufferedInputStream(process.getInputStream()); - InputStream is = process.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - outputReader = new BufferedReader(isr); - } - catch (Exception exception) { - publish("!Process cannot be started (command is '" + commandJoined + "')!\n"); - exception.printStackTrace(); - latch.countDown(); - return Boolean.FALSE; - } - if (outputReader == null) { - publish("!Problem in the output of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - else { - try { - String line; - while ((line = outputReader.readLine()) != null) { - publish(line + "\n"); - } - } - catch (IOException e) { - e.printStackTrace(); - publish("!Cannot get the output of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - } - try { - process.waitFor(); - } - catch (InterruptedException e) { - e.printStackTrace(); - publish("!Cannot wait for the end of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - try { - exitValue = process.exitValue(); - } - catch (IllegalThreadStateException e) { - e.printStackTrace(); - publish("!Cannot get the exit value of the command!\n"); - latch.countDown(); - return Boolean.FALSE; - } - if (exitValue != 0) { - publish("!Problem during the execution of the command '" + commandJoined + "'!\n"); - latch.countDown(); - return Boolean.FALSE; - } - publish("=== Ending command '" + commandJoined.trim() + "' ===\n"); - latch.countDown(); - return Boolean.TRUE; - } - - - @Override - protected void process(List<String> chunks) { - String message = ""; - String text = logArea.getText(); - for (String chunk: chunks) { - text += chunk; - } - for (String lineSeparatedByCarriageReturn: text.split("\n")) { - for (String line: lineSeparatedByCarriageReturn.split("\r")) { - boolean progressLine = false; - if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*")) { - String[] ratioElements = line.split("\\]")[1].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText(""); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*/\\d*\\s*ETA:\\s*.*")) { - String[] ratioElements = line.split("\\]")[1].split("E")[0].trim().split("/"); - int current = Integer.parseInt(ratioElements[0].trim()); - int aim = Integer.parseInt(ratioElements[1].trim()); - String eta = line.split("ETA:")[1].trim(); - messageField.setText(line.split("\\[")[0].trim()); - progressBar.setValue(current * 100 / aim); - etaField.setText("ETA: " + eta); - progressLine = true; - } - else if (line.matches(".*\\[=*\\s*\\]\\s*\\d*\\s*completed in.*")) { - String nbElements = line.split("\\]")[1].split("completed")[0].trim(); - String timeSpent = line.split("completed in")[1].trim(); - message += line.split("\\[")[0].trim() + ": " + nbElements + " elements completed in " + timeSpent + "\n"; - messageField.setText(line.split("\\[")[0].trim()); - progressLine = true; - } - if (! progressLine) { - message += line + "\n"; - } - } - } - String lines[] = message.split("\n"); - String toBeWritten = ""; - for (int i = Math.max(0, lines.length - Global.logAreaSize); i < lines.length; i++) { - toBeWritten += lines[i] + "\n"; - } - logArea.setText(toBeWritten); - } - - public int getExitValue() { - try { - latch.await(); - } - catch (InterruptedException e) { - logArea.append("Cannot wait for the end of the process!\n"); - e.printStackTrace(); - return -1; - } - return exitValue; - } -} |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/ProgramOption.java --- a/smart_toolShed/SMART/Java/ProgramOption.java Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,358 +0,0 @@\n-/**\n- *\n- * Copyright INRA-URGI 2009-2010\n- * \n- * This software is governed by the CeCILL license under French law and\n- * abiding by the rules of distribution of free software. You can use,\n- * modify and/ or redistribute the software under the terms of the CeCILL\n- * license as circulated by CEA, CNRS and INRIA at the following URL\n- * "http://www.cecill.info".\n- * \n- * As a counterpart to the access to the source code and rights to copy,\n- * modify and redistribute granted by the license, users are provided only\n- * with a limited warranty and the software\'s author, the holder of the\n- * economic rights, and the successive licensors have only limited\n- * liability.\n- * \n- * In this respect, the user\'s attention is drawn to the risks associated\n- * with loading, using, modifying and/or developing or reproducing the\n- * software by the user in light of its specific status of free software,\n- * that may mean that it is complicated to manipulate, and that also\n- * therefore means that it is reserved for developers and experienced\n- * professionals having in-depth computer knowledge. Users are therefore\n- * encouraged to load and test the software\'s suitability as regards their\n- * requirements in conditions enabling the security of their systems and/or\n- * data to be ensured and, more generally, to use and operate it in the\n- * same conditions as regards security.\n- * \n- * The fact that you are presently reading this means that you have had\n- * knowledge of the CeCILL license and that you accept its terms.\n- *\n- */\n-import java.util.*;\n-import java.awt.*;\n-import java.awt.event.ActionEvent;\n-import java.awt.event.ActionListener;\n-import java.io.*;\n-import javax.swing.*;\n-import javax.swing.filechooser.*;\n-import javax.swing.border.*;\n-import javax.swing.SwingUtilities;\n-\n-\n-public class ProgramOption {\n- boolean input;\n- String identifier;\n- String type;\n- String comment;\n- boolean compulsory;\n- String[] format;\n- String formatIdentifier;\n- ProgramOption associatedOption;\n- String defaultValue;\n- String[] choices;\n- JComponent component;\n- JPanel panel;\n-\n-\n- public ProgramOption() {\n- this.input = true;\n- this.identifier = null;\n- this.type = null;\n- this.comment = null;\n- this.compulsory = false;\n- this.format = null;\n- this.formatIdentifier = null;\n- this.associatedOption = null;\n- this.defaultValue = "";\n- this.choices = null;\n- this.component = null;\n- this.panel = null;\n- }\n-\n-\n- public void setInput(boolean input) {\n- this.input = input;\n- }\n-\n-\n- public void setIdentifier(String identifier) {\n- this.identifier = identifier;\n- }\n-\n-\n- public void setType(String type) {\n- this.type = type;\n- }\n-\n-\n- public void setComment(String comment) {\n- this.comment = comment;\n- }\n-\n-\n- public void setCompulsory(boolean compulsory) {\n- this.compulsory = compulsory;\n- }\n-\n-\n- public void setFormat(String[] format) {\n- this.format = format;\n- }\n-\n-\n- public void setFormat(String format) {\n- this.format = new String[1];\n- this.format[0] = format;\n- }\n-\n-\n- public void setFormatIdentifier(String formatIdentifier) {\n- this.formatIdentifier = formatIdentifier;\n- }\n-\n-\n- public void setAssociatedOption(ProgramOption option) {\n- this.associatedOption = option;\n- }\n-\n-\n- public void setChoices(String[] choices) {\n- this.choices = new String[choices.length+1];\n- this.choices[0] = "---";\n- for (int i = 0; i < choices.length; i++) {\n- this.choices[i+1] = choices[i];\n- }\n- }\n-\n-\n- public void setDefault(String defaultValue) {\n- this.defaultValue = defaultValue;\n- }\n-\n-\n- public boolean isInput() {\n- return this.input;\n- }\n-\n-\n- public boolean checkSettings() {\n- if (this.identifier == null) {\n- return false;\n- }\n- if (this.type == nul'..b'{\n- this.component = new JComboBox(this.choices);\n- label.setLabelFor(this.component);\n- this.panel.add(label);\n- this.panel.add(this.component);\n- }\n- else {\n- System.out.println("Do not know how to read type " + this.type);\n- }\n-\n- return this.panel;\n- }\n-\n-\n- public JComponent getComponent() {\n- if (component == null) {\n- this.getPanel();\n- }\n- return this.component;\n- }\n-\n-\n- private String getValue() {\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("directory".equals(this.type)) || ("files".equals(this.type))) {\n- String s = ((JTextField) this.component).getText();\n- if ("None".equals(s)) {\n- return "";\n- }\n- return s;\n- }\n- if ("file".equals(this.type)) {\n- return (String) ((JComboBox) this.component).getSelectedItem();\n- }\n- if ("boolean".equals(this.type)) {\n- return ((JCheckBox) this.component).isSelected()? "true": "false";\n- }\n- if ("format".equals(this.type)) {\n- return (String) ((JComboBox) this.component).getSelectedItem();\n- }\n- if ("choice".equals(this.type)) {\n- String s = (String) ((JComboBox) this.component).getSelectedItem();\n- if ("---".equals(s)) {\n- return "";\n- }\n- return s;\n- }\n- System.out.println("Do not know how to get value of \'" + this.type + "\' (" + this.identifier + ").");\n- return null;\n- }\n-\n-\n- public String checkValue() {\n- String value = this.getValue();\n- if ((this.compulsory) && ((value == null) || ("".equals(value)))) {\n- return "Option \'" + this.comment + "\' has no value... Please specify it.\\n";\n- }\n- if ("int".equals(this.type)) {\n- if ((value != null) && (! "".equals(value)) && (! "None".equals(value))) {\n- try {\n- int i = Integer.parseInt(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be an integer... Please correct it.\\n";\n- }\n- }\n- }\n- else if ("float".equals(this.type)) {\n- if ((value != null) && (! "".equals(value))) {\n- try {\n- float i = Float.parseFloat(value);\n- }\n- catch (NumberFormatException e) {\n- return "Option \'" + this.comment + "\' should be a float... Please correct it.\\n";\n- }\n- }\n- }\n- return null;\n- }\n-\n-\n- public LinkedList <String> getCommand() {\n- LinkedList <String> list = new LinkedList <String> ();\n-\n- if (("int".equals(this.type)) || ("float".equals(this.type)) || ("string".equals(this.type)) || (("file".equals(this.type)) && (! this.input)) || ("format".equals(this.type)) || ("directory".equals(this.type)) || ("files".equals(this.type)) || ("choice".equals(this.type))) {\n- String value = this.getValue();\n- if (value.length() == 0) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(value);\n- return list;\n- }\n- if ("file".equals(this.type)) {\n- String fileName = (String) ((JComboBox) this.component).getSelectedItem();\n- if (fileName == null) {\n- return list;\n- }\n- list.add(this.identifier);\n- list.add(this.getValue());\n- return list;\n- }\n- if (("boolean".equals(this.type)) || ("bool".equals(this.type))) {\n- if ("true".equals(this.getValue())) {\n- list.add(this.identifier);\n- }\n- return list;\n- }\n- System.out.println("Cannot get type of option " + this.type + " (" + this.identifier + "): " + this.getValue());\n- return null;\n- }\n-\n-\n- public File getOutputFile() {\n- if (this.input) return null;\n- String format = "";\n- if (this.format != null) {\n- format = this.format[0];\n- }\n- if (this.associatedOption != null) {\n- format = this.associatedOption.getValue();\n- }\n- return new File(this.getValue(), Global.formats.getFormatType(format), format);\n- }\n-}\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/.gitignore --- a/smart_toolShed/SMART/Java/Python/.gitignore Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,1 +0,0 @@ -/CleanTranscriptFile.py |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CleanTranscriptFile.py --- a/smart_toolShed/SMART/Java/Python/CleanTranscriptFile.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,74 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2011 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -from optparse import OptionParser -from SMART.Java.Python.cleaning.CleanerChooser import CleanerChooser - - -class CleanTranscriptFile(object): - - def __init__(self, verbosity): - self.verbosity = verbosity - self.chooser = CleanerChooser(self.verbosity) - - def setInputFile(self, fileName, format): - self.chooser.findFormat(format) - self.cleaner = self.chooser.getCleaner() - self.cleaner.setInputFileName(fileName) - - def setOutputFile(self, fileName): - self.cleaner.setOutputFileName(fileName) - - def setAcceptedTypes(self, types): - if types != None: - self.cleaner.setAcceptedTypes(types) - - def run(self): - self.cleaner.clean() - - -if __name__ == "__main__": - - description = "Clean Transcript File v1.0.1: Clean a transcript file so that it is useable for S-MART. [Category: Other]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="query input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of previous file [compulsory] [format: transcript file format]") - parser.add_option("-t", "--types", dest="acceptedTypes", action="store", default=None, type="string", help="name of the types you want to keep in GFF/GTF (list separated by commas) [format: string] [default: None]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - ctf = CleanTranscriptFile(options.verbosity) - ctf.setInputFile(options.inputFileName, options.format) - ctf.setOutputFile(options.outputFileName) - ctf.setAcceptedTypes(None if options.acceptedTypes == None else options.acceptedTypes.split(",")) - ctf.run() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/ClusterizeByTags.py --- a/smart_toolShed/SMART/Java/Python/ClusterizeByTags.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,157 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2011\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import random\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.TranscriptWriter import TranscriptWriter\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.mySql.MySqlConnection import MySqlConnection\n-from commons.core.writer.MySqlTranscriptWriter import MySqlTranscriptWriter\n-\n-\n-OPERATIONS = ("diff", "div")\n-BOOLTOSTRANDS = {True: [0], False: [-1, 1]}\n-\n-class ClusterizeByTags(object):\n-\n- def __init__(self, verbosity):\n- self.verbosity = verbosity\n- self.connection = MySqlConnection(self.verbosity-1)\n- self.defautValue = None\n- self.maxDistance = None\n- self.oneStrand = False\n-\n- def setInputFile(self, fileName, format):\n- chooser = ParserChooser(self.verbosity)\n- chooser.findFormat(format)\n- parser = chooser.getParser(fileName)\n- writer = MySqlTranscriptWriter(self.connection, None, self.verbosity)\n- writer.addTranscriptList(parser)\n- writer.write()\n- self.transcriptTables = writer.getTables()\n-\n- def setOutputFile(self, fileName):\n- self.writer = TranscriptWriter(fileName, "gff3", self.verbosity)\n-\n- def setTag(self, tagName, defaultValue):\n- self.tagName = tagName\n- self.defaultValue = defaultValue\n-\n- def setThreshold(self, threshold):\n- self.threshold = threshold\n-\n- def setOperation(self, operation):\n- self.operation = operation\n- if self.operation not in OPERATIONS:\n- raise Exception("Operation \'%s\' unsupported: choose among %s" % (self.operation, ", ".join(OPERATIONS)))\n-\n- def setMaxDistance(self, distance):\n- self.maxDistance = distance\n-\n- def setOneStrand(self, oneStrand):\n- self.oneStrand = oneStrand\n-\n- def run(self):\n- for chromosome in sorted(self.transcriptTables.keys()):\n- progress = Progress(self.transcriptTables[chromosome].getNbElements(), "Analyzing %s" % (chromosome), self.verbosity)\n- for strand in BOOLTOSTRANDS[self.oneStrand]:\n- previousValue = None\n- previousTrend = None\n- previousTranscript = None\n- sumValue = 0\n- command = "SELECT * FROM %s" % (self.tran'..b' trend = value / previousValue\n- if previousTranscript == None:\n- sumValue = value\n- elif (previousTrend == None or abs(trend - previousTrend) <= self.threshold) and (self.maxDistance == None or previousTranscript.getDistance(transcript) <= self.maxDistance) and (previousTranscript.getDirection() == transcript.getDirection() or not self.oneStrand):\n- if previousTranscript.getDirection() != transcript.getDirection():\n- transcript.reverse()\n- previousTranscript.merge(transcript)\n- transcript = previousTranscript\n- sumValue += value\n- previousTrend = trend\n- else:\n- previousTranscript.setTagValue(self.tagName, sumValue)\n- self.writer.addTranscript(previousTranscript)\n- sumValue = value\n- previousTrend = None\n- previousValue = value\n- previousTranscript = transcript\n- progress.inc()\n- if previousTranscript != None:\n- previousTranscript.setTagValue(self.tagName, sumValue)\n- self.writer.addTranscript(previousTranscript)\n- progress.done()\n- self.writer.close()\n-\n-\n-if __name__ == "__main__":\n- \n- description = "Clusterize By Tags v1.0.1: Clusterize a set of element using their tag values. [Category: Merge]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="query input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of previous file [compulsory] [format: transcript file format]")\n- parser.add_option("-t", "--tag", dest="tagName", action="store", type="string", help="name of the tag [format: string] [compulsory]")\n- parser.add_option("-e", "--default", dest="defaultValue", action="store", default=None, type="int", help="default value for the tag [format: string]")\n- parser.add_option("-r", "--threshold", dest="threshold", action="store", type="int", help="threshold between two consecutive tags [format: int] [compulsory]")\n- parser.add_option("-p", "--operation", dest="operation", action="store", type="string", help="operation to apply between 2 different clusters to compare them [format: choice (diff, div)] [compulsory]")\n- parser.add_option("-d", "--distance", dest="maxDistance", action="store", default=None, type="int", help="maximum distance for 2 clusters to be merged [format: int] [default: None]")\n- parser.add_option("-1", "--oneStrand", dest="oneStrand", action="store_true", default=False, help="also cluster the elements which are on different strands [format: bool] [default: False]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n- cbt = ClusterizeByTags(options.verbosity)\n- cbt.setInputFile(options.inputFileName, options.format)\n- cbt.setOutputFile(options.outputFileName)\n- cbt.setTag(option.tagName, option.defaultValue)\n- cbt.setThreshold(option.threshold)\n- cbt.setOperation(option.operation)\n- cbt.setMaxDistance(operation.maxDistance)\n- cbt.setOneStrand(operation.oneStrand)\n- cbt.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CollapseReads.py --- a/smart_toolShed/SMART/Java/Python/CollapseReads.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,174 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os\n-from optparse import OptionParser, OptionGroup\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.ncList.NCListFilePickle import NCListFileUnpickle\n-from SMART.Java.Python.ncList.FileSorter import FileSorter\n-from SMART.Java.Python.misc.Progress import Progress\n-\n-\n-class CollapseReads(object):\n- """\n- Merge two reads if they have exactly the same genomic coordinates\n- """\n-\n- def __init__(self, verbosity = 0):\n- self.verbosity = verbosity\n- self.inputReader = None\n- self.outputWriter = None\n- self.strands = True\n- self.nbRead = 0\n- self.nbWritten = 0\n- self.nbMerges = 0\n- self.splittedFileNames = {}\n-\n- def __del__(self):\n- for fileName in self.splittedFileNames.values():\n- os.remove(fileName)\n- \n- def close(self):\n- self.outputWriter.close()\n- \n- def setInputFile(self, fileName, format):\n- parserChooser = ParserChooser(self.verbosity)\n- parserChooser.findFormat(format, "transcript")\n- self.parser = parserChooser.getParser(fileName)\n- self.sortedFileName = "%s_sorted.pkl" % (os.path.splitext(fileName)[0])\n-\n- def setOutputFile(self, fileName):\n- self.outputWriter = Gff3Writer(fileName, self.verbosity)\n-\n- def getNbElements(self):\n- return self.parser.getNbTranscripts()\n-\n- def _sortFile(self):\n- fs = FileSorter(self.parser, self.verbosity-4)\n- fs.perChromosome(True)\n- fs.setOutputFileName(self.sortedFileName)\n- fs.sort()\n- self.splittedFileNames = fs.getOutputFileNames()\n- self.nbElementsPerChromosome = fs.getNbElementsPerChromosome()\n- self.nbRead = fs.getNbElements()\n- \n- def _iterate(self, chromosome):\n- progress = Progress(self.nbElementsPerChromosome[chromosome], "Checking chromosome %s" % (chromosome), self.verbosity)\n- transcripts = []\n- parser = NCListFileUnpickle(self.splittedFileNames[chromosome], self.verbosity)\n- for newTranscript in parser.getIterator():\n- newTranscripts = []\n- for oldTranscript in transcripts:\n- if self._checkOverlap(newTranscript, oldTranscr'..b'pt2):\n- self.nbMerges += 1\n- transcript2.setDirection(transcript1.getDirection())\n- transcript1.merge(transcript2)\n-\n- def _write(self, transcript):\n- self.nbWritten += 1\n- self.outputWriter.addTranscript(transcript)\n-\n- def _checkOverlap(self, transcript1, transcript2):\n- if transcript1.getStart() != transcript2.getStart() or transcript1.getEnd() != transcript2.getEnd():\n- return False\n- return (not self.strands or transcript1.getDirection() == transcript2.getDirection())\n-\n- def _checkPassed(self, transcript1, transcript2):\n- return (transcript2.getStart() < transcript1.getStart())\n-\n- def collapseChromosome(self, chromosome):\n- progress = Progress(table.getNbElements(), "Analysing chromosome %s" % (chromosome), self.verbosity)\n- command = "SELECT * FROM %s ORDER BY start ASC, end DESC" % (table.name)\n- transcriptStart = None\n- transcriptEnd = None\n- transcriptDirection = None\n- currentTranscript = None\n- if self.strands:\n- command += ", direction"\n- for index, transcript in table.selectTranscripts(command, True):\n- self.nbRead += 1\n- if not self.strands:\n- transcript.setDirection("+")\n- if transcriptStart != transcript.getStart() or transcriptEnd != transcript.getEnd() or transcriptDirection != transcript.getDirection():\n- self.writeTranscript(currentTranscript)\n- transcriptStart = transcript.getStart()\n- transcriptEnd = transcript.getEnd()\n- transcriptDirection = transcript.getDirection()\n- currentTranscript = transcript\n- else:\n- currentTranscript.setTagValue("nbElements", (currentTranscript.getTagValue("nbElements") + 1) if "nbElements" in currentTranscript.getTagNames() else 1)\n- progress.inc()\n- self.writeTranscript(currentTranscript)\n- progress.done()\n-\n- def collapse(self):\n- self._sortFile()\n- for chromosome in sorted(self.nbElementsPerChromosome.keys()):\n- self._iterate(chromosome)\n- self.outputWriter.close()\n- if self.verbosity > 1:\n- print "# reads read: %d" % (self.nbRead)\n- print "# reads written: %d (%.2f%%)" % (self.nbWritten, float(self.nbWritten) / self.nbRead * 100)\n- print "# reads merges: %d" % (self.nbMerges)\n-\n-if __name__ == "__main__":\n- \n- # parse command line\n- description = "Collapse Reads v1.0.3: Merge two reads if they have exactly the same genomic coordinates. [Category: Merge]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in mapping format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the file [compulsory] [format: mapping file format]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]")\n- parser.add_option("-s", "--strands", dest="strands", action="store_true", default=False, help="merge elements on 2 different strands [format: bool] [default: false]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]")\n- (options, args) = parser.parse_args()\n-\n- collapser = CollapseReads(options.verbosity)\n- collapser.setInputFile(options.inputFileName, options.format)\n- collapser.setOutputFile(options.outputFileName)\n- collapser.strands = not options.strands\n- collapser.collapse()\n- collapser.close()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CombineTags.py --- a/smart_toolShed/SMART/Java/Python/CombineTags.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,115 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2011 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import os -import random -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.Progress import Progress -from commons.core.parsing.ParserChooser import ParserChooser -from commons.core.writer.Gff3Writer import Gff3Writer - -OPERATIONS = ("plus", "minus", "times", "div") - -class CombineTags(object): - - def __init__(self, verbosity = 0): - self.verbosity = verbosity - - def setInputFile(self, fileName, format): - self.inputFileName = fileName - parserChooser = ParserChooser(self.verbosity) - parserChooser.findFormat(format, "transcript") - self.parser = parserChooser.getParser(fileName) - - def setOutputFile(self, fileName): - self.outputWriter = Gff3Writer(fileName, self.verbosity) - - def setTags(self, tag1, tag2, outputTag, defaultValue = None): - self.tag1 = tag1 - self.tag2 = tag2 - self.outputTag = outputTag - self.defaultValue = defaultValue - - def setOperation(self, operation): - self.operation = operation - if self.operation not in OPERATIONS: - raise Exception("Do no handle operation %s, only: %s" % (self.operation, ", ".join(OPERATIONS))) - - def run(self): - progress = Progress(self.parser.getNbTranscripts(), "Printing transcripts %s" % (self.inputFileName), self.verbosity) - for transcript in self.parser.getIterator(): - tag1 = transcript.getTagValue(self.tag1) - tag2 = transcript.getTagValue(self.tag2) - if tag1 == None or tag2 == None: - if self.defaultValue == None: - raise Exception("Transcript %s misses one of the tags %s and %s, and has no default value !" % (transcript, self.tag1, self.tag2)) - newTag = self.defaultValue - else: - tag1, tag2 = float(tag1), float(tag2) - if self.operation == "plus": - newTag = tag1 + tag2 - elif self.operation == "minus": - newTag = tag1 - tag2 - elif self.operation == "times": - newTag = tag1 * tag2 - elif self.operation == "div": - newTag = tag1 / tag2 - transcript.setTagValue(self.outputTag, newTag) - self.outputWriter.addTranscript(transcript) - progress.inc() - progress.done() - self.parser.close() - self.outputWriter.close() - - -if __name__ == "__main__": - - # parse command line - description = "Change Tag Name v1.0.1: Change the name of tag of a list of transcripts. [Category: Data Modification]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-t", "--tag1", dest="tag1", action="store", type="string", help="name of the first tag [compulsory] [format: string]") - parser.add_option("-T", "--tag2", dest="tag2", action="store", type="string", help="name of the second tag [compulsory] [format: string]") - parser.add_option("-d", "--default", dest="defaultValue", action="store", default=None, type="string", help="default value when one of the tag is absent [compulsory] [format: float]") - parser.add_option("-n", "--new", dest="newTag", action="store", type="string", help="name of the new tag [compulsory] [format: string]") - parser.add_option("-p", "--operation", dest="operation", action="store", type="string", help="operation combining the tags [compulsory] [format: choice (plus, minus, times, div)]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") - (options, args) = parser.parse_args() - - combiner = CombineTags(options.verbosity) - combiner.setInputFile(options.inputFileName, options.inputFormat) - combiner.setOutputFile("%s.gff3" % (options.outputFileName)) - combiner.setTags(options.tag1, options.tag2, options.newTag, options.defaultValue) - combiner.setOperation(options.operation) - combiner.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CompareOverlapping.py --- a/smart_toolShed/SMART/Java/Python/CompareOverlapping.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,491 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os, struct, time, random\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.ncList.NCList import NCList\n-from SMART.Java.Python.ncList.NCListCursor import NCListCursor\n-from SMART.Java.Python.ncList.NCListFilePickle import NCListFilePickle, NCListFileUnpickle\n-from SMART.Java.Python.ncList.NCListHandler import NCListHandler\n-from SMART.Java.Python.ncList.ConvertToNCList import ConvertToNCList\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-from SMART.Java.Python.misc import Utils\n-try:\n-\timport cPickle as pickle\n-except:\n-\timport pickle\n-\n-REFERENCE = 0\n-QUERY = 1\n-TYPES = (REFERENCE, QUERY)\n-TYPETOSTRING = {0: "reference", 1: "query"}\n-\n-class CompareOverlapping(object):\n-\n-\tdef __init__(self, verbosity = 1):\n-\t\tself._outputFileName\t\t = "outputOverlaps.gff3"\n-\t\tself._iWriter\t\t\t\t = None\n-\t\tself._nbOverlappingQueries\t = 0\n-\t\tself._nbOverlaps\t\t\t = 0\n-\t\tself._nbLines\t\t\t\t = {REFERENCE: 0, QUERY: 0}\n-\t\tself._verbosity\t\t\t\t = verbosity\n-\t\tself._ncLists\t\t\t\t = {}\n-\t\tself._cursors\t\t\t\t = {}\n-\t\tself._splittedFileNames\t\t = {}\n-\t\tself._nbElements\t\t\t = {}\n-\t\tself._nbElementsPerChromosome = {}\n-\t\tself._inputFileNames\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._inputFileFormats\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._starts\t\t\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._ends\t\t\t\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._fivePrimes\t\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._threePrimes\t\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._ncListHandlers\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._convertedFileNames\t = {REFERENCE: False, QUERY: False}\n-\t\tself._sorted = False\n-\t\tself._index = False\n-\t\tself._introns\t\t\t\t = False\n-\t\tself._antisense\t\t\t\t = False\n-\t\tself._colinear\t\t\t\t = False\n-\t\tself._invert\t\t\t\t = False\n-\t\tself._distance\t\t\t\t = 0\n-\t\tself._minOverlap\t\t\t = 1\n-\t\tself._pcOverlap\t\t\t\t = None\n-\t\tself._included\t\t\t\t = False\n-\t\tself._including\t\t\t\t = False\n-\t\tself._outputNotOverlapping\t = False\n-\t\tself._tmpRefFileName\t\t = None\n-\t\tself._currentQueryTranscript = None\n-\t\tself._currentOrQueryTranscript = None\n-\t'..b'in file 1 (do not use it with -S) [format: int]")\n-\tparser.add_option("-u", "--end2",\t\t\t dest="end2",\t\t action="store",\t default=None, type="int",\thelp="only consider the n last nucleotides of the transcripts in file 2 (do not use it with -s) [format: int]")\n-\tparser.add_option("-t", "--intron",\t\t dest="introns",\t\t action="store_true", default=False,\t\t\t\thelp="also report introns [format: bool] [default: false]")\n-\tparser.add_option("-E", "--5primeExtension1", dest="fivePrime1",\t action="store",\t default=None, type="int",\thelp="extension towards 5\' in file 1 [format: int]")\n-\tparser.add_option("-e", "--5primeExtension2", dest="fivePrime2",\t action="store",\t default=None, type="int",\thelp="extension towards 5\' in file 2 [format: int]")\n-\tparser.add_option("-N", "--3primeExtension1", dest="threePrime1",\t action="store",\t default=None, type="int",\thelp="extension towards 3\' in file 1 [format: int]")\n-\tparser.add_option("-n", "--3primeExtension2", dest="threePrime2",\t action="store",\t default=None, type="int",\thelp="extension towards 3\' in file 2 [format: int]")\n-\tparser.add_option("-c", "--colinear",\t\t dest="colinear",\t\t action="store_true", default=False,\t\t\t\thelp="colinear only [format: bool] [default: false]")\n-\tparser.add_option("-a", "--antisense",\t\t dest="antisense",\t\t action="store_true", default=False,\t\t\t\thelp="antisense only [format: bool] [default: false]")\n-\tparser.add_option("-d", "--distance",\t\t dest="distance",\t action="store",\t default=0,\t type="int",\thelp="accept some distance between query and reference [format: int]")\n-\tparser.add_option("-k", "--included",\t\t dest="included",\t action="store_true", default=False,\t\t\t\thelp="keep only elements from file 1 which are included in an element of file 2 [format: bool] [default: false]")\n-\tparser.add_option("-K", "--including",\t\t dest="including",\t action="store_true", default=False,\t\t\t\thelp="keep only elements from file 2 which are included in an element of file 1 [format: bool] [default: false]")\n-\tparser.add_option("-m", "--minOverlap",\t\t dest="minOverlap",\t action="store",\t default=1,\t type="int",\thelp="minimum number of nucleotides overlapping to declare an overlap [format: int] [default: 1]")\n-\tparser.add_option("-p", "--pcOverlap",\t\t dest="pcOverlap",\t action="store",\t default=None, type="int",\thelp="minimum percentage of nucleotides to overlap to declare an overlap [format: int]")\n-\tparser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False,\t\t\t\thelp="also output not overlapping data [format: bool] [default: false]")\n-\tparser.add_option("-x", "--exclude",\t\t dest="exclude",\t\t action="store_true", default=False,\t\t\t\thelp="invert the match [format: bool] [default: false]")\n-\tparser.add_option("-v", "--verbosity",\t\t dest="verbosity",\t\t action="store",\t default=1,\t type="int",\thelp="trace level [format: int]")\n-\t(options, args) = parser.parse_args()\n-\n-\tco = CompareOverlapping(options.verbosity)\n-\tco.setInput(options.inputFileName1, options.format1, QUERY)\n-\tco.setInput(options.inputFileName2, options.format2, REFERENCE)\n-\tco.setOutput(options.output)\n-\tco.setSorted(options.sorted)\n-\tco.setIndex(options.index)\n-\tco.restrictToStart(options.start1, QUERY)\n-\tco.restrictToStart(options.start2, REFERENCE)\n-\tco.restrictToEnd(options.end1, QUERY)\n-\tco.restrictToEnd(options.end2, REFERENCE)\n-\tco.extendFivePrime(options.fivePrime1, QUERY)\n-\tco.extendFivePrime(options.fivePrime2, REFERENCE)\n-\tco.extendThreePrime(options.threePrime1, QUERY)\n-\tco.extendThreePrime(options.threePrime2, REFERENCE)\n-\tco.acceptIntrons(options.introns)\n-\tco.getAntisenseOnly(options.antisense)\n-\tco.getColinearOnly(options.colinear)\n-\tco.getInvert(options.exclude)\n-\tco.setMaxDistance(options.distance)\n-\tco.setMinOverlap(options.minOverlap)\n-\tco.setPcOverlap(options.pcOverlap)\n-\tco.setIncludedOnly(options.included)\n-\tco.setIncludingOnly(options.including)\n-\tco.includeNotOverlapping(options.notOverlapping)\n-\tco.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CompareOverlappingSmallQuery.py --- a/smart_toolShed/SMART/Java/Python/CompareOverlappingSmallQuery.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,226 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2011\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.TranscriptWriter import TranscriptWriter\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Mapping import Mapping\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-\n-MINBIN = 3\n-MAXBIN = 7\n-REFERENCE = 0\n-QUERY = 1\n-\n-def getBin(start, end):\n-\tfor i in range(MINBIN, MAXBIN + 1):\n-\t\tbinLevel = 10 ** i\n-\t\tif int(start / binLevel) == int(end / binLevel):\n-\t\t\treturn int(i * 10 ** (MAXBIN + 1) + int(start / binLevel))\n-\treturn int((MAXBIN + 1) * 10 ** (MAXBIN + 1))\n-\n-def getOverlappingBins(start, end):\n-\tarray\t= []\n-\tbigBin = int((MAXBIN + 1) * 10 ** (MAXBIN + 1))\n-\tfor i in range(MINBIN, MAXBIN + 1):\n-\t\tbinLevel = 10 ** i\n-\t\tarray.append((int(i * 10 ** (MAXBIN + 1) + int(start / binLevel)), int(i * 10 ** (MAXBIN + 1) + int(end / binLevel))))\n-\tarray.append((bigBin, bigBin))\n-\treturn array\n-\n-\n-class CompareOverlappingSmallQuery(object):\n-\n-\tdef __init__(self, verbosity):\n-\t\tself.verbosity = verbosity\n-\t\tself.tableNames = {}\n-\t\tself.nbQueries = 0\n-\t\tself.nbRefs\t = 0\n-\t\tself.nbWritten = 0\n-\t\tself.nbOverlaps = 0\n-\t\tself.distance = None\n-\t\tself.invert = False\n-\t\tself.antisense = False\n-\t\tself.collinear = False\n-\t\tself.bins\t = {}\n-\t\tself.overlaps = {}\n-\t\tself.notOverlapping = False\n-\n-\tdef setReferenceFile(self, fileName, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tself.refParser = chooser.getParser(fileName)\n-\n-\tdef setQueryFile(self, fileName, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tself.queryParser = chooser.getParser(fileName)\n-\n-\tdef setOutputFile(self, fileName):\n-\t\tself.writer = TranscriptWriter(fileName, "gff3", self.verbosity)\n-\n-\tdef setDistance(self, distance):\n-\t\tself.distance = distance\n-\n-\tdef setInvert(self, boolean):\n-\t\tself.invert = boolean\n-\n-\tdef setCollinear(self, boolean):\n-\t\tself.collinear = boolean\n-\n-\tdef setAntisense(self, boolean):\n-\t\tself.antisense = boolean\n-\n-\tdef includeNotOverlapping(self, boolean):\n-\t\tself.notOverlapping = boolean\n-\n-\tdef loadQuery(self):\n-\t\tprogress = UnlimitedProgress(10000, "Reading queries", self.verbosity)\n-\t\tfor tr'..b'nts\n-\n-\tdef _updateTranscript(self, queryTranscript):\n-\t\toverlaps = self.overlaps[queryTranscript]\n-\t\tqueryTranscript.setTagValue("nbOverlaps", sum(overlaps.values()))\n-\t\tif overlaps:\n-\t\t\tqueryTranscript.setTagValue("overlapsWith", "--".join(overlaps.keys())[:100])\n-\t\treturn queryTranscript\n-\n-\tdef compare(self):\n-\t\tprogress = UnlimitedProgress(10000, "Comparing references", self.verbosity)\n-\t\tfor refTranscript in self.refParser.getIterator():\n-\t\t\tif refTranscript.__class__.__name__ == "Mapping":\n-\t\t\t\trefTranscript = refTranscript.getTranscript()\n-\t\t\trefTranscript = self._alterTranscript(refTranscript, REFERENCE)\n-\t\t\tself._compareTranscript(refTranscript)\n-\t\t\tself.nbRefs += 1\n-\t\t\tprogress.inc()\n-\t\tprogress.done()\n-\n-\tdef printResults(self):\n-\t\tfor transcript in self.overlaps:\n-\t\t\tif not self.invert or not self.overlaps[transcript]:\n-\t\t\t\tif not self.invert:\n-\t\t\t\t\ttranscript = self._updateTranscript(transcript)\n-\t\t\t\tself.writer.addTranscript(transcript)\n-\t\t\t\tself.nbWritten += 1\n-\t\tself.writer.close()\n-\n-\tdef displayResults(self):\n-\t\tprint "# queries: %d" % (self.nbQueries)\n-\t\tprint "# refs: %d" % (self.nbRefs)\n-\t\tprint "# written: %d (%d overlaps)" % (self.nbWritten, self.nbOverlaps)\n-\n-\tdef run(self):\n-\t\tself.loadQuery()\n-\t\tself.compare()\n-\t\tself.printResults()\n-\t\tself.displayResults()\n-\n-if __name__ == "__main__":\n-\t\n-\tdescription = "Compare Overlapping Small Query v1.0.1: Provide the queries that overlap with a reference, when the query is small. [Category: Data Comparison]"\n-\n-\tparser = OptionParser(description = description)\n-\tparser.add_option("-i", "--input1",\t dest="inputFileName1", action="store",\t\t\t type="string", help="query input file [compulsory] [format: file in transcript format given by -f]")\n-\tparser.add_option("-f", "--format1", dest="format1",\t\t action="store",\t\t\t type="string", help="format of previous file [compulsory] [format: transcript file format]")\n-\tparser.add_option("-j", "--input2",\t dest="inputFileName2", action="store",\t\t\t type="string", help="reference input file [compulsory] [format: file in transcript format given by -g]")\n-\tparser.add_option("-g", "--format2", dest="format2",\t\t action="store",\t\t\t type="string", help="format of previous file [compulsory] [format: transcript file format]")\n-\tparser.add_option("-o", "--output",\t dest="outputFileName", action="store",\t\t\t type="string", help="output file [format: output file in GFF3 format]")\n-\tparser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False,\t\t\t\t help="also output not overlapping data [format: bool] [default: false]")\n-\tparser.add_option("-d", "--distance",\t\tdest="distance",\t action="store",\t default=0,\t type="int",\t help="accept some distance between query and reference [format: int]")\n-\tparser.add_option("-c", "--collinear",\t\tdest="collinear",\t action="store_true", default=False,\t\t\t \t help="provide collinear features [format: bool] [default: false]")\n-\tparser.add_option("-a", "--antisense",\t\tdest="antisense",\t action="store_true", default=False,\t\t\t \t help="provide antisense features [format: bool] [default: false]")\n-\tparser.add_option("-x", "--exclude",\t\tdest="exclude",\t\t action="store_true", default=False,\t\t\t \t help="invert the match [format: bool] [default: false]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity",\t action="store", default=1, type="int",\t help="trace level [format: int]")\n-\t(options, args) = parser.parse_args()\n-\n-\tcosq = CompareOverlappingSmallQuery(options.verbosity)\n-\tcosq.setQueryFile(options.inputFileName1, options.format1)\n-\tcosq.setReferenceFile(options.inputFileName2, options.format2)\n-\tcosq.setOutputFile(options.outputFileName)\n-\tcosq.includeNotOverlapping(options.notOverlapping)\n-\tcosq.setDistance(options.distance)\n-\tcosq.setCollinear(options.collinear)\n-\tcosq.setAntisense(options.antisense)\n-\tcosq.setInvert(options.exclude)\n-\tcosq.run()\n-\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CompareOverlappingSmallRef.py --- a/smart_toolShed/SMART/Java/Python/CompareOverlappingSmallRef.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,217 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2011\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.TranscriptWriter import TranscriptWriter\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Mapping import Mapping\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-\n-MINBIN = 3\n-MAXBIN = 7\n-REFERENCE = 0\n-QUERY = 1\n-\n-def getBin(start, end):\n-\tfor i in range(MINBIN, MAXBIN + 1):\n-\t\tbinLevel = 10 ** i\n-\t\tif int(start / binLevel) == int(end / binLevel):\n-\t\t\treturn int(i * 10 ** (MAXBIN + 1) + int(start / binLevel))\n-\treturn int((MAXBIN + 1) * 10 ** (MAXBIN + 1))\n-\n-def getOverlappingBins(start, end):\n-\tarray\t= []\n-\tbigBin = int((MAXBIN + 1) * 10 ** (MAXBIN + 1))\n-\tfor i in range(MINBIN, MAXBIN + 1):\n-\t\tbinLevel = 10 ** i\n-\t\tarray.append((int(i * 10 ** (MAXBIN + 1) + int(start / binLevel)), int(i * 10 ** (MAXBIN + 1) + int(end / binLevel))))\n-\tarray.append((bigBin, bigBin))\n-\treturn array\n-\n-\n-class CompareOverlappingSmallRef(object):\n-\n-\tdef __init__(self, verbosity):\n-\t\tself.verbosity = verbosity\n-\t\tself.tableNames = {}\n-\t\tself.nbQueries = 0\n-\t\tself.nbRefs\t = 0\n-\t\tself.nbWritten = 0\n-\t\tself.nbOverlaps = 0\n-\t\tself.invert = False\n-\t\tself.antisense = False\n-\t\tself.collinear = False\n-\t\tself.distance = None\n-\t\tself.bins\t = {}\n-\t\tself.notOverlapping = False\n-\n-\tdef setReferenceFile(self, fileName, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tself.refParser = chooser.getParser(fileName)\n-\n-\tdef setQueryFile(self, fileName, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tself.queryParser = chooser.getParser(fileName)\n-\n-\tdef setOutputFile(self, fileName):\n-\t\tself.writer = TranscriptWriter(fileName, "gff3", self.verbosity)\n-\n-\tdef setDistance(self, distance):\n-\t\tself.distance = distance\n-\n-\tdef setCollinear(self, boolean):\n-\t\tself.collinear = boolean\n-\n-\tdef setAntisense(self, boolean):\n-\t\tself.antisense = boolean\n-\n-\tdef setInvert(self, boolean):\n-\t\tself.invert = boolean\n-\n-\tdef includeNotOverlapping(self, boolean):\n-\t\tself.notOverlapping = boolean\n-\n-\tdef loadRef(self):\n-\t\tprogress = UnlimitedProgress(10000, "Reading references", self.verbosity)\n-\t\tfor transcript in self.refParser.ge'..b') if "nbElements" in refTranscript.getTagNames() else 1\n-\t\t\t\t\t\tself.nbOverlaps += nbElements\n-\t\treturn overlaps\n-\n-\tdef _updateTranscript(self, queryTranscript, overlaps):\n-\t\tqueryTranscript.setTagValue("nbOverlaps", sum(overlaps.values()))\n-\t\tif overlaps:\n-\t\t\tqueryTranscript.setTagValue("overlapsWith", "--".join(overlaps.keys())[:100])\n-\t\treturn queryTranscript\n-\n-\tdef compare(self):\n-\t\tprogress = UnlimitedProgress(10000, "Comparing queries", self.verbosity)\n-\t\tfor queryTranscript in self.queryParser.getIterator():\n-\t\t\tif queryTranscript.__class__.__name__ == "Mapping":\n-\t\t\t\tqueryTranscript = queryTranscript.getTranscript()\n-\t\t\tprogress.inc()\n-\t\t\tself.nbQueries += 1\n-\t\t\toverlaps = self._compareTranscript(queryTranscript)\n-\t\t\tif self.notOverlapping or (overlaps and not self.invert) or (not overlaps and self.invert):\n-\t\t\t\tif not self.invert:\n-\t\t\t\t\tqueryTranscript = self._updateTranscript(queryTranscript, overlaps)\n-\t\t\t\tself.writer.addTranscript(queryTranscript)\n-\t\t\t\tself.nbWritten += 1\n-\t\tprogress.done()\n-\t\tself.writer.close()\n-\n-\tdef displayResults(self):\n-\t\tprint "# queries: %d" % (self.nbQueries)\n-\t\tprint "# refs: %d" % (self.nbRefs)\n-\t\tprint "# written: %d (%d overlaps)" % (self.nbWritten, self.nbOverlaps)\n-\n-\tdef run(self):\n-\t\tself.loadRef()\n-\t\tself.compare()\n-\t\tself.displayResults()\n-\n-if __name__ == "__main__":\n-\t\n-\tdescription = "Compare Overlapping Small Reference v1.0.1: Provide the queries that overlap with a reference, when the reference is small. [Category: Data Comparison]"\n-\n-\tparser = OptionParser(description = description)\n-\tparser.add_option("-i", "--input1",\t dest="inputFileName1", action="store",\t\t\t type="string", help="query input file [compulsory] [format: file in transcript format given by -f]")\n-\tparser.add_option("-f", "--format1", dest="format1",\t\t action="store",\t\t\t type="string", help="format of previous file [compulsory] [format: transcript file format]")\n-\tparser.add_option("-j", "--input2",\t dest="inputFileName2", action="store",\t\t\t type="string", help="reference input file [compulsory] [format: file in transcript format given by -g]")\n-\tparser.add_option("-g", "--format2", dest="format2",\t\t action="store",\t\t\t type="string", help="format of previous file [compulsory] [format: transcript file format]")\n-\tparser.add_option("-o", "--output",\t dest="outputFileName", action="store",\t\t\t type="string", help="output file [format: output file in GFF3 format]")\n-\tparser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False,\t\t\t\thelp="also output not overlapping data [format: bool] [default: false]")\n-\tparser.add_option("-d", "--distance",\t\tdest="distance",\t action="store",\t default=0,\t type="int",\t help="accept some distance between query and reference [format: int]")\n-\tparser.add_option("-c", "--collinear",\t\tdest="collinear",\t action="store_true", default=False,\t\t\t \t help="provide collinear features [format: bool] [default: false]")\n-\tparser.add_option("-a", "--antisense",\t\tdest="antisense",\t action="store_true", default=False,\t\t\t \t help="provide antisense features [format: bool] [default: false]")\n-\tparser.add_option("-x", "--exclude",\t\tdest="exclude",\t\t action="store_true", default=False,\t\t\t \t help="invert the match [format: bool] [default: false]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity",\t action="store", default=1, type="int",\thelp="trace level [format: int]")\n-\t(options, args) = parser.parse_args()\n-\n-\tcosr = CompareOverlappingSmallRef(options.verbosity)\n-\tcosr.setQueryFile(options.inputFileName1, options.format1)\n-\tcosr.setReferenceFile(options.inputFileName2, options.format2)\n-\tcosr.setOutputFile(options.outputFileName)\n-\tcosr.includeNotOverlapping(options.notOverlapping)\n-\tcosr.setDistance(options.distance)\n-\tcosr.setAntisense(options.antisense)\n-\tcosr.setInvert(options.exclude)\n-\tcosr.setInvert(options.exclude)\n-\tcosr.run()\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/ComputeCoverage.py --- a/smart_toolShed/SMART/Java/Python/ComputeCoverage.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,142 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2011 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import os, random -from optparse import OptionParser, OptionGroup -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.Progress import Progress -from commons.core.writer.Gff3Writer import Gff3Writer - - -class CoverageComputer(object): - - def __init__(self, verbosity = 0): - self.verbosity = verbosity - self.queryReader = None - self.referenceReader = None - self.outputWriter = None - self.introns = False - self.nbNucleotides = 0 - self.nbCovered = 0 - - def setInputQueryFile(self, fileName, format): - self.queryReader = TranscriptContainer(fileName, format, self.verbosity-1) - - def setInputReferenceFile(self, fileName, format): - self.referenceReader = TranscriptContainer(fileName, format, self.verbosity-1) - - def includeIntrons(self, boolean): - self.introns = boolean - - def setOutputFileName(self, fileName, title="S-MART", feature="transcript", featurePart="exon"): - self.outputWriter = Gff3Writer(fileName, self.verbosity-1) - self.outputWriter.setTitle(title) - self.outputWriter.setFeature(feature) - self.outputWriter.setFeaturePart(featurePart) - - def readReference(self): - self.coveredRegions = {} - progress = Progress(self.referenceReader.getNbTranscripts(), "Reading reference file", self.verbosity-1) - for transcript in self.referenceReader.getIterator(): - chromosome = transcript.getChromosome() - if chromosome not in self.coveredRegions: - self.coveredRegions[chromosome] = {} - if self.introns: - transcript.removeExons() - for exon in transcript.getExons(): - for position in range(exon.getStart(), exon.getEnd()+1): - self.coveredRegions[chromosome][position] = 1 - progress.inc() - progress.done() - - def readQuery(self): - progress = Progress(self.queryReader.getNbTranscripts(), "Reading query file", self.verbosity-1) - for transcript in self.queryReader.getIterator(): - progress.inc() - chromosome = transcript.getChromosome() - if chromosome not in self.coveredRegions: - continue - if self.introns: - transcript.removeExons() - for exon in transcript.getExons(): - for position in range(exon.getStart(), exon.getEnd()+1): - self.nbNucleotides += 1 - self.nbCovered += self.coveredRegions[chromosome].get(position, 0) - progress.done() - - def write(self): - progress = Progress(self.queryReader.getNbTranscripts(), "Writing output file", self.verbosity-1) - for transcript in self.queryReader.getIterator(): - chromosome = transcript.getChromosome() - if self.introns: - transcript.removeExons() - size = transcript.getSize() - coverage = 0 - for exon in transcript.getExons(): - for position in range(exon.getStart(), exon.getEnd()+1): - coverage += self.coveredRegions[chromosome].get(position, 0) - transcript.setTagValue("coverage", 0 if size == 0 else float(coverage) / size * 100) - self.outputWriter.addTranscript(transcript) - progress.inc() - progress.done() - - def sumUp(self): - print "%d nucleotides in query, %d (%.f%%) covered" % (self.nbNucleotides, self.nbCovered, 0 if self.nbNucleotides == 0 else float(self.nbCovered) / self.nbNucleotides * 100) - - def run(self): - self.readReference() - self.readQuery() - if self.outputWriter != None: - self.write() - self.sumUp() - - -if __name__ == "__main__": - - # parse command line - description = "Compute Coverage v1.0.1: Compute the coverage of a set with respect to another set. [Category: Personal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input query file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of the first file [compulsory] [format: transcript file format]") - parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input reference file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of the second file [compulsory] [format: transcript file format]") - parser.add_option("-t", "--introns", dest="introns", action="store_true", default=False, help="also include introns [format: boolean] [default: false]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", type="int", help="trace level [default: 1] [format: int]") - (options, args) = parser.parse_args() - - computer = CoverageComputer(options.verbosity) - computer.setInputQueryFile(options.inputFileName1, options.format1) - computer.setInputReferenceFile(options.inputFileName2, options.format2) - computer.includeIntrons(options.introns) - computer.setOutputFileName(options.outputFileName) - computer.run() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/CountReadGCPercent.py --- a/smart_toolShed/SMART/Java/Python/CountReadGCPercent.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,88 +0,0 @@ -#!/usr/bin/env python - -from optparse import OptionParser -from commons.core.parsing.FastaParser import FastaParser -from commons.core.writer.Gff3Writer import Gff3Writer -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.Progress import Progress -from commons.core.utils.RepetOptionParser import RepetOptionParser -from Gnome_tools.CountGCPercentBySlidingWindow import CountGCPercentBySlidingWindow - - -class CountReadGCPercent(object): - - def __init__(self): - self.referenceReader = None - self.gffReader = None - self.outputWriter = None - self.verbose = 0 - - def setInputReferenceFile(self, fileName): - self.referenceReader = fileName - - def setInputGffFile(self, fileName): - self.gffReader = TranscriptContainer(fileName, 'gff3', self.verbose) - - def setOutputFileName(self, fileName): - self.outputWriter = Gff3Writer(fileName, self.verbose) - - def readGffAnnotation(self): - self.coveredRegions = {} - progress = Progress(self.gffReader.getNbTranscripts(), "Reading gff3 annotation file", self.verbose) - for transcript in self.gffReader.getIterator(): - chromosome = transcript.getChromosome() - if chromosome not in self.coveredRegions: - self.coveredRegions[chromosome] = {} - for exon in transcript.getExons(): - for position in range(exon.getStart(), exon.getEnd()+1): - self.coveredRegions[chromosome][position] = 1 - progress.inc() - progress.done() - - def write(self): - iParser = FastaParser(self.referenceReader) - iParser.setTags() - iGetGCPercentBySW = CountGCPercentBySlidingWindow() - progress = Progress(self.gffReader.getNbTranscripts(), "Writing output file", self.verbose) - for transcript in self.gffReader.getIterator(): - chromosome = transcript.getChromosome() - GCpercent = 0 - nPercent = 0 - for exon in transcript.getExons(): - for sequenceName in iParser.getTags().keys(): - if sequenceName != chromosome: - continue - else: - subSequence = iParser.getSubSequence(sequenceName, exon.getStart() , exon.getEnd(), 1) - GCpercent, nPercent = iGetGCPercentBySW.getGCPercentAccordingToNAndNPercent(subSequence) - print "GCpercent = %f, nPercent = %f" % (GCpercent, nPercent) - transcript.setTagValue("GCpercent", GCpercent) - transcript.setTagValue("NPercent", nPercent) - self.outputWriter.addTranscript(transcript) - progress.inc() - progress.done() - - def run(self): - self.readGffAnnotation() - if self.outputWriter != None: - self.write() - -if __name__ == "__main__": - description = "Count GC percent for each read against a genome." - usage = "CountReadGCPercent.py -i <fasta file> -j <gff3 file> -o <output gff3 file> -v <verbose> -h]" - examples = "\nExample: \n" - examples += "\t$ python CountReadGCPercent.py -i file.fasta -j annotation.gff -o output.gff3" - examples += "\n\n" - parser = RepetOptionParser(description = description, usage = usage, version = "v1.0", epilog = examples) - parser.add_option( '-i', '--inputGenome', dest='fastaFile', help='fasta file [compulsory]', default= None ) - parser.add_option( '-j', '--inputAnnotation', dest='gffFile', help='gff3 file [compulsory]', default= None) - parser.add_option( '-o', '--output', dest='outputFile', help='output gff3 file [compulsory]', default= None ) - parser.add_option( '-v', '--verbose', dest='verbose', help='verbosity level (default=0/1)',type="int", default= 0 ) - (options, args) = parser.parse_args() - - readGCPercent = CountReadGCPercent() - readGCPercent.setInputReferenceFile(options.fastaFile) - readGCPercent.setInputGffFile(options.gffFile) - readGCPercent.setOutputFileName(options.outputFile) - readGCPercent.run() - \ No newline at end of file |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/FindOverlapsOptim.py --- a/smart_toolShed/SMART/Java/Python/FindOverlapsOptim.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,343 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2012\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-\n-import os, struct, time, shutil\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.ncList.NCList import NCList\n-from SMART.Java.Python.ncList.ConvertToNCList import ConvertToNCList\n-from SMART.Java.Python.ncList.NCListParser import NCListParser\n-from SMART.Java.Python.ncList.NCListCursor import NCListCursor\n-from SMART.Java.Python.ncList.NCListFilePickle import NCListFilePickle, NCListFileUnpickle\n-from SMART.Java.Python.ncList.NCListHandler import NCListHandler\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-try:\n- import cPickle as pickle\n-except:\n- import pickle\n-\n-REFERENCE = 0\n-QUERY = 1\n-TYPES = (REFERENCE, QUERY)\n-TYPETOSTRING = {0: "reference", 1: "query"}\n-\n-class FindOverlapsOptim(object):\n-\t\n-\tdef __init__(self, verbosity = 1):\n-\t\tself._parsers\t\t\t\t = {}\n-\t\tself._sortedFileNames\t\t = {}\n-\t\tself._outputFileName\t\t = "outputOverlaps.gff3"\n-\t\tself._iWriter\t\t\t\t = None\n-\t\tself._inputFileNames\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._convertedFileNames = {REFERENCE: False, QUERY: False}\n-\t\tself._inputFileFormats\t\t = {REFERENCE: None, QUERY: None}\n-\t\tself._converted\t\t\t = {REFERENCE: False, QUERY: False}\n-\t\tself._ncListHandlers = {REFERENCE: None, QUERY: None}\n-\t\tself._splittedFileNames\t = {REFERENCE: {},\tQUERY: {}}\n-\t\tself._nbOverlappingQueries\t = 0\n-\t\tself._nbOverlaps\t\t\t = 0\n-\t\tself._nbLines\t\t\t\t = {REFERENCE: 0, QUERY: 0}\n-\t\tself._sorted = False\n-\t\tself._index = False\n-\t\tself._verbosity\t\t\t = verbosity\n-\t\tself._ncLists\t\t\t\t = {}\n-\t\tself._cursors\t\t\t\t = {}\n-\t\tself._nbElementsPerChromosome = {}\n-\t\tself._tmpDirectories\t\t = {REFERENCE: False, QUERY: False}\n-\t\t\n-\tdef close(self):\n-\t\tself._iWriter.close()\n-\t\tfor fileName in (self._sortedFileNames.values()):\n-\t\t\tif os.path.exists(fileName):\n-\t\t\t\tos.remove(fileName)\n-\t\tfor fileName in self._convertedFileNames.values():\n-\t\t\tif fileName:\n-\t\t\t\tos.remove(fileName)\n-\t\t\n-\tdef setRefFileName(self, fileName, format):\n-\t\tself.setFileName(fileName, format, REFERENCE)\n-\t\t\n-\tdef setQueryFileName(self, fileName, format):\n-\t\tself.setFileName(fileName, format, QUERY)\n-\n-\tdef se'..b'def isOverlapping(self, queryTranscript, refTranscript):\n-\t\tif (queryTranscript.getStart() <= refTranscript.getEnd() and queryTranscript.getEnd() >= refTranscript.getStart()):\n-\t\t\treturn 0 \n-\t\tif queryTranscript.getEnd() < refTranscript.getStart():\n-\t\t\treturn 1\n-\t\treturn -1\n-\n-\tdef checkIndex(self, transcript, cursor):\n-\t\tif not self._index:\n-\t\t\treturn None\n-\t\tchromosome = transcript.getChromosome()\n-\t\tnextLIndex = self._indices[REFERENCE][chromosome].getIndex(transcript)\n-\t\tif nextLIndex == None:\n-\t\t\treturn None\n-\t\tncList\t\t = self._ncLists[REFERENCE][chromosome]\n-\t\tnextGffAddress = ncList.getRefGffAddr(nextLIndex)\n-\t\tthisGffAddress = cursor.getGffAddress()\n-\t\tif nextGffAddress > thisGffAddress:\n-\t\t\treturn nextLIndex\n-\t\treturn None\n-\t\t\n-\tdef _writeIntervalInNewGFF3(self, transcript, names):\n-\t\tnbOverlaps = 0\n-\t\tfor cpt in names.values():\n-\t\t\tnbOverlaps += cpt\n-\t\tif not names:\n-\t\t\treturn\n-\t\ttranscript.setTagValue("overlapsWith", "--".join(sorted(names.keys())))\n-\t\ttranscript.setTagValue("nbOverlaps", nbOverlaps)\n-\t\tself._iWriter.addTranscript(transcript)\n-\t\tself._iWriter.write()\n-\t\tself._nbOverlappingQueries += 1\n-\t\tself._nbOverlaps\t\t += nbOverlaps\n-\t\t\n-\tdef _extractID(self, transcript):\n-\t\tnbElements = float(transcript.getTagValue("nbElements")) if "nbElements" in transcript.getTagNames() else 1\n-\t\tid\t\t = transcript.getTagValue("ID")\t\t\t\t if "ID"\t\t in transcript.getTagNames() else transcript.getUniqueName()\n-\t\treturn {id: nbElements}\n-\t\t\n-\tdef run(self):\n-\t\tself.createNCLists()\n-\t\tself.compare()\n-\t\tself.close()\n-\t\tif self._verbosity > 0:\n-\t\t\tprint "# queries: %d" % (self._nbLines[QUERY])\n-\t\t\tprint "# refs: %d" % (self._nbLines[REFERENCE])\n-\t\t\tprint "# written: %d (%d overlaps)" % (self._nbOverlappingQueries, self._nbOverlaps)\n-\t\t\tprint "time: %.2gs" % (self._timeSpent)\n-\n-\n-if __name__ == "__main__":\n-\tdescription = "Find Overlaps Optim v1.0.0: Finds overlaps with several query intervals. [Category: Data Comparison]"\n-\n-\tparser = OptionParser(description = description)\n-\tparser.add_option("-i", "--query",\t dest="inputQueryFileName", action="store",\t\t\t type="string", help="query input file [compulsory] [format: file in transcript or other format given by -f]")\n-\tparser.add_option("-f", "--queryFormat", dest="queryFormat",\t\taction="store",\t\t\t type="string", help="format of previous file (possibly in NCL format) [compulsory] [format: transcript or other file format]")\n-\tparser.add_option("-j", "--ref",\t\t dest="inputRefFileName", action="store",\t\t\t type="string", help="reference input file [compulsory] [format: file in transcript or other format given by -g]")\n-\tparser.add_option("-g", "--refFormat", dest="refFormat",\t\t action="store",\t\t\t type="string", help="format of previous file (possibly in NCL format) [compulsory] [format: transcript or other file format]")\n-\tparser.add_option("-o", "--output",\t dest="outputFileName",\t action="store",\t\t\t type="string", help="output file [compulsory] [format: output file in GFF3 format]")\n-\tparser.add_option("-d", "--index",\t dest="index",\t action="store_true", default=False,\t help="add an index to the reference file (faster but more memory) [format: boolean] [default: False]")\n-\tparser.add_option("-s", "--sorted",\t dest="sorted",\t action="store_true", default=False,\t help="input files are already sorted [format: boolean] [default: False]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity",\t\t action="store", default=1, type="int",\t help="Trace level [format: int] [default: 1]")\n-\t(options, args) = parser.parse_args()\n-\t\n-\tiFOO = FindOverlapsOptim(options.verbosity)\n-\tiFOO.setRefFileName(options.inputRefFileName, options.refFormat)\n-\tiFOO.setQueryFileName(options.inputQueryFileName, options.queryFormat)\n-\tiFOO.setOutputFileName(options.outputFileName)\n-\tiFOO.setIndex(options.index)\n-\tiFOO.setSorted(options.sorted)\n-\tiFOO.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetDifferentialExpression.py --- a/smart_toolShed/SMART/Java/Python/GetDifferentialExpression.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,441 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Get the differential expression between 2 conditions (2 files), on regions defined by a third file"""\n-\n-import os, re\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc import Utils\n-from SMART.Java.Python.mySql.MySqlConnection import MySqlConnection\n-from SMART.Java.Python.structure.Transcript import Transcript\n-\n-class GetDifferentialExpression(object):\n- \n- def __init__(self, verbosity = 1):\n- self.verbosity = verbosity\n- self.mySqlConnection = MySqlConnection(verbosity)\n- self.inputs = (0, 1)\n- self.transcriptContainers = [None, None]\n- self.transcriptContainerRef = None\n- self.outputFileName = None\n- self.writer = None\n- self.tables = [None, None]\n- self.nbElements = [0, 0]\n-\n- self.regionsToValues = {}\n- self.regionsToNames = {}\n- self.valuesToPvalues = {}\n-\n- self.oriented = True\n- self.simpleNormalization = False\n- self.simpleNormalizationParameters = None\n- self.adjustedNormalization = False\n- self.fixedSizeFactor = None\n- self.normalizationSize = None\n- self.normalizationFactors = [1, 1]\n- self.fdr = None \n- self.fdrPvalue = None \n-\n- self.plot = False\n- self.plotter = None\n- self.plotterName = None\n- self.points = {}\n-\n-\n- def setInputFile(self, i, fileName, fileFormat):\n- self.transcriptContainers[i] = TranscriptContainer(fileName, fileFormat, self.verbosity)\n- self.transcriptContainers[i].mySqlConnection = self.mySqlConnection\n-\n-\n- def setReferenceFile(self, fileName, fileFormat):\n- self.transcriptContainerRef = TranscriptContainer(fileName, fileFormat, self.verbosity)\n- self.transcriptContainerRef.mySqlConnection = self.mySqlConnection\n-\n-\n- def setOutputFile(self, fileName):\n- self.outputFileName = fileName\n- self.writer = Gff3Writer(fileName, self.verbosity)\n-\n- \n- def setOriented(self'..b' file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of file 1 [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of file 2 [compulsory] [format: transcript file format]")\n- parser.add_option("-k", "--reference", dest="referenceFileName", action="store", type="string", help="reference file [compulsory] [format: file in transcript format given by -l]")\n- parser.add_option("-l", "--referenceFormat", dest="referenceFormat", action="store", type="string", help="format of reference file [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in gff3 format]")\n- parser.add_option("-n", "--notOriented", dest="notOriented", action="store_true", default=False, help="if the reads are not oriented [default: False] [format: bool]")\n- parser.add_option("-s", "--simple", dest="simple", action="store_true", default=False, help="normalize using the number of reads in each condition [format: bool]")\n- parser.add_option("-S", "--simpleParameters", dest="simpleParameters", action="store", default=None, type="string", help="provide the number of reads [format: bool]")\n- parser.add_option("-a", "--adjusted", dest="adjusted", action="store_true", default=False, help="normalize using the number of reads of \'mean\' regions [format: bool]")\n- parser.add_option("-x", "--fixedSizeFactor", dest="fixedSizeFactor", action="store", default=None, type="int", help="give the magnification factor for the normalization using fixed size sliding windows in reference regions (leave empty for no such normalization) [format: int]")\n- parser.add_option("-d", "--fdr", dest="fdr", action="store", default=None, type="float", help="use FDR [format: float]")\n- parser.add_option("-p", "--plot", dest="plotName", action="store", default=None, type="string", help="plot cloud plot [format: output file in PNG format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n-\n- \n- differentialExpression = GetDifferentialExpression(options.verbosity)\n- differentialExpression.setInputFile(0, options.inputFileName1, options.format1)\n- differentialExpression.setInputFile(1, options.inputFileName2, options.format2)\n- differentialExpression.setReferenceFile(options.referenceFileName, options.referenceFormat)\n- differentialExpression.setOutputFile(options.outputFileName)\n- if options.plotName != None :\n- differentialExpression.setPlotterName(options.plotName)\n- differentialExpression.setPlotter()\n- differentialExpression.setOriented(not options.notOriented)\n- differentialExpression.setSimpleNormalization(options.simple)\n- differentialExpression.setSimpleNormalizationParameters(options.simpleParameters)\n- differentialExpression.setAdjustedNormalization(options.adjusted)\n- differentialExpression.setFixedSizeNormalization(options.fixedSizeFactor)\n- differentialExpression.setFdr(options.fdr)\n- differentialExpression.getDifferentialExpression()\n- differentialExpression.mySqlConnection.deleteDatabase()\n- \n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetDistribution.py --- a/smart_toolShed/SMART/Java/Python/GetDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,362 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2012\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.parsing.FastaParser import FastaParser\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc.MultipleRPlotter import MultipleRPlotter\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-from SMART.Java.Python.misc.Progress import Progress\n-\n-TWOSTRANDS = {True: [1, -1], False: [0]}\n-STRANDTOSTR = {1: "(+)", -1: "(-)", 0: ""}\n-\n-class GetDistribution(object):\n-\n-\tdef __init__(self, verbosity):\n-\t\tself.verbosity = verbosity\n-\t\tself.sizes = None\n-\t\tself.twoStrands = False\n-\t\tself.start = 1\n-\t\tself.names = ["nbElements"]\n-\t\tself.average = False\n-\t\tself.nbValues = {}\n-\t\tself.height = 300\n-\t\tself.width = 600\n-\t\tself.colors = None\n-\t\tself.gffFileName = None\n-\t\tself.csvFileName = None\n-\t\tself.yMin = None\n-\t\tself.yMax = None\n-\t\tself.chromosome = None\n-\t\tself.merge = False\n-\t\tself.nbTranscripts = None\n-\n-\tdef setInputFile(self, fileName, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tself.parser = chooser.getParser(fileName)\n-\n-\tdef setReferenceFile(self, fileName):\n-\t\tif fileName == None:\n-\t\t\treturn\n-\t\tfastaParser = FastaParser(fileName, self.verbosity)\n-\t\tself.chromosomes = fastaParser.getRegions()\n-\t\tself.sizes = dict([region, fastaParser.getSizeOfRegion(region)] for region in self.chromosomes)\n-\t\tself.maxSize = max(self.sizes.values())\n-\n-\tdef setRegion(self, chromosome, start, end):\n-\t\tif chromosome == None:\n-\t\t\treturn\n-\t\tself.maxSize = options.end\n-\t\tself.sizes = {chromosome: end}\n-\t\tself.chromosomes = [chromosome]\n-\t\tself.chromosome = chromosome\n-\t\tself.start = start\n-\t\tself.end = end\n-\n-\tdef setOutputFile(self, fileName):\n-\t\tself.outputFileName = fileName\n-\n-\tdef setNbBins(self, nbBins):\n-\t\tself.nbBins = nbBins\n-\n-\tdef set2Strands(self, twoStrands):\n-\t\tself.twoStrands = twoStrands\n-\n-\tdef setNames(self, names):\n-\t\tself.names = names\n-\n-\tdef setAverage(self, average):\n-\t\tself.average = average\n-\n-\tdef setNormalization(self, normalization):\n-\t\tself.normalization = normalization\n-\t\n-\tdef setImageSize(self, height, width):\n-\t\tself.height = height\n-\t\tself.width '..b' action="store", default=1000, type="int", help="number of bins [default: 1000] [format: int]")\n-\tparser.add_option("-2", "--bothStrands", dest="bothStrands", action="store_true", default=False, help="plot one curve per strand [format: bool] [default: false]")\n-\tparser.add_option("-c", "--chromosome", dest="chromosome", action="store", default=None, type="string", help="plot only a chromosome [format: string]")\n-\tparser.add_option("-s", "--start", dest="start", action="store", default=None, type="int", help="start from a given region [format: int]")\n-\tparser.add_option("-e", "--end", dest="end", action="store", default=None, type="int", help="end from a given region [format: int]")\n-\tparser.add_option("-y", "--yMin", dest="yMin", action="store", default=None, type="int", help="minimum value on the y-axis to plot [format: int]")\n-\tparser.add_option("-Y", "--yMax", dest="yMax", action="store", default=None, type="int", help="maximum value on the y-axis to plot [format: int]")\n-\tparser.add_option("-x", "--csv", dest="csv", action="store", default=None, help="write a .csv file [format: output file in CSV format] [default: None]")\n-\tparser.add_option("-g", "--gff", dest="gff", action="store", default=None, help="also write GFF3 file [format: output file in GFF format] [default: None]")\n-\tparser.add_option("-H", "--height", dest="height", action="store", default=300, type="int", help="height of the graphics [format: int] [default: 300]")\n-\tparser.add_option("-W", "--width", dest="width", action="store", default=600, type="int", help="width of the graphics [format: int] [default: 1000]")\n-\tparser.add_option("-a", "--average", dest="average", action="store_true", default=False, help="plot average (instead of sum) [default: false] [format: boolean]")\n-\tparser.add_option("-n", "--names", dest="names", action="store", default="nbElements", type="string", help="name for the tags (separated by commas and no space) [default: None] [format: string]")\n-\tparser.add_option("-l", "--color", dest="colors", action="store", default=None, type="string", help="color of the lines (separated by commas and no space) [format: string]")\n-\tparser.add_option("-z", "--normalize", dest="normalize", action="store_true", default=False, help="normalize data (when panels are different) [format: bool] [default: false]")\n-\tparser.add_option("-m", "--merge", dest="mergePlots", action="store_true", default=False, help="merge all plots in one figure [format: bool] [default: false]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]")\n-\t(options, args) = parser.parse_args()\n-\n-\tgt = GetDistribution(options.verbosity)\n-\tgt.setInputFile(options.inputFileName, options.format)\n-\tgt.setOutputFile(options.outputFileName)\n-\tgt.setReferenceFile(options.referenceFileName)\n-\tgt.setNbBins(int(options.nbBins))\n-\tgt.set2Strands(options.bothStrands)\n-\tgt.setRegion(options.chromosome, options.start, options.end)\n-\tgt.setNormalization(options.normalize)\n-\tgt.setAverage(options.average)\n-\tgt.setYLimits(options.yMin, options.yMax)\n-\tgt.writeCsv(options.csv)\n-\tgt.writeGff(options.gff)\n-\tgt.setImageSize(options.height, options.width)\n-\tgt.setNames(options.names.split(","))\n-\tgt.setColors(None if options.colors == None else options.colors.split(","))\n-\tgt.setNormalization(options.normalize)\n-\tgt.mergePlots(options.mergePlots)\n-\tgt.run()\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetFlanking.py --- a/smart_toolShed/SMART/Java/Python/GetFlanking.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,231 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2011\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.TranscriptWriter import TranscriptWriter\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.misc.Progress import Progress\n-\n-QUERY = 0\n-REFERENCE = 1\n-INPUTS = (QUERY, REFERENCE)\n-STRANDS = (-1, 1)\n-TAG_DISTANCE = "distance_"\n-TAG_SENSE = "_sense"\n-TAG_REGION = "_region"\n-TAGS_REGION = {-1: "_upstream", 0: "", 1: "_downstream"}\n-TAGS_RREGION = {-1: "upstream", 0: "overlapping", 1: "downstream"}\n-TAGS_SENSE = {-1: "antisense", 0: "", 1: "colinear"}\n-STRANDSTOSTR = {-1: "(-)", 0: "", 1: "(+)"}\n-\n-\n-def getOrderKey(transcript, direction):\n- if direction == 1:\n- return transcript.getEnd()\n- return - transcript.getStart()\n-\n-def isInGoodRegion(transcriptRef, transcriptQuery, direction):\n- if direction == 1:\n- return transcriptQuery.getEnd() > transcriptRef.getEnd()\n- return transcriptQuery.getStart() < transcriptRef.getStart()\n-\n-\n-class GetFlanking(object):\n-\n- def __init__(self, verbosity):\n- self.verbosity = verbosity\n- self.transcripts = dict([id, {}] for id in INPUTS)\n- self.directions = []\n- self.noOverlap = False\n- self.colinear = False\n- self.antisense = False\n- self.distance = None\n- self.minDistance = None\n- self.maxDistance = None\n- self.tagName = "flanking"\n-\n- def setInputFile(self, fileName, format, id):\n- chooser = ParserChooser(self.verbosity)\n- chooser.findFormat(format)\n- parser = chooser.getParser(fileName)\n- for transcript in parser.getIterator():\n- chromosome = transcript.getChromosome()\n- if chromosome not in self.transcripts[id]:\n- self.transcripts[id][chromosome] = []\n- self.transcripts[id][chromosome].append(transcript)\n-\n- def setOutputFile(self, fileName):\n- self.writer = TranscriptWriter(fileName, "gff3", self.verbosity)\n-\n- def addUpstreamDirection(self, upstream):\n- if upstream:\n- self.directions.append(-1)\n-\n- def addDownstreamDirection(self, downstream):\n- if downstream:\n- self.directions.append(1)\n-\n- def setColinear(self, colinear):\n- self.colinear = colinear\n-\n- def setAntisense(self,'..b' progress.inc()\n- for transcript in sorted(list(outputs), key = lambda flanking: (flanking.getChromosome(), flanking.getStart(), flanking.getEnd())):\n- self.writer.addTranscript(transcript)\n- self.writer.close()\n- progress.done()\n-\n- def run(self):\n- self.flankings = {}\n- for direction in STRANDS:\n- self.getFlanking(direction)\n- self.write()\n-\n-if __name__ == "__main__":\n- \n- description = "Get Flanking v1.0.1: Get the flanking regions of a set of reference. [Category: Data Selection]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="query input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of previous file [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="reference input file [compulsory] [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of previous file [compulsory] [format: transcript file format]")\n- parser.add_option("-5", "--upstream", dest="upstream", action="store_true", default=False, help="output upstream elements [format: boolean] [default: False]")\n- parser.add_option("-3", "--downstream", dest="downstream", action="store_true", default=False, help="output downstream elements [format: boolean] [default: False]")\n- parser.add_option("-c", "--colinear", dest="colinear", action="store_true", default=False, help="find first colinear element [format: boolean] [default: False]")\n- parser.add_option("-a", "--antisense", dest="antisense", action="store_true", default=False, help="find first anti-sense element [format: boolean] [default: False]")\n- parser.add_option("-e", "--noOverlap", dest="noOverlap", action="store_true", default=False, help="do not consider elements which are overlapping reference elements [format: boolean] [default: False]")\n- parser.add_option("-d", "--minDistance", dest="minDistance", action="store", default=None, type="int", help="minimum distance between 2 elements [format: int]")\n- parser.add_option("-D", "--maxDistance", dest="maxDistance", action="store", default=None, type="int", help="maximum distance between 2 elements [format: int]")\n- parser.add_option("-t", "--tag", dest="tagName", action="store", default="flanking", type="string", help="name of the new tag [format: string] [default: flanking]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n- gf = GetFlanking(options.verbosity)\n- gf.setInputFile(options.inputFileName1, options.format1, QUERY)\n- gf.setInputFile(options.inputFileName2, options.format2, REFERENCE)\n- gf.setOutputFile(options.outputFileName)\n- gf.addUpstreamDirection(options.upstream)\n- gf.addDownstreamDirection(options.downstream)\n- gf.setColinear(options.colinear)\n- gf.setAntisense(options.antisense)\n- gf.setNoOverlap(options.noOverlap)\n- gf.setMinDistance(options.minDistance)\n- gf.setMaxDistance(options.maxDistance)\n- gf.setNewTagName(options.tagName)\n- gf.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetRandomSubset.py --- a/smart_toolShed/SMART/Java/Python/GetRandomSubset.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,96 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2011 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import random -from optparse import OptionParser -from commons.core.parsing.ParserChooser import ParserChooser -from commons.core.writer.TranscriptWriter import TranscriptWriter -from SMART.Java.Python.structure.Transcript import Transcript -from SMART.Java.Python.misc.Progress import Progress - -class GetRandomSubset(object): - - def __init__(self, verbosity): - self.verbosity = verbosity - - def setInputFile(self, fileName, format): - chooser = ParserChooser(self.verbosity) - chooser.findFormat(format) - self.parser = chooser.getParser(fileName) - - def setNumber(self, number, percent): - if number != None: - self.number = number - elif percent != None: - self.number = int(float(percent) / 100 * self.parser.getNbTranscripts()) - else: - raise Exception("Error! Number of elements to output is not given!") - - def setOutputFile(self, fileName): - self.writer = TranscriptWriter(fileName, "gff3", self.verbosity) - - def chooseElements(self): - self.randomIndices = random.sample(range(self.parser.getNbTranscripts()), self.number) - - def run(self): - self.chooseElements() - progress = Progress(self.parser.getNbTranscripts(), "Reading input file", self.verbosity) - nbWritten = 0 - for cpt1, transcript in enumerate(self.parser.getIterator()): - if cpt1 in self.randomIndices: - self.writer.addTranscript(transcript) - nbWritten += 1 - progress.inc() - self.writer.write() - self.writer.close() - progress.done() - if self.verbosity > 1: - print "%d transcripts read" % (self.parser.getNbTranscripts()) - print "%d transcripts written" % (nbWritten) - - -if __name__ == "__main__": - - description = "Get Random Subset v1.0.1: Get a random sub-set of a list of genomic coordinates. [Category: Personal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-n", "--number", dest="number", action="store", default=None, type="string", help="number of elements to output [format: int]") - parser.add_option("-p", "--percent", dest="percent", action="store", default=None, type="string", help="percentage of elements to output (between 0 and 100) [format: int]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - grs = GetRandomSubset(options.verbosity) - grs.setInputFile(options.inputFileName, options.format) - grs.setNumber(options.number, options.percent) - grs.setOutputFile(options.outputFileName) - grs.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetReadDistribution.py --- a/smart_toolShed/SMART/Java/Python/GetReadDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,283 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import random, os, glob, subprocess\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.parsing.GffParser import GffParser\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc import Utils\n-from commons.core.LoggerFactory import LoggerFactory\n-from commons.core.utils.RepetOptionParser import RepetOptionParser\n-\n-LOG_DEPTH = "smart"\n-DEFAULT_REGION = "_all_"\n-MULTIPLE_STR = {1: "", 1000: " (in kpb)", 1000000: " (in Gbp)"}\n-\n-class GetReadDistribution(object):\n-\n-\tdef __init__(self, verbosity = 0):\n-\t\tself.xLab = ""\n-\t\tself.yLab = "# reads"\n-\t\tself.verbosity = verbosity\n-\t\tself.number = random.randint(0, 100000)\n-\t\tself.log = LoggerFactory.createLogger("%s.%s" % (LOG_DEPTH, self.__class__.__name__), self.verbosity)\n-\t\tself.parsers = {}\n-\t\tself.distribution = {}\n-\t\tself.factors = {}\n-\t\tself.regions = None\n-\t\tself.tmpDatName = None\n-\t\tself.tmpRName = None\n-\t\tself.quorum = 1\n-\t\tself.width = 800\n-\t\tself.height = 300\n-\n-\tdef setNames(self, names):\n-\t\tself.names = names\n-\n-\tdef setInputFiles(self, fileNames, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tfor cpt, fileName in enumerate(fileNames):\n-\t\t\tself.parsers[self.names[cpt]] = chooser.getParser(fileName)\n-\n-\tdef setOutputFileName(self, fileName):\n-\t\tself.outputFileName = fileName\n-\n-\tdef setLabs(self, xLab, yLab):\n-\t\tself.xLab = xLab\n-\t\tself.yLab = yLab\n-\n-\tdef setBinSize(self, binSize):\n-\t\tself.binSize = binSize\n-\n-\tdef setColors(self, colors):\n-\t\tself.colors = colors\n-\n-\tdef setFactors(self, factors):\n-\t\tself.factors = dict(zip(self.names, factors))\n-\n-\tdef setMultiple(self, boolean):\n-\t\tself.multiple = boolean\n-\t\n-\tdef setImageSize(self, width, height):\n-\t\tif width != None:\n-\t\t\tself.width = width\n-\t\tif height != None:\n-\t\t\tself.height = height\n-\n-\tdef setQuorum(self, quorum):\n-\t\tself.quorum = quorum\n-\n-\tdef setRegionsFile(self, fileName):\n-\t\tif fileName != None:\n-\t\t\tself._loadRegions(fileName)\n-\n-\tdef _checkOptions(self):\n-\t\tif not self.parsers:\n-\t\t\tself.logAndRaise("ERROR: Missing input file names")\n-\n-\tdef _logAndRaise(self, errorMsg):\n-\t\tself.log.error(errorMsg)\n-\t\traise Exception(errorMsg)\n-\n-\tdef _loadRegions(self, fileName):\n-\t\tself.regions = {}\n-\t\tparser = GffParser(fileName, self.verbosity)\n-\t\tfor tran'..b'\t\tself._plot()\n-\t\tself._cleanFiles()\n-\t\tself.log.info("END Get Read Distribution")\n-\n-\n-if __name__ == "__main__":\n-\tdescription = "Usage: GetReadDistribution.py [options]\\n\\nGet Read Distribution v1.0.1: Get the distribution of a set of reads. [Category: Personal]\\n"\n-\tepilog = ""\n-\tparser = RepetOptionParser(description = description, epilog = epilog)\n-\tparser.add_option("-i", "--input", dest="inputFileNames", action="store", default=None, type="string", help="input files, separated by commas [compulsory] [format: string]")\n-\tparser.add_option("-f", "--format", dest="format", action="store", default=None, type="string", help="format of the input [compulsory] [format: transcript or sequence file format]")\n-\tparser.add_option("-n", "--names", dest="names", action="store", default=None, type="string", help="name of the input data, separated by commas [compulsory] [format: string]")\n-\tparser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [format: output file in PNG format]")\n-\tparser.add_option("-s", "--binSize", dest="binSize", action="store", default=10000, type="int", help="bin size [format: int] [default: 10000]")\n-\tparser.add_option("-l", "--xLabel", dest="xLab", action="store", default="", type="string", help="x-axis label name [format: string]")\n-\tparser.add_option("-L", "--yLabel", dest="yLab", action="store", default="# reads", type="string", help="y-axis label name [format: string] [default: Reads]")\n-\tparser.add_option("-c", "--colors", dest="colors", action="store", default=None, type="string", help="colors of the bars, separated by commas [format: string]")\n-\tparser.add_option("-a", "--factors", dest="factors", action="store", default=None, type="string", help="normalization factors, separated by commas [format: string]")\n-\tparser.add_option("-r", "--regions", dest="regionsFileName", action="store", default=None, type="string", help="regions to plot [format: transcript file in GFF format]")\n-\tparser.add_option("-m", "--multiple", dest="multiple", action="store_true", default=False, help="print position using multiples (k, G) [format: boolean] [default: False]")\n-\tparser.add_option("-q", "--quorum", dest="quorum", action="store", default=1, type="int", help="minimum number of intervals to plot a region [format: int] [default: 1]")\n-\tparser.add_option("-z", "--width", dest="width", action="store", default=800, type="int", help="width of the image [format: int] [default: 800]")\n-\tparser.add_option("-Z", "--height", dest="height", action="store", default=300, type="int", help="height of the image [format: int] [default: 300]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n-\toptions = parser.parse_args()[0]\n-\tiGetReadDistribution = GetReadDistribution(options.verbosity)\n-\tiGetReadDistribution.setNames(options.names.split(","))\n-\tiGetReadDistribution.setInputFiles(options.inputFileNames.split(","), options.format)\n-\tiGetReadDistribution.setOutputFileName(options.outputFileName)\n-\tiGetReadDistribution.setLabs(options.xLab, options.yLab)\n-\tiGetReadDistribution.setBinSize(options.binSize)\n-\tiGetReadDistribution.setColors(None if options.colors == None else options.colors.split(","))\n-\tiGetReadDistribution.setFactors(None if options.factors == None else map(float, options.factors.split(",")))\n-\tiGetReadDistribution.setRegionsFile(options.regionsFileName)\n-\tiGetReadDistribution.setMultiple(options.multiple)\n-\tiGetReadDistribution.setQuorum(options.quorum)\n-\tiGetReadDistribution.setImageSize(options.width, options.height)\n-\tiGetReadDistribution.run()\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetReadSizes.py --- a/smart_toolShed/SMART/Java/Python/GetReadSizes.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,255 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import random, os, glob, subprocess\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.parsing.GffParser import GffParser\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc import Utils\n-from commons.core.LoggerFactory import LoggerFactory\n-from commons.core.utils.RepetOptionParser import RepetOptionParser\n-\n-LOG_DEPTH = "smart"\n-DEFAULT_REGION = "_all_"\n-\n-class GetReadSizes(object):\n-\n-\tdef __init__(self, verbosity = 0):\n-\t\tself.xLab = "Size"\n-\t\tself.yLab = "# reads"\n-\t\tself.verbosity = verbosity\n-\t\tself.number = random.randint(0, 100000)\n-\t\tself.log = LoggerFactory.createLogger("%s.%s" % (LOG_DEPTH, self.__class__.__name__), self.verbosity)\n-\t\tself.parsers = {}\n-\t\tself.sizes = {}\n-\t\tself.factors = {}\n-\t\tself.regions = None\n-\t\tself.tmpDatName = None\n-\t\tself.tmpRName = None\n-\t\tself.width = 800\n-\t\tself.height = 300\n-\n-\tdef setNames(self, names):\n-\t\tself.names = names\n-\n-\tdef setInputFiles(self, fileNames, format):\n-\t\tchooser = ParserChooser(self.verbosity)\n-\t\tchooser.findFormat(format)\n-\t\tfor cpt, fileName in enumerate(fileNames):\n-\t\t\tself.parsers[self.names[cpt]] = chooser.getParser(fileName)\n-\n-\tdef setOutputFileName(self, fileName):\n-\t\tself.outputFileName = fileName\n-\n-\tdef setLabs(self, xLab, yLab):\n-\t\tself.xLab = xLab\n-\t\tself.yLab = yLab\n-\n-\tdef setSizes(self, minSize, maxSize):\n-\t\tself.minSize = minSize\n-\t\tself.maxSize = maxSize\n-\n-\tdef setColors(self, colors):\n-\t\tself.colors = colors\n-\n-\tdef setFactors(self, factors):\n-\t\tself.factors = dict(zip(self.names, factors))\n-\n-\tdef setRegionsFile(self, fileName):\n-\t\tif fileName != None:\n-\t\t\tself._loadRegions(fileName)\n-\n-\tdef setImageSize(self, width, height):\n-\t\tif width != None:\n-\t\t\tself.width = width\n-\t\tif height != None:\n-\t\t\tself.height = height\n-\n-\tdef _checkOptions(self):\n-\t\tif not self.parsers:\n-\t\t\tself.logAndRaise("ERROR: Missing input file names")\n-\n-\tdef _logAndRaise(self, errorMsg):\n-\t\tself.log.error(errorMsg)\n-\t\traise Exception(errorMsg)\n-\n-\tdef _loadRegions(self, fileName):\n-\t\tself.regions = {}\n-\t\tparser = GffParser(fileName, self.verbosity)\n-\t\tfor transcript in parser.getIterator():\n-\t\t\tchromosome = transcript.getChromosome()\n-\t\t\tstart = transcript.getStart()\n-\t\t\tend = transcript.getEnd()\n-\t\t\tname = transcript.getName()\n-\t\t\tif chromosome'..b'ogress.done()\n-\n-\tdef _cleanFiles(self):\n-\t\tfor fileName in (self.tmpDatName, self.tmpRName):\n-\t\t\tif fileName != None and os.path.exists(fileName):\n-\t\t\t\tos.remove(fileName)\n-\t\t\t\tfor otherFileName in glob.glob("%s*" % (fileName)):\n-\t\t\t\t\tos.remove(otherFileName)\n-\n-\tdef run(self):\n-\t\tLoggerFactory.setLevel(self.log, self.verbosity)\n-\t\tself._checkOptions()\n-\t\tself.log.info("START Get Read Sizes")\n-\t\tfor name in self.names:\n-\t\t\tself._parse(name)\n-\t\tself._plot()\n-\t\tself._cleanFiles()\n-\t\tself.log.info("END Get Read Sizes")\n-\n-\n-if __name__ == "__main__":\n-\tdescription = "Usage: GetReadSizes.py [options]\\n\\nGet Read Sizes v1.0.1: Get the sizes of a set of reads. [Category: Personal]\\n"\n-\tepilog = ""\n-\tparser = RepetOptionParser(description = description, epilog = epilog)\n-\tparser.add_option("-i", "--input", dest="inputFileNames", action="store", default=None, type="string", help="input files, separated by commas [compulsory] [format: string]")\n-\tparser.add_option("-f", "--format", dest="format", action="store", default=None, type="string", help="format of the input [compulsory] [format: transcript or sequence file format]")\n-\tparser.add_option("-n", "--names", dest="names", action="store", default=None, type="string", help="name of the input data, separated by commas [compulsory] [format: string]")\n-\tparser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [format: output file in PNG format]")\n-\tparser.add_option("-s", "--minSize", dest="minSize", action="store", default=None, type="int", help="minimum size [format: int]")\n-\tparser.add_option("-S", "--maxSize", dest="maxSize", action="store", default=None, type="int", help="maximum size [format: int]")\n-\tparser.add_option("-l", "--xLabel", dest="xLab", action="store", default="Size", type="string", help="x-axis label name [format: string] [default: Size]")\n-\tparser.add_option("-L", "--yLabel", dest="yLab", action="store", default="# reads", type="string", help="y-axis label name [format: string] [default: Reads]")\n-\tparser.add_option("-c", "--colors", dest="colors", action="store", default=None, type="string", help="colors of the bars, separated by commas [format: string]")\n-\tparser.add_option("-a", "--factors", dest="factors", action="store", default=None, type="string", help="normalization factors, separated by commas [format: string]")\n-\tparser.add_option("-r", "--regions", dest="regionsFileName", action="store", default=None, type="string", help="regions to plot [format: transcript file in GFF format]")\n-\tparser.add_option("-z", "--width", dest="width", action="store", default=800, type="int", help="width of the image [format: int] [default: 800]")\n-\tparser.add_option("-Z", "--height", dest="height", action="store", default=300, type="int", help="height of the image [format: int] [default: 300]")\n-\tparser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n-\toptions = parser.parse_args()[0]\n-\tiGetReadSizes = GetReadSizes(options.verbosity)\n-\tiGetReadSizes.setNames(options.names.split(","))\n-\tiGetReadSizes.setInputFiles(options.inputFileNames.split(","), options.format)\n-\tiGetReadSizes.setOutputFileName(options.outputFileName)\n-\tiGetReadSizes.setLabs(options.xLab, options.yLab)\n-\tiGetReadSizes.setSizes(options.minSize, options.maxSize)\n-\tiGetReadSizes.setColors(None if options.colors == None else options.colors.split(","))\n-\tiGetReadSizes.setFactors(None if options.factors == None else map(float, options.factors.split(",")))\n-\tiGetReadSizes.setRegionsFile(options.regionsFileName)\n-\tiGetReadSizes.setImageSize(options.width, options.height)\n-\tiGetReadSizes.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/GetUpDownStream.py --- a/smart_toolShed/SMART/Java/Python/GetUpDownStream.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,152 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2012 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import os -from optparse import OptionParser, OptionGroup -from commons.core.parsing.ParserChooser import ParserChooser -from commons.core.writer.Gff3Writer import Gff3Writer -from SMART.Java.Python.structure.Transcript import Transcript -from SMART.Java.Python.ncList.NCListFilePickle import NCListFileUnpickle -from SMART.Java.Python.ncList.FileSorter import FileSorter -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc import Utils - - -class GetUpDownStream(object): - - def __init__(self, verbosity = 0): - self.verbosity = verbosity - self.inputReader = None - self.outputWriter = None - self.nbRead = 0 - self.nbWritten = 0 - self.nbMerges = 0 - self.splittedFileNames = {} - - def __del__(self): - for fileName in self.splittedFileNames.values(): - os.remove(fileName) - - def setInputFile(self, fileName, format): - parserChooser = ParserChooser(self.verbosity) - parserChooser.findFormat(format, "transcript") - self.parser = parserChooser.getParser(fileName) - self.sortedFileName = "%s_sorted.pkl" % (os.path.splitext(fileName)[0]) - - def setOutputFile(self, fileName): - self.outputWriter = Gff3Writer(fileName, self.verbosity) - - def setDistances(self, up, down): - self.upDistance = up - self.downDistance = down - - def _sortFile(self): - fs = FileSorter(self.parser, self.verbosity-4) - fs.perChromosome(True) - fs.setOutputFileName(self.sortedFileName) - fs.sort() - self.splittedFileNames = fs.getOutputFileNames() - self.nbElementsPerChromosome = fs.getNbElementsPerChromosome() - self.nbRead = fs.getNbElements() - - def _write(self, start, end, reference, after): - if start > end: - return - transcript = Transcript() - transcript.setChromosome(reference.getChromosome()) - transcript.setStart(start) - transcript.setEnd(end) - transcript.setDirection("+") - transcript.setName("%s_%s" % ("up" if Utils.xor(reference.getDirection() == 1, after) else "down", reference.getName())) - self.outputWriter.addTranscript(transcript) - - def _getFlanking(self, chromosome): - progress = Progress(self.nbElementsPerChromosome[chromosome], "Analyzing chromosome %s" % (chromosome), self.verbosity) - parser = NCListFileUnpickle(self.splittedFileNames[chromosome], self.verbosity) - previous = None - for transcript in parser.getIterator(): - progress.inc() - transcript.removeExons() - if previous == None: - distance = self.upDistance if transcript.getDirection() == 1 else self.downDistance - start = max(1, transcript.getStart() - distance) - self._write(start, transcript.getStart()-1, transcript, False) - previous = transcript - continue - if previous.include(transcript): - continue - if transcript.overlapWith(previous): - previous = transcript - continue - distancePrevious = self.downDistance if previous.getDirection() == 1 else self.upDistance - distanceCurrent = self.upDistance if transcript.getDirection() == 1 else self.downDistance - distance = transcript.getDistance(previous) - if distancePrevious + distanceCurrent == 0: - previous = transcript - continue - if distance >= distancePrevious + distanceCurrent: - endPrevious = previous.getEnd() + distancePrevious - startCurrent = transcript.getStart() - distanceCurrent - else: - middle = previous.getEnd() + int((distance-1) * float(distancePrevious) / (distancePrevious + distanceCurrent)) - endPrevious = middle - startCurrent = middle+1 - self._write(previous.getEnd() + 1, endPrevious, previous, True) - self._write(startCurrent, transcript.getStart() - 1, transcript, False) - previous = transcript - distance = self.downDistance if previous.getDirection() == 1 else self.upDistance - self._write(previous.getEnd() + 1, previous.getEnd() + distance, previous, True) - progress.done() - - def run(self): - self._sortFile() - for chromosome in sorted(self.nbElementsPerChromosome.keys()): - self._getFlanking(chromosome) - self.outputWriter.close() - -if __name__ == "__main__": - - # parse command line - description = "Get Up and Down Stream v1.0.0: Get the flanking regions of an annotation. [Category: Data Modification]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in mapping format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the file [compulsory] [format: mapping file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-u", "--up", dest="up", action="store", default=0, type="int", help="the upstream distance [format: int]") - parser.add_option("-d", "--down", dest="down", action="store", default=0, type="int", help="the downstream distance [format: int]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]") - (options, args) = parser.parse_args() - - guds = GetUpDownStream(options.verbosity) - guds.setInputFile(options.inputFileName, options.format) - guds.setOutputFile(options.outputFileName) - guds.setDistances(options.up, options.down) - guds.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/RestrictFromCoverage.py --- a/smart_toolShed/SMART/Java/Python/RestrictFromCoverage.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,224 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2012\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os, struct, time, random\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.Interval import Interval\n-from SMART.Java.Python.ncList.NCList import NCList\n-from SMART.Java.Python.ncList.NCListCursor import NCListCursor\n-from SMART.Java.Python.ncList.NCListFilePickle import NCListFilePickle, NCListFileUnpickle\n-from SMART.Java.Python.ncList.FileSorter import FileSorter\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-from SMART.Java.Python.misc import Utils\n-try:\n- import cPickle as pickle\n-except:\n- import pickle\n-\n-REFERENCE = 0\n-QUERY = 1\n-TYPES = (REFERENCE, QUERY)\n-TYPETOSTRING = {0: "reference", 1: "query"}\n-\n-class RestrictFromCoverage(object):\n-\n- def __init__(self, verbosity = 1):\n- self._verbosity = verbosity\n- self._randomNumber = random.randint(0, 100000)\n- self._nbWritten = 0\n- self._nbLines = dict([type, 0] for type in TYPES)\n- self._splittedFileNames = dict([type, {}] for type in TYPES)\n- self._nbElementsPerChromosome = dict([type, {}] for type in TYPES)\n- self._nbElements = dict([type, 0] for type in TYPES)\n- \n- def __del__(self):\n- pass\n-\n- def _close(self):\n- self._writer.close()\n- \n- def setInputFileName(self, fileName, format, type):\n- chooser = ParserChooser(self._verbosity)\n- chooser.findFormat(format)\n- parser = chooser.getParser(fileName)\n- sortedFileName = "%s_%d_%d_sorted.pkl" % (os.path.splitext(fileName)[0], self._randomNumber, type)\n- if self._verbosity > 2:\n- print "Preparing %s file..." % (TYPETOSTRING[type])\n- startTime = time.time()\n- fs = FileSorter(parser, self._verbosity-1)\n- fs.perChromosome(True)\n- fs.setOutputFileName(sortedFileName)\n- fs.sort()\n- self._nbLines[type] = fs.getNbElements()\n- self._splittedFileNames[type] = fs.getOutputFileNames()\n- self._nbElementsPerChromosome[type] = fs.getNbElementsPerChromosome()\n- self._nbElements[type] = fs.getNbElements()\n- endTime = time.time'..b'ranscript):\n- self._writer.addTranscript(transcript)\n- self._nbWritten += 1\n-\n- def run(self):\n- for chromosome in sorted(self._splittedFileNames[QUERY].keys()):\n- self._compareChromosome(chromosome)\n- self._close()\n- if self._verbosity > 0:\n- print "# queries: %d" % (self._nbElements[QUERY])\n- print "# refs: %d" % (self._nbElements[REFERENCE])\n- print "# written: %d (%d%%)" % (self._nbWritten, 0 if self._nbElements[QUERY] == 0 else round(float(self._nbWritten) / self._nbElements[QUERY] * 100))\n- \n-\n-if __name__ == "__main__":\n- description = "Restrict From Coverage v1.0.0: Select the elements from the first set which have a given coverage. [Category: Data Comparison]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file 1 [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of file 1 [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of file 2 [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="output", action="store", default=None, type="string", help="output file [compulsory] [format: output file in GFF3 format]")\n- parser.add_option("-n", "--minNucleotides", dest="minNucleotides", action="store", default=None, type="int", help="minimum number of nucleotides overlapping to declare an overlap [format: int]")\n- parser.add_option("-N", "--maxNucleotides", dest="maxNucleotides", action="store", default=None, type="int", help="maximum number of nucleotides overlapping to declare an overlap [format: int]")\n- parser.add_option("-p", "--minPercent", dest="minPercent", action="store", default=None, type="int", help="minimum percentage of nucleotides overlapping to declare an overlap [format: int]")\n- parser.add_option("-P", "--maxPercent", dest="maxPercent", action="store", default=None, type="int", help="maximum percentage of nucleotides overlapping to declare an overlap [format: int]")\n- parser.add_option("-e", "--minOverlap", dest="minOverlap", action="store", default=None, type="int", help="minimum number of elements from 2nd file to declare an overlap [format: int]")\n- parser.add_option("-E", "--maxOverlap", dest="maxOverlap", action="store", default=None, type="int", help="maximum number of elements from 2nd file to declare an overlap [format: int]")\n- parser.add_option("-s", "--strands", dest="strands", action="store_true", default=False, help="consider the two strands separately [format: bool] [default: false]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n- rfc = RestrictFromCoverage(options.verbosity)\n- rfc.setInputFileName(options.inputFileName1, options.format1, QUERY)\n- rfc.setInputFileName(options.inputFileName2, options.format2, REFERENCE)\n- rfc.setOutputFileName(options.output)\n- rfc.setNbNucleotides(options.minNucleotides, options.maxNucleotides)\n- rfc.setPercent(options.minPercent, options.maxPercent)\n- rfc.setOverlap(options.minOverlap, options.maxOverlap)\n- rfc.setStrands(options.strands)\n- rfc.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/SelectByTag.py --- a/smart_toolShed/SMART/Java/Python/SelectByTag.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,148 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Select the transcript such that a tag value is not less than a given threshold""" -import os -import sys -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.writer import MySqlTranscriptWriter -from commons.core.writer.Gff3Writer import Gff3Writer -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.RPlotter import RPlotter - -class SelectByTag(object): - - def __init__(self, verbosity = 1): - self.input = None - self.format = None - self.tag = None - self.value = None - self.min = None - self.max = None - self.default = None - self.output = None - self.mysql = None - self.verbosity = verbosity - - self.parser = None - self.writer = None - self.mysqlWriter = None - self.nbElements = None - self.nbWritten = 0 - - - def setParser(self): - self.parser = TranscriptContainer(self.input, self.format, self.verbosity) - self.nbElements = self.parser.getNbTranscripts() - - - def setWriter(self): - self.writer = Gff3Writer(self.output, self.verbosity) - if self.mysql: - self.mysqlWriter = MySqlTranscriptWriter(self.output, self.verbosity) - - - def isAccepted(self, transcript): - value = transcript.getTagValue(self.tag) - if value == None: - if self.default != None: - value = self.default - else: - raise Exception("Error! Transcript %s no tag called '%s'" % (transcript, self.tag)) - if self.value != None: - if self.value == str(value): - return True - return self.value.isdigit() and value == float(self.value) - value = float(value) - return (self.min == None or self.min <= value) and (self.max == None or self.max >= value) - - - def readInputFile(self): - progress = Progress(self.parser.getNbTranscripts(), "Writing transcripts", self.verbosity) - for transcript in self.parser.getIterator(): - if self.isAccepted(transcript): - self.writer.addTranscript(transcript) - if self.mysql: - self.mysqlWriter.addTranscript(transcript) - self.nbWritten += 1 - progress.inc() - progress.done() - - - def writeFile(self): - self.writer.write() - if self.mysql: - self.mysqlWriter.write() - - - def run(self): - self.setParser() - self.setWriter() - self.readInputFile() - self.writeFile() - if self.verbosity > 0: - print "%d input" % (self.nbElements) - if self.nbElements != 0: - print "%d output (%.2f%%)" % (self.nbWritten, float(self.nbWritten) / self.nbElements * 100) - - - -if __name__ == "__main__": - - # parse command line - description = "Select by Tag v1.0.2: Keep the genomic coordinates such that a the value of a given tag is between two limits. [Category: Data Selection]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input [compulsory] [format: transcript file format]") - parser.add_option("-g", "--tag", dest="tag", action="store", default=None, type="string", help="the tag [compulsory] [format: string]") - parser.add_option("-a", "--value", dest="value", action="store", default=None, type="string", help="the value to be found [format: string]") - parser.add_option("-m", "--min", dest="min", action="store", default=None, type="float", help="the minimum threshold [format: float]") - parser.add_option("-M", "--max", dest="max", action="store", default=None, type="float", help="the maximum threshold [format: float]") - parser.add_option("-d", "--default", dest="default", action="store", default=None, type="float", help="value if tag is not present [format: float]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-y", "--mysql", dest="mysql", action="store_true", default=False, help="write output into MySQL tables [format: boolean] [default: False]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - selectByTag = SelectByTag(options.verbosity) - selectByTag.input = options.inputFileName - selectByTag.format = options.format - selectByTag.tag = options.tag - selectByTag.value = options.value - selectByTag.min = options.min - selectByTag.max = options.max - selectByTag.default = options.default - selectByTag.output = options.outputFileName - selectByTag.mysql = options.mysql - selectByTag.run() - - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/WrappGetDistribution.py --- a/smart_toolShed/SMART/Java/Python/WrappGetDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,96 +0,0 @@ -#! /usr/bin/env python -from optparse import OptionParser -import tarfile -import os -import re -import shutil -import subprocess - -SMART_PATH = "%s/SMART" % os.environ["REPET_PATH"] - -def toTar(tarFileName, directory): - fileName = os.path.splitext(tarFileName)[0] - fileNameBaseName = os.path.basename(fileName) - tfile = tarfile.open(fileName + ".tmp.tar", "w") - list = os.listdir(directory) - for file in list: - if re.search(str(fileNameBaseName), file): - tfile.add(file) - os.system("mv %s %s" % (fileName + ".tmp.tar", options.outTarFileName)) - tfile.close() - - -if __name__ == "__main__": - - magnifyingFactor = 1000 - - # parse command line - description = "Get Distribution v1.0.1: Get the distribution of the genomic coordinates on a genome. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outTarFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-r", "--reference", dest="referenceFileName", action="store", default=None, type="string", help="file containing the genome [compulsory] [format: file in FASTA format]") - parser.add_option("-n", "--nbBins", dest="nbBins", action="store", default=1000, type="int", help="number of bins [default: 1000] [format: int]") - parser.add_option("-2", "--bothStrands", dest="bothStrands", action="store_true", default=False, help="plot one curve per strand [format: bool] [default: false]") - parser.add_option("-w", "--raw", dest="raw", action="store_true", default=False, help="plot raw number of occurrences instead of density [format: bool] [default: false]") - parser.add_option("-x", "--csv", dest="csv", action="store_true", default=False, help="write a .csv file [format: bool]") - parser.add_option("-c", "--chromosome", dest="chromosome", action="store", default=None, type="string", help="plot only a chromosome [format: string]") - parser.add_option("-s", "--start", dest="start", action="store", default=None, type="int", help="start from a given region [format: int]") - parser.add_option("-e", "--end", dest="end", action="store", default=None, type="int", help="end from a given region [format: int]") - parser.add_option("-y", "--yMin", dest="yMin", action="store", default=None, type="int", help="minimum value on the y-axis to plot [format: int]") - parser.add_option("-Y", "--yMax", dest="yMax", action="store", default=None, type="int", help="maximum value on the y-axis to plot [format: int]") - parser.add_option("-g", "--gff", dest="gff", action="store_true", default=False, help="also write GFF3 file [format: bool] [default: false]") - parser.add_option("-H", "--height", dest="height", action="store", default=None, type="int", help="height of the graphics [format: int] [default: 300]") - parser.add_option("-W", "--width", dest="width", action="store", default=None, type="int", help="width of the graphics [format: int] [default: 1000]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool]") - (options, args) = parser.parse_args() - - - absPath = os.getcwd() - print "the current path is :", absPath - directory = "/tmp/wrappGetDistribution" - print "the dir path is :", directory - if not os.path.exists(directory): - os.makedirs(directory) - os.chdir(directory) - if options.inputFileName != None and options.format != None and options.outTarFileName != None: - outputFileName = os.path.splitext(os.path.basename(options.outTarFileName))[0] - cmd = "python %s/Java/Python/getDistribution.py -i %s -f %s -o %s -D %s" % (SMART_PATH, options.inputFileName, options.format, outputFileName, directory) - if options.referenceFileName != None : - cmd += " -r %s" % options.referenceFileName - if options.nbBins != None : - cmd += " -n %s" % options.nbBins - if options.chromosome : - cmd += " -c %s" % options.chromosome - if options.start != None : - cmd += " -s %s" % options.start - if options.end != None : - cmd += " -e %s" % options.end - if options.yMin != None : - cmd += " -y %s" % options.yMin - if options.yMax != None : - cmd += " -Y %s" % options.yMax - if options.height != None : - cmd += " -H %s" % options.height - if options.width != None : - cmd += " -W %s" % options.width - if options.bothStrands : - cmd += " -2" - if options.raw : - cmd += " -w" - if options.csv : - cmd += " -x" - if options.gff : - cmd += " -g" - if options.log : - cmd += " -l" - print "cmd is: ", cmd - status = subprocess.call(cmd, shell=True) - if status != 0: - raise Exception("Problem with the execution of command!") - toTar(options.outTarFileName, directory) - shutil.rmtree(directory) - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/WrappGetReadDistribution.py --- a/smart_toolShed/SMART/Java/Python/WrappGetReadDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,58 +0,0 @@ -#! /usr/bin/env python -from optparse import OptionParser -import tarfile -import os -import re -import shutil -import subprocess - -SMART_PATH = "%s/SMART" % os.environ["REPET_PATH"] - -def toTar(tarFileName, directory): - fileName = os.path.splitext(tarFileName)[0] - fileNameBaseName = os.path.basename(fileName) - tfile = tarfile.open(fileName + ".tmp.tar", "w") - list = os.listdir(directory) - for file in list: - if re.search(str(fileNameBaseName), file): - tfile.add(file) - os.system("mv %s %s" % (fileName + ".tmp.tar", options.outTarFileName)) - tfile.close() - - -if __name__ == "__main__": - - # parse command line - description = "Get Read Distribution v1.0.1: Plot the number of identical reads and give the most represented. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file sequence [compulsory] [format: file in sequence format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the file [compulsory] [format: sequence file format]") - parser.add_option("-n", "--number", dest="number", action="store", default=None, type="int", help="keep the best n [format: int]") - parser.add_option("-p", "--percent", dest="percent", action="store", default=None, type="float", help="keep the best n\% [format: float]") - parser.add_option("-o", "--output", dest="outTarFileName", action="store", type="string", help="output file [compulsory] [format: zip]") - - (options, args) = parser.parse_args() - - - absPath = os.getcwd() - print "the current path is :", absPath - directory = "/tmp/wrappGetReadDistribution" - print "the dir path is :", directory - if not os.path.exists(directory): - os.makedirs(directory) - os.chdir(directory) - if options.inputFileName != None and options.format != None and options.outTarFileName != None: - outputFileName = os.path.splitext(os.path.basename(options.outTarFileName))[0] - cmd = "python %s/Java/Python/getReadDistribution.py -i %s -f %s -o %s -D %s" % (SMART_PATH, options.inputFileName, options.format, outputFileName, directory) - if options.number != None : - cmd += " -n %s" % options.number - if options.percent != None : - cmd += " -p %s" % options.percent - print "cmd is: ", cmd - status = subprocess.call(cmd, shell=True) - if status != 0: - raise Exception("Problem with the execution of command!") - toTar(options.outTarFileName, directory) - shutil.rmtree(directory) - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/WrappPlotCoverage.py --- a/smart_toolShed/SMART/Java/Python/WrappPlotCoverage.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,89 +0,0 @@ -#! /usr/bin/env python -from optparse import OptionParser -import tarfile -import os -import re -import shutil -import subprocess - -SMART_PATH = "%s/SMART" % os.environ["REPET_PATH"] - -def toTar(tarFileName, directory): - fileName = os.path.splitext(tarFileName)[0] - fileNameBaseName = os.path.basename(fileName) - tfile = tarfile.open(fileName + ".tmp.tar", "w") - list = os.listdir(directory) - for file in list: - if re.search(str(fileNameBaseName), file): - tfile.add(file) - os.system("mv %s %s" % (fileName + ".tmp.tar", options.outTarFileName)) - tfile.close() - - - -if __name__ == "__main__": - - # parse command line - description = "Plot Coverage v1.0.1: Plot the coverage of the first data with respect to the second one. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file 1 [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--inputFormat1", dest="inputFormat1", action="store", type="string", help="format of input file 1 [compulsory] [format: transcript file format]") - parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]") - parser.add_option("-g", "--inputFormat2", dest="inputFormat2", action="store", type="string", help="format of input file 2 [compulsory] [format: transcript file format]") - parser.add_option("-q", "--sequence", dest="inputSequence", action="store", default=None, type="string", help="input sequence file [format: file in FASTA format] [default: None]") - parser.add_option("-o", "--output", dest="outTarFileName", action="store", type="string", help="output file [compulsory] [format: output file in zip format]") - parser.add_option("-w", "--width", dest="width", action="store", default=1500, type="int", help="width of the plots (in px) [format: int] [default: 1500]") - parser.add_option("-e", "--height", dest="height", action="store", default=1000, type="int", help="height of the plots (in px) [format: int] [default: 1000]") - parser.add_option("-t", "--title", dest="title", action="store", default="", type="string", help="title of the plots [format: string]") - parser.add_option("-x", "--xlab", dest="xLabel", action="store", default="", type="string", help="label on the x-axis [format: string]") - parser.add_option("-y", "--ylab", dest="yLabel", action="store", default="", type="string", help="label on the y-axis [format: string]") - parser.add_option("-p", "--plusColor", dest="plusColor", action="store", default="red", type="string", help="color for the elements on the plus strand [format: string] [default: red]") - parser.add_option("-m", "--minusColor", dest="minusColor", action="store", default="blue", type="string", help="color for the elements on the minus strand [format: string] [default: blue]") - parser.add_option("-s", "--sumColor", dest="sumColor", action="store", default="black", type="string", help="color for 2 strands coverage line [format: string] [default: black]") - parser.add_option("-l", "--lineColor", dest="lineColor", action="store", default="black", type="string", help="color for the lines [format: string] [default: black]") - parser.add_option("-1", "--merge", dest="merge", action="store_true", default=False, help="merge the 2 plots in 1 [format: boolean] [default: false]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - absPath = os.getcwd() - directory = "/tmp/wrappPlotCov" - if not os.path.exists(directory): - os.makedirs(directory) - os.chdir(directory) - if options.inputFileName1 != None and options.inputFormat1 != None and options.inputFileName2 != None and options.inputFormat2 != None and options.outTarFileName != None: - outputFileName = os.path.splitext(os.path.basename(options.outTarFileName))[0] - print 'outputfile is :', outputFileName - cmd = "python %s/Java/Python/plotCoverage.py -i %s -f %s -j %s -g %s -o %s -D %s" % (SMART_PATH, options.inputFileName1, options.inputFormat1, options.inputFileName2, options.inputFormat2, outputFileName, directory) - if options.inputSequence!= None: - cmd += " -q %s" % options.inputSequence - if options.width != None: - cmd += " -w %s" % options.width - if options.height != None: - cmd += " -e %s" % options.height - if options.title != None: - cmd += " -t %s" % options.title - if options.xLabel != None: - cmd += " -x %s" % options.xLabel - if options.yLabel != None: - cmd += " -y %s" % options.yLabel - if options.plusColor != None: - cmd += " -p %s" % options.plusColor - if options.minusColor != None: - cmd += " -m %s" % options.minusColor - if options.sumColor != None: - cmd += " -s %s" % options.sumColor - if options.lineColor != None: - cmd += " -l %s" % options.lineColor - if options.merge: - cmd += " -1" - status = subprocess.call(cmd, shell=True) - if status != 0: - raise Exception("Problem with the execution of command!") - toTar(options.outTarFileName, directory) - shutil.rmtree(directory) - - - - - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/WrappPlotRepartition.py --- a/smart_toolShed/SMART/Java/Python/WrappPlotRepartition.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,71 +0,0 @@ -#! /usr/bin/env python -from optparse import OptionParser -import tarfile -import os -import re -import shutil -import subprocess - -SMART_PATH = "%sSMART" % os.environ["REPET_PATH"] - -def toTar(tarFileName, directory): - fileName = os.path.splitext(tarFileName)[0] - fileNameBaseName = os.path.basename(fileName) - tfile = tarfile.open(fileName + ".tmp.tar", "w") - list = os.listdir(directory) - for file in list: - if re.search(str(fileNameBaseName), file): - tfile.add(file) - os.system("mv %s %s" % (fileName + ".tmp.tar", options.outTarFileName)) - tfile.close() - - -if __name__ == "__main__": - - magnifyingFactor = 1000 - - # parse command line - description = "Plot the repartition of different data on a whole genome. (This tool uses 1 input file only, the different values being stored in the tags. See documentation to know more about it.) [Category: Visualization]" - - - parser = OptionParser(description = description) - parser.add_option("-i", "--input",dest="inputFileName",action="store",type="string",help="input file name [compulsory] [format: file in GFF3 format]") - parser.add_option("-n", "--names",dest="names", action="store", type="string", help="name for the tags (separated by commas and no space) [compulsory] [format: string]") - parser.add_option("-o", "--output",dest="outTarFileName",action="store",type="string", help="output file [compulsory] [format: output file tar format]") - parser.add_option("-c", "--color",dest="colors",action="store",default=None,type="string", help="color of the lines (separated by commas and no space) [format: string]") - parser.add_option("-f", "--format",dest="format",action="store",default="png",type="string", help="format of the output file [format: string] [default: png]") - parser.add_option("-r", "--normalize",dest="normalize",action="store_true", default=False,help="normalize data (when panels are different) [format: bool] [default: false]") - parser.add_option("-l", "--log",dest="log",action="store",default="",type="string", help="use log on x- or y-axis (write 'x', 'y' or 'xy') [format: string]") - parser.add_option("-v", "--verbosity",dest="verbosity",action="store",default=1,type="int",help="trace level [format: int]") - (options, args) = parser.parse_args() - - - absPath = os.getcwd() - print "the current path is :", absPath - directory = "/tmp/wrappPlotRepartition" - print "the dir path is :", directory - if not os.path.exists(directory): - os.makedirs(directory) - os.chdir(directory) - if options.inputFileName != None and options.format != None and options.outTarFileName != None: - outputFileName = os.path.splitext(os.path.basename(options.outTarFileName))[0] - cmd = "python %s/Java/Python/plotRepartition.py -i %s -o %s -D %s" % (SMART_PATH, options.inputFileName, outputFileName, directory) - if options.names != None : - cmd += " -n %s" % options.names - else: print "You must choose tag names !" - if options.colors != None : - cmd += " -c %s" % options.colors - if options.format != None: - cmd += " -f %s" % options.format - if options.normalize : - cmd += " -r " - if options.log != "" : - cmd += " -l %s" % options.log - - print "cmd is: ", cmd - status = subprocess.call(cmd, shell=True) - if status != 0: - raise Exception("Problem with the execution of command!") - toTar(options.outTarFileName, directory) - shutil.rmtree(directory) - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/__init__.pyc |
b |
Binary file smart_toolShed/SMART/Java/Python/__init__.pyc has changed |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/adaptorStripper.py --- a/smart_toolShed/SMART/Java/Python/adaptorStripper.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,115 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Remove adaptors""" - -import os -from optparse import OptionParser -from SMART.Java.Python.structure.Sequence import Sequence -from SMART.Java.Python.structure.SequenceList import SequenceList -from commons.core.parsing.FastaParser import FastaParser -from commons.core.writer.FastaWriter import FastaWriter -from SMART.Java.Python.misc.Progress import Progress - - -def distance (string1, string2): - if len(string1) != len(string2): - return None - distance = 0 - for i in range(0, len(string1)): - if string1[i] != string2[i]: - distance += 1 - return distance - - - -if __name__ == "__main__": - nbRemaining = 0 - - # parse command line - description = "Adaptor Stripper v1.0.1: Remove the adaptor of a list of reads. [Category: Personnal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in FASTA format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in FASTA format]") - parser.add_option("-5", "--5primeAdaptor", dest="fivePrimeAdaptor", action="store", type="string", help="five prime adaptor [format: string]") - parser.add_option("-3", "--3primeAdaptor", dest="threePrimeAdaptor", action="store", type="string", help="three prime adaptor [format: string]") - parser.add_option("-d", "--5primeDist", dest="fivePrimeDistance", action="store", default=3, type="int", help="five prime distance [format: int] [default: 3]") - parser.add_option("-e", "--3primeDist", dest="threePrimeDistance", action="store", default=3, type="int", help="three prime distance [format: int [default: 3]]") - parser.add_option("-m", "--3primeSize", dest="threePrimeSize", action="store", default=10, type="int", help="three prime size [format: int] [default: 10]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") - (options, args) = parser.parse_args() - - if options.log: - logHandle = open(options.outputFileName + ".log", "w") - - - writer = FastaWriter(options.outputFileName + ".fas", options.verbosity) - sequenceParser = FastaParser(options.inputFileName, options.verbosity) - nbSequences = sequenceParser.getNbSequences() - - # treat sequences - progress = Progress(sequenceParser.getNbSequences(), "Analyzing " + options.inputFileName, options.verbosity) - for sequence in sequenceParser.getIterator(): - fivePrimeAdaptor = sequence.getSequence()[0:len(options.fivePrimeAdaptor)] - threePrimeAdaptor = sequence.getSequence()[len(sequence.sequence)-len(options.threePrimeAdaptor):] - - # check 5' adaptor - fivePrimeDistance = distance(fivePrimeAdaptor, options.fivePrimeAdaptor) - # check 3' adaptor - threePrimeDistance = len(threePrimeAdaptor) - for i in range(options.threePrimeSize, len(threePrimeAdaptor)+1): - threePrimeDistance = min(threePrimeDistance, distance(threePrimeAdaptor[-i:], options.threePrimeAdaptor[:i])) - - # sort candidates - if fivePrimeDistance > options.fivePrimeDistance: - if options.log: - logHandle.write("Sequence %s does not start with the right adaptor (%s != %s)\n" % (sequence.getSequence(), fivePrimeAdaptor, options.fivePrimeAdaptor)) - elif threePrimeDistance > options.threePrimeDistance: - if options.log: - logHandle.write("Sequence %s does not end with the right adaptor (%s != %s)\n" % (sequence.getSequence(), threePrimeAdaptor, options.threePrimeAdaptor)) - else: - nbRemaining += 1 - sequence.setSequence(sequence.getSequence()[len(options.fivePrimeAdaptor):len(sequence.getSequence())-len(options.threePrimeAdaptor)]) - writer.addSequence(sequence) - - progress.inc() - - progress.done() - - if options.log: - logHandle.close() - - writer.write() - - print "kept %i over %i (%.f%%)" % (nbRemaining, nbSequences, float(nbRemaining) / nbSequences * 100) - - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/changeGffFeatures.sh --- a/smart_toolShed/SMART/Java/Python/changeGffFeatures.sh Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,2 +0,0 @@ -#!/bin/bash -sed "s/\t$2\t/\t$3\t/g" $1 |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/changeTagName.py --- a/smart_toolShed/SMART/Java/Python/changeTagName.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,90 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Change the name of a tag -""" - -import os -import random -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.Progress import Progress -from commons.core.writer.MySqlTranscriptWriter import MySqlTranscriptWriter -from commons.core.writer.Gff3Writer import Gff3Writer - - -if __name__ == "__main__": - - # parse command line - description = "Change Tag Name v1.0.1: Change the name of tag of a list of transcripts. [Category: Data Modification]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-t", "--tag", dest="tag", action="store", type="string", help="name of the tag to change [compulsory] [format: string]") - parser.add_option("-n", "--name", dest="name", action="store", type="string", help="new name for the tag [compulsory] [format: string]") - parser.add_option("-y", "--mysql", dest="mysql", action="store_true", default=False, help="mySQL output [format: bool] [default: false]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") - (options, args) = parser.parse_args() - - if options.log: - logHandle = open("%s.log" % options.outputFileName, "w") - - # create parser and writer(s) - parser = TranscriptContainer(options.inputFileName, options.inputFormat, options.verbosity) - tmpFileName = "tmpTranscriptFile%d.gff3" % (random.randint(0, 100000)) - writer = Gff3Writer(tmpFileName, options.verbosity) - if options.mysql: - mysqlWriter = MySqlTranscriptWriter(options.outputFileName, options.verbosity) - outputData = {} - - # process transcripts - progress = Progress(parser.getNbTranscripts(), "Printing transcripts %s" % (options.inputFileName), options.verbosity) - for transcript in parser.getIterator(): - if options.tag in transcript.tags: - value = transcript.tags[options.tag] - del transcript.tags[options.tag] - transcript.tags[options.name] = value - writer.addTranscript(transcript) - if options.mysql: - mysqlWriter.addTranscript(transcript) - progress.inc() - progress.done() - parser.transcriptListParser.close() - - writer.write() - - if options.mysql: - mysqlWriter.write() - - os.rename(tmpFileName, options.outputFileName) |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleanGff.py --- a/smart_toolShed/SMART/Java/Python/cleanGff.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,195 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Clean a GFF file (as given by NCBI or TAIR) and outputs a GFF3 file. -""" - -import os -import re -from optparse import OptionParser -from commons.core.parsing.GffParser import * -from SMART.Java.Python.misc.RPlotter import * -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress - -count = {} - -class ParsedLine(object): - def __init__(self, line, cpt): - self.line = line - self.cpt = cpt - self.parse() - - def parse(self): - self.line = self.line.strip() - self.splittedLine = self.line.split(None, 8) - if len(self.splittedLine) < 9: - raise Exception("Line '%s' has less than 9 fields. Exiting..." % (self.line)) - self.type = self.splittedLine[2] - self.parseOptions() - self.getId() - self.getParents() - - def parseOptions(self): - self.parsedOptions = {} - for option in self.splittedLine[8].split(";"): - option = option.strip() - if option == "": continue - posSpace = option.find(" ") - posEqual = option.find("=") - if posEqual != -1 and (posEqual < posSpace or posSpace == -1): - key, value = option.split("=", 1) - elif posSpace != -1: - key, value = option.split(None, 1) - else: - key = "ID" - value = option - self.parsedOptions[key.strip()] = value.strip(" \"") - - def getId(self): - for key in self.parsedOptions: - if key.lower() == "id": - self.id = self.parsedOptions[key] - return - if "Parent" in self.parsedOptions: - parent = self.parsedOptions["Parent"].split(",")[0] - if parent not in count: - count[parent] = {} - if self.type not in count[parent]: - count[parent][self.type] = 0 - count[parent][self.type] += 1 - self.id = "%s-%s-%d" % (parent, self.type, count[parent][self.type]) - else: - self.id = "smart%d" % (self.cpt) - self.parsedOptions["ID"] = self.id - - def getParents(self): - for key in self.parsedOptions: - if key.lower() in ("parent", "derives_from"): - self.parents = self.parsedOptions[key].split(",") - return - self.parents = None - - def removeParent(self): - for key in self.parsedOptions.keys(): - if key.lower() in ("parent", "derives_from"): - del self.parsedOptions[key] - - def export(self): - self.splittedLine[8] = ";".join(["%s=%s" % (key, value) for key, value in self.parsedOptions.iteritems()]) - return "%s\n" % ("\t".join(self.splittedLine)) - - -class CleanGff(object): - - def __init__(self, verbosity = 1): - self.verbosity = verbosity - self.lines = {} - self.acceptedTypes = [] - self.parents = [] - self.children = {} - - def setInputFileName(self, name): - self.inputFile = open(name) - - def setOutputFileName(self, name): - self.outputFile = open(name, "w") - - def setAcceptedTypes(self, types): - self.acceptedTypes = types - - def parse(self): - progress = UnlimitedProgress(100000, "Reading input file", self.verbosity) - for cpt, line in enumerate(self.inputFile): - if not line or line[0] == "#": continue - if line[0] == ">": break - parsedLine = ParsedLine(line, cpt) - if parsedLine.type in self.acceptedTypes: - self.lines[parsedLine.id] = parsedLine - progress.inc() - progress.done() - - def sort(self): - progress = Progress(len(self.lines.keys()), "Sorting file", self.verbosity) - for line in self.lines.values(): - parentFound = False - if line.parents: - for parent in line.parents: - if parent in self.lines: - parentFound = True - if parent in self.children: - self.children[parent].append(line) - else: - self.children[parent] = [line] - if not parentFound: - line.removeParent() - self.parents.append(line) - progress.inc() - progress.done() - - def write(self): - progress = Progress(len(self.parents), "Writing output file", self.verbosity) - for line in self.parents: - self.writeLine(line) - progress.inc() - self.outputFile.close() - progress.done() - - def writeLine(self, line): - self.outputFile.write(line.export()) - if line.id in self.children: - for child in self.children[line.id]: - self.writeLine(child) - - def run(self): - self.parse() - self.sort() - self.write() - - -if __name__ == "__main__": - - # parse command line - description = "Clean GFF v1.0.3: Clean a GFF file (as given by NCBI) and outputs a GFF3 file. [Category: Other]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file name [compulsory] [format: file in GFF format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-t", "--types", dest="types", action="store", default="mRNA,exon", type="string", help="list of comma-separated types that you want to keep [format: string] [default: mRNA,exon]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - cleanGff = CleanGff(options.verbosity) - cleanGff.setInputFileName(options.inputFileName) - cleanGff.setOutputFileName(options.outputFileName) - cleanGff.setAcceptedTypes(options.types.split(",")) - cleanGff.run() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleaning/CleanerChooser.py --- a/smart_toolShed/SMART/Java/Python/cleaning/CleanerChooser.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,80 +0,0 @@ -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import sys -from SMART.Java.Python.cleaning.TranscriptListCleaner import TranscriptListCleaner -from SMART.Java.Python.cleaning.GffCleaner import GffCleaner -from SMART.Java.Python.cleaning.GtfCleaner import GtfCleaner -from SMART.Java.Python.cleaning.DefaultCleaner import DefaultCleaner - -#Attention!! Do not delete the imports!! They are used to know the type of file format!!! - -class CleanerChooser(object): - """ - A class that finds the correct cleaner - @ivar format: the format - @type format: string - @ivar cleaner: the parser - @type cleaner: object - @ivar cleanerClass: the class of the parser - @type cleanerClass: class - @ivar verbosity: verbosity - @type verbosity: int - """ - - def __init__(self, verbosity = 0): - """ - Constructor - @param verbosity: verbosity - @type verbosity: int - """ - self.verbosity = verbosity - - - def findFormat(self, format): - """ - Find the correct parser - @ivar format: the format - @type format: string - @return: a cleaner - """ - for cleanerClass in TranscriptListCleaner.__subclasses__(): - if cleanerClass != None: - if cleanerClass.getFileFormats() != None and format in cleanerClass.getFileFormats(): - self.cleanerClass = cleanerClass - return - self.cleanerClass = DefaultCleaner - - - def getCleaner(self): - """ - Get the parser previously found - @return: the parser - """ - return self.cleanerClass(self.verbosity) |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleaning/DefaultCleaner.py --- a/smart_toolShed/SMART/Java/Python/cleaning/DefaultCleaner.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,45 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Default cleaner. Does nothing but copying. -""" -from SMART.Java.Python.cleaning.TranscriptListCleaner import TranscriptListCleaner -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress - - -class DefaultCleaner(TranscriptListCleaner): - - def __init__(self, verbosity = 1): - super(DefaultCleaner, self).__init__(verbosity) - - def _clean(self): - self.outputHandle.write(self.inputHandle.read()) |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleaning/GffCleaner.py --- a/smart_toolShed/SMART/Java/Python/cleaning/GffCleaner.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,168 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Clean a GFF file (as given by NCBI or TAIR) and outputs a GFF3 file. -""" - -from SMART.Java.Python.cleaning.TranscriptListCleaner import TranscriptListCleaner -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress - -count = {} - -class ParsedLine(object): - def __init__(self, line, cpt): - self.line = line - self.cpt = cpt - self.parse() - - def parse(self): - self.line = self.line.strip() - self.splittedLine = self.line.split(None, 8) - if len(self.splittedLine) < 9: - raise Exception("Line '%s' has less than 9 fields. Exiting..." % (self.line)) - self.type = self.splittedLine[2] - self.parseOptions() - self.getId() - self.getParents() - - def parseOptions(self): - self.parsedOptions = {} - for option in self.splittedLine[8].split(";"): - option = option.strip() - if option == "": continue - posSpace = option.find(" ") - posEqual = option.find("=") - if posEqual != -1 and (posEqual < posSpace or posSpace == -1): - key, value = option.split("=", 1) - elif posSpace != -1: - key, value = option.split(None, 1) - else: - key = "ID" - value = option - self.parsedOptions[key.strip()] = value.strip(" \"") - - def getId(self): - for key in self.parsedOptions: - if key.lower() == "id": - self.id = self.parsedOptions[key] - return - if "Parent" in self.parsedOptions: - parent = self.parsedOptions["Parent"].split(",")[0] - if parent not in count: - count[parent] = {} - if self.type not in count[parent]: - count[parent][self.type] = 0 - count[parent][self.type] += 1 - self.id = "%s-%s-%d" % (parent, self.type, count[parent][self.type]) - else: - self.id = "smart%d" % (self.cpt) - self.parsedOptions["ID"] = self.id - - def getParents(self): - for key in self.parsedOptions: - if key.lower() in ("parent", "derives_from"): - self.parents = self.parsedOptions[key].split(",") - return - self.parents = None - - def removeParent(self): - for key in self.parsedOptions.keys(): - if key.lower() in ("parent", "derives_from"): - del self.parsedOptions[key] - - def export(self): - self.splittedLine[8] = ";".join(["%s=%s" % (key, value) for key, value in self.parsedOptions.iteritems()]) - return "%s\n" % ("\t".join(self.splittedLine)) - - -class GffCleaner(TranscriptListCleaner): - - def __init__(self, verbosity = 1): - super(GffCleaner, self).__init__(verbosity) - self.lines = {} - self.acceptedTypes = ["mRNA", "transcript", "exon"] - self.parents = [] - self.children = {} - - def getFileFormats(): - return ["gff", "gff2", "gff3"] - getFileFormats = staticmethod(getFileFormats) - - def setAcceptedTypes(self, types): - self.acceptedTypes = types - - def parse(self): - progress = UnlimitedProgress(100000, "Reading input file", self.verbosity) - for cpt, line in enumerate(self.inputHandle): - if not line or line[0] == "#": continue - if line[0] == ">": break - parsedLine = ParsedLine(line, cpt) - if self.acceptedTypes == None or parsedLine.type in self.acceptedTypes: - self.lines[parsedLine.id] = parsedLine - progress.inc() - progress.done() - - def sort(self): - progress = Progress(len(self.lines.keys()), "Sorting file", self.verbosity) - for line in self.lines.values(): - parentFound = False - if line.parents: - for parent in line.parents: - if parent in self.lines: - parentFound = True - if parent in self.children: - self.children[parent].append(line) - else: - self.children[parent] = [line] - if not parentFound: - line.removeParent() - self.parents.append(line) - progress.inc() - progress.done() - - def write(self): - progress = Progress(len(self.parents), "Writing output file", self.verbosity) - for line in self.parents: - self.writeLine(line) - progress.inc() - progress.done() - - def writeLine(self, line): - self.outputHandle.write(line.export()) - if line.id in self.children: - for child in self.children[line.id]: - self.writeLine(child) - - def _clean(self): - self.parse() - self.sort() - self.write() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleaning/GtfCleaner.py --- a/smart_toolShed/SMART/Java/Python/cleaning/GtfCleaner.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,121 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Clean a GTF file -""" - -import shlex -from SMART.Java.Python.cleaning.TranscriptListCleaner import TranscriptListCleaner -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress - -count = {} - -class ParsedLine(object): - def __init__(self, line, cpt): - self.line = line - self.cpt = cpt - self.parse() - - def parse(self): - self.line = self.line.strip() - self.splittedLine = self.line.split(None, 8) - if len(self.splittedLine) < 9: - raise Exception("Line '%s' has less than 9 fields. Exiting..." % (self.line)) - self.type = self.splittedLine[2] - self.parseOptions() - - def parseOptions(self): - self.parsedOptions = {} - key = None - value = "" - for option in shlex.split(self.splittedLine[8]): - option = option.strip() - if option == "": continue - if key == None: - key = option - else: - endValue = False - if option[-1] == ";": - endValue = True - option.rstrip(";") - value = "%s \"%s\"" % (value, option) - if endValue: - self.parsedOptions[key] = value - if key == "transcript_id": - self.transcriptId = value - key = None - value = "" - - def export(self): - return "%s\n" % (self.line) - - -class GtfCleaner(TranscriptListCleaner): - - def __init__(self, verbosity = 1): - super(GtfCleaner, self).__init__(verbosity) - self.acceptedTypes = ["exon"] - self.parents = {} - - def getFileFormats(): - return ["gtf"] - getFileFormats = staticmethod(getFileFormats) - - def setAcceptedTypes(self, types): - self.acceptedTypes = types - - def parse(self): - progress = UnlimitedProgress(100000, "Reading input file", self.verbosity) - for cpt, line in enumerate(self.inputHandle): - if not line or line[0] == "#": continue - parsedLine = ParsedLine(line, cpt) - if self.acceptedTypes == None or parsedLine.type in self.acceptedTypes: - transcriptId = parsedLine.transcriptId - if transcriptId not in self.parents: - self.parents[parsedLine.transcriptId] = [parsedLine] - else: - self.parents[parsedLine.transcriptId].append(parsedLine) - progress.inc() - progress.done() - - def write(self): - progress = Progress(len(self.parents.keys()), "Writing output file", self.verbosity) - for parent in sorted(self.parents.keys()): - for line in self.parents[parent]: - self.outputHandle.write(line.export()) - progress.inc() - progress.done() - - def _clean(self): - self.parse() - self.write() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/cleaning/TranscriptListCleaner.py --- a/smart_toolShed/SMART/Java/Python/cleaning/TranscriptListCleaner.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,63 +0,0 @@ -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -import sys -from SMART.Java.Python.structure.TranscriptList import TranscriptList -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress - -class TranscriptListCleaner(object): - """A (quite generic) class that cleans a file containing transcripts""" - - def __init__(self, verbosity = 0): - self.verbosity = verbosity - - def setInputFileName(self, fileName): - try: - self.inputHandle = open(fileName) - except IOError: - raise Exception("Error! Transcript file '%s' does not exist! Exiting..." % (self.fileName)) - - def setOutputFileName(self, fileName): - try: - self.outputHandle = open(fileName, "w") - except IOError: - raise Exception("Error! Transcript file '%s' does not exist! Exiting..." % (self.fileName)) - - def getFileFormats(): - pass - getFileFormats = staticmethod(getFileFormats) - - def close(self): - self.inputHandle.close() - self.outputHandle.close() - - def clean(self): - self._clean() - self.close() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/clusterize.py --- a/smart_toolShed/SMART/Java/Python/clusterize.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,165 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-from commons.core.writer.WriterChooser import WriterChooser\n-"""Clusterize a set of transcripts"""\n-\n-import os\n-from optparse import OptionParser\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.ncList.NCListFilePickle import NCListFileUnpickle\n-from SMART.Java.Python.ncList.FileSorter import FileSorter\n-from SMART.Java.Python.misc.Progress import Progress\n-\n-class Clusterize(object):\n- \n- def __init__(self, verbosity):\n- self.normalize = False\n- self.presorted = False\n- self.distance = 1\n- self.colinear = False\n- self.nbWritten = 0\n- self.nbMerges = 0\n- self.verbosity = verbosity\n- self.splittedFileNames = {}\n-\n- def __del__(self):\n- for fileName in self.splittedFileNames.values():\n- os.remove(fileName)\n-\n- def setInputFile(self, fileName, format):\n- parserChooser = ParserChooser(self.verbosity)\n- parserChooser.findFormat(format)\n- self.parser = parserChooser.getParser(fileName)\n- self.sortedFileName = "%s_sorted.pkl" % (os.path.splitext(fileName)[0])\n-\n- def setOutputFileName(self, fileName, format="gff3", title="S-MART", feature="transcript", featurePart="exon"):\n- writerChooser = WriterChooser()\n- writerChooser.findFormat(format)\n- self.writer = writerChooser.getWriter(fileName)\n- self.writer.setTitle(title)\n- self.writer.setFeature(feature)\n- self.writer.setFeaturePart(featurePart)\n-\n- def setDistance(self, distance):\n- self.distance = distance\n-\n- def setColinear(self, colinear):\n- self.colinear = colinear\n-\n- def setNormalize(self, normalize):\n- self.normalize = normalize\n- \n- def setPresorted(self, presorted):\n- self.presorted = presorted\n-\n- def _sortFile(self):\n- fs = FileSorter(self.parser, self.verbosity-4)\n- fs.perChromosome(True)\n- fs.setPresorted(self.presorted)\n- fs.setOutputFileName(self.sortedFileName)\n- fs.sort()\n- self.splittedFileNames = fs.getOutputFileNames()\n- self.nbElementsPerChromosome = fs.getNbElementsPerChromosome()\n- self.nbElements = fs.getNbElements()\n- \n- def _iterate(self,'..b'omosome], self.verbosity)\n- for newTranscript in parser.getIterator():\n- newTranscripts = []\n- for oldTranscript in transcripts:\n- if self._checkOverlap(newTranscript, oldTranscript):\n- self._merge(newTranscript, oldTranscript)\n- elif self._checkPassed(newTranscript, oldTranscript):\n- self._write(oldTranscript)\n- else:\n- newTranscripts.append(oldTranscript)\n- newTranscripts.append(newTranscript)\n- transcripts = newTranscripts\n- progress.inc()\n- for transcript in transcripts:\n- self._write(transcript)\n- progress.done()\n-\n- def _merge(self, transcript1, transcript2):\n- self.nbMerges += 1\n- transcript2.setDirection(transcript1.getDirection())\n- transcript1.merge(transcript2)\n-\n- def _write(self, transcript):\n- self.nbWritten += 1\n- self.writer.addTranscript(transcript)\n-\n- def _checkOverlap(self, transcript1, transcript2):\n- if self.colinear and transcript1.getDirection() != transcript2.getDirection():\n- return False\n- if transcript1.getDistance(transcript2) > self.distance:\n- return False\n- return True\n-\n- def _checkPassed(self, transcript1, transcript2):\n- return (transcript1.getDistance(transcript2) > self.distance)\n-\n- def run(self):\n- self._sortFile()\n- for chromosome in sorted(self.splittedFileNames.keys()):\n- self._iterate(chromosome)\n- self.writer.close()\n- if self.verbosity > 0:\n- print "# input: %d" % (self.nbElements)\n- print "# written: %d (%d%% overlaps)" % (self.nbWritten, 0 if (self.nbElements == 0) else ((float(self.nbWritten) / self.nbElements) * 100))\n- print "# merges: %d" % (self.nbMerges)\n- \n-\n-if __name__ == "__main__":\n- description = "Clusterize v1.0.3: clusterize the data which overlap. [Category: Merge]"\n- \n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in transcript format given by -u]")\n- parser.add_option("-u", "--outputFormat", dest="outputFormat", action="store", default="gff", type="string", help="output file format [format: transcript file format]")\n- parser.add_option("-c", "--colinear", dest="colinear", action="store_true", default=False, help="merge colinear transcripts only [format: bool] [default: false]")\n- parser.add_option("-d", "--distance", dest="distance", action="store", default=0, type="int", help="max. distance between two transcripts to be merged [format: int] [default: 0]")\n- parser.add_option("-n", "--normalize", dest="normalize", action="store_true", default=False, help="normalize the number of reads per cluster by the number of mappings per read [format: bool] [default: false]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]")\n- (options, args) = parser.parse_args()\n- \n- c = Clusterize(options.verbosity)\n- c.setInputFile(options.inputFileName, options.format)\n- c.setOutputFileName(options.outputFileName, options.outputFormat)\n- c.setColinear(options.colinear)\n- c.setDistance(options.distance)\n- c.setNormalize(options.normalize)\n- c.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/clusterizeBySlidingWindows.py --- a/smart_toolShed/SMART/Java/Python/clusterizeBySlidingWindows.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,344 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import re\n-from commons.core.writer.WriterChooser import WriterChooser\n-"""\n-Cluster the data into regions (defined by size and overlap with next region) and keep only highest peaks.\n-"""\n-\n-import os, os.path\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc.Progress import Progress\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-\n-class ClusterizeBySlidingWindows(object):\n-\n- def __init__(self, verbosity = 0):\n- self.verbosity = verbosity\n- self.strands = (0, )\n- self.normalize = False\n- self.plot = None\n- self.excel = None\n- self.outputFileName = \'\'\n- self.defaultValue = None\n-\n- def __del__(self):\n- pass\n-\n- def setInputFile(self, fileName, format):\n- self.parser = TranscriptContainer(fileName, format, self.verbosity)\n-\n- def setOutputFileName(self, fileName, format="gff", title="S-MART", feature="transcript", featurePart="exon"):\n- writerChooser = WriterChooser(self.verbosity)\n- writerChooser.findFormat(format)\n- self.writer = writerChooser.getWriter(fileName)\n- self.writer.setTitle(title)\n- self.writer.setFeature(feature)\n- self.writer.setFeaturePart(featurePart)\n-# self.outputFileName = fileName\n-# self.outputFormat = format\n-\n- def setWindowSize(self, size):\n- self.size = size\n-\n- def setWindowOverlap(self, overlap):\n- self.overlap = overlap\n-\n- def setTag(self, tag):\n- self.tag = tag\n-\n- def setOperation(self, operation):\n- self.operation = operation\n-\n- def setBothStrands(self, bothStrands):\n- if bothStrands:\n- self.strands = (-1, 1)\n-\n- def setNormalize(self, normalize):\n- self.normalize = normalize\n-\n- def setPlot(self, plot):\n- self.plot = plot\n-\n- def setExcel(self, excel):\n- self.excel = excel\n-\n- def setOutputTag(self, tag):\n- self.outputTagName = tag\n- \n- def setDefaultValue(self, defaultValue):\n- self.defaultValue = defaultValue\n-\n- def checkOptions(self):\n-# if self.operation != None:\n-# raise Exception("Trying to combine the values without specifying tag! Aborting...")\n- if self.operation != '..b'lf.excel:\n- self.writeExcel()\n- if self.plot:\n- self.plotData()\n- self.printRegions()\n-\n-\n-if __name__ == "__main__":\n- \n- # parse command line\n- description = "Clusterize by Sliding Windows v1.0.1: Produces a GFF3 file that clusters a list of transcripts using a sliding window. [Category: Sliding Windows]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in transcript format given by -u]")\n- parser.add_option("-u", "--outputFormat", dest="outputFormat", action="store", default="gff", type="string", help="format of the output file [format: transcript file format]")\n- parser.add_option("-s", "--size", dest="size", action="store", type="int", help="size of the regions [compulsory] [format: int]")\n- parser.add_option("-e", "--overlap", dest="overlap", action="store", type="int", help="overlap between two consecutive regions [compulsory] [format: int]")\n- parser.add_option("-m", "--normalize", dest="normalize", action="store_true", default=False, help="normalize the number of reads per cluster by the number of mappings per read [format: bool] [default: false]")\n- parser.add_option("-g", "--tag", dest="tag", action="store", default=None, type="string", help="use a given tag as input (instead of summing number of features) [format: string]") \n- parser.add_option("-r", "--operation", dest="operation", action="store", default=None, type="string", help="combine tag value with given operation [format: choice (sum, avg, med, min, max)]")\n- parser.add_option("-d", "--defaultValue",dest="defaultValue", action="store", type="float", help="default value for input tag [format: float]")\n- parser.add_option("-w", "--write", dest="writeTag", action="store", default=None, type="string", help="print the result in the given tag (default usually is \'nbElements\') [format: string]") \n- parser.add_option("-2", "--strands", dest="strands", action="store_true", default=False, help="consider the two strands separately [format: bool] [default: false]")\n- parser.add_option("-p", "--plot", dest="plot", action="store", default=None, type="string", help="plot regions to the given file [format: output file in PNG format]")\n- parser.add_option("-x", "--excel", dest="excel", action="store", default=None, type="string", help="write an Excel file to the given file [format: output file in Excel format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]")\n- (options, args) = parser.parse_args()\n-\n- cbsw = ClusterizeBySlidingWindows(options.verbosity)\n- cbsw.setInputFile(options.inputFileName, options.inputFormat)\n- cbsw.setOutputFileName(options.outputFileName, options.outputFormat)\n- cbsw.setWindowSize(options.size)\n- cbsw.setWindowOverlap(options.overlap)\n- cbsw.setTag(options.tag)\n- cbsw.setDefaultValue(options.defaultValue)\n- cbsw.setOperation(options.operation)\n- cbsw.setOutputTag(options.writeTag)\n- cbsw.setBothStrands(options.strands)\n- cbsw.setPlot(options.plot)\n- cbsw.setExcel(options.excel)\n- cbsw.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/compareOverlapping.py --- a/smart_toolShed/SMART/Java/Python/compareOverlapping.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,126 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Compare overlap of two transcript lists"""\n-import sys\n-import os\n-from optparse import OptionParser\n-from SMART.Java.Python.misc import Utils\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from commons.core.writer.TranscriptWriter import TranscriptWriter\n-from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-\n-class CompareOverlapping(object):\n-\n- def __init__(self):\n- self._options = None\n-\n-\n- def setAttributesFromCmdLine(self):\n- description = "Compare Overlapping v1.0.3: Get the data which overlap with a reference set. [Category: Data Comparison]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file 1 [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of file 1 [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of file 2 [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="output", action="store", default=None, type="string", help="output file [compulsory] [format: output file in GFF3 format]")\n- parser.add_option("-S", "--start1", dest="start1", action="store", default=None, type="int", help="only consider the n first nucleotides of the transcripts in file 1 (do not use it with -U) [format: int]")\n- parser.add_option("-s", "--start2", dest="start2", action="store", default=None, type="int", help="only consider the n first nucleotides of the transcripts in file 2 (do not use it with -u) [format: int]")\n- parser.add_option("-U", "--end1", dest="end1", action="store", default=None, type="int'..b'pping", dest="notOverlapping", action="store_true", default=False, help="also output not overlapping data [format: bool] [default: false]")\n- parser.add_option("-x", "--exclude", dest="exclude", action="store_true", default=False, help="invert the match [format: bool] [default: false]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]")\n- (self._options, args) = parser.parse_args()\n-\n-\n- def run(self): \n- logHandle = None\n- if self._options.log:\n- logHandle = open(self._options.output, "w")\n-\n- transcriptContainer1 = TranscriptContainer(self._options.inputFileName1, self._options.format1, self._options.verbosity)\n- transcriptContainer2 = TranscriptContainer(self._options.inputFileName2, self._options.format2, self._options.verbosity)\n- writer = TranscriptWriter(self._options.output, "gff3", self._options.verbosity)\n-\n- transcriptListComparator = TranscriptListsComparator(logHandle, self._options.verbosity)\n- transcriptListComparator.restrictToStart(transcriptListComparator.QUERY, self._options.start1)\n- transcriptListComparator.restrictToStart(transcriptListComparator.REFERENCE, self._options.start2)\n- transcriptListComparator.restrictToEnd(transcriptListComparator.QUERY, self._options.end1)\n- transcriptListComparator.restrictToEnd(transcriptListComparator.REFERENCE, self._options.end2)\n- transcriptListComparator.extendFivePrime(transcriptListComparator.QUERY, self._options.fivePrime1)\n- transcriptListComparator.extendFivePrime(transcriptListComparator.REFERENCE, self._options.fivePrime2)\n- transcriptListComparator.extendThreePrime(transcriptListComparator.QUERY, self._options.threePrime1)\n- transcriptListComparator.extendThreePrime(transcriptListComparator.REFERENCE, self._options.threePrime2)\n- transcriptListComparator.acceptIntrons(transcriptListComparator.QUERY, self._options.introns)\n- transcriptListComparator.acceptIntrons(transcriptListComparator.REFERENCE, self._options.introns)\n- transcriptListComparator.getAntisenseOnly(self._options.antisense)\n- transcriptListComparator.getColinearOnly(self._options.colinear)\n- transcriptListComparator.getInvert(self._options.exclude)\n- transcriptListComparator.setMaxDistance(self._options.distance)\n- transcriptListComparator.setMinOverlap(self._options.minOverlap)\n- transcriptListComparator.setPcOverlap(self._options.pcOverlap)\n- transcriptListComparator.setIncludedOnly(self._options.included)\n- transcriptListComparator.setIncludingOnly(self._options.including)\n- transcriptListComparator.includeNotOverlapping(self._options.notOverlapping)\n- transcriptListComparator.computeOdds(True)\n- transcriptListComparator.setInputTranscriptContainer(transcriptListComparator.QUERY, transcriptContainer1)\n- transcriptListComparator.setInputTranscriptContainer(transcriptListComparator.REFERENCE, transcriptContainer2)\n- transcriptListComparator.setOutputWriter(writer)\n- transcriptListComparator.compareTranscriptList()\n-\n- if self._options.log:\n- logHandle.close()\n-\n- if not self._options.exclude:\n- odds = transcriptListComparator.getOdds()\n- if self._options.verbosity > 0 and odds:\n- print "min/avg/med/max transcripts: %d/%.2f/%.1f/%d" % Utils.getMinAvgMedMax(odds)\n- \n-if __name__ == "__main__":\n- icompareOverlapping = CompareOverlapping()\n- icompareOverlapping.setAttributesFromCmdLine()\n- icompareOverlapping.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/convertTranscriptFile.py --- a/smart_toolShed/SMART/Java/Python/convertTranscriptFile.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,115 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Read a transcript file and convert it to another format -""" - -import os, re -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.writer.TranscriptWriter import TranscriptWriter -from SMART.Java.Python.misc.Progress import Progress - - -class ConvertTranscriptFile(object): - def __init__(self,inputFileName="", inputFormat ="", outputFileName="", outputFormat="", name="", sequenceFileName=None, strands=False, galaxy=False, feature=None, featurePart=None, verbosity=1): - self.inputFileName = inputFileName - self.inputFormat = inputFormat - self.outputFileName = outputFileName - self.outputFormat = outputFormat - self.name = name - self.sequenceFileName = sequenceFileName - self.strands = strands - self.galaxy = galaxy - - self.feature=feature - self.featurePart=featurePart - - self.verbosity = verbosity - - def setAttributesFromCmdLine(self): - description = "Convert Transcript File v1.0.3: Convert a file from a format to another. [Category: Conversion]" - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in format given by -f]") - parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript or mapping file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in format given by -g]") - parser.add_option("-g", "--outputFormat", dest="outputFormat", action="store", type="string", help="format of the output file [compulsory] [format: transcript file format]") - parser.add_option("-n", "--name", dest="name", action="store", default="SMART", type="string", help="name for the transcripts [format: string] [default: SMART]") - parser.add_option("-s", "--sequences", dest="sequenceFileName", action="store", default=None, type="string", help="give the corresponding Multi-Fasta file (useful for EMBL format) [format: string]") - parser.add_option("-t", "--strands", dest="strands", action="store_true", default=False, help="consider the 2 strands as different (only useful for writing WIG files) [format: bool] [default: False]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int] [default: 1]") - parser.add_option("-G", "--galaxy", dest="galaxy", action="store_true", default=False, help="used for galaxy [format: bool] [default: False]") - (options, args) = parser.parse_args() - self._setAttributesFromOptions(options) - - def _setAttributesFromOptions(self, options): - self.inputFileName = options.inputFileName - self.inputFormat = options.inputFormat - self.outputFileName = options.outputFileName - self.outputFormat = options.outputFormat - self.name = options.name - self.sequenceFileName = options.sequenceFileName - self.strands = options.strands - self.galaxy = options.galaxy - self.verbosity = options.verbosity - - def run(self): - # create parser - parser = TranscriptContainer(self.inputFileName, self.inputFormat, self.verbosity) - # create writer - writer = TranscriptWriter(self.outputFileName, self.outputFormat, self.verbosity) - # connect parser and writer - writer.setContainer(parser) - - if self.name != None: - writer.setTitle(self.name) - if self.feature != None: - writer.setFeature(self.feature) - if self.featurePart != None: - writer.setFeaturePart(self.featurePart) - if self.sequenceFileName != None: - writer.addSequenceFile(self.sequenceFileName) - - nbItems = 0 - if self.verbosity > 0: - nbItems = parser.getNbItems() - print "%i items found" % (nbItems) - - if self.strands: - writer.setStrands(True) - # convert - writer.write() - writer.close() - -if __name__ == "__main__": - iConvertTranscriptFile = ConvertTranscriptFile() - iConvertTranscriptFile.setAttributesFromCmdLine() - iConvertTranscriptFile.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/coordinatesToSequence.py --- a/smart_toolShed/SMART/Java/Python/coordinatesToSequence.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,64 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Convert a list of coordinates to sequences""" - -from optparse import OptionParser -from commons.core.parsing.FastaParser import FastaParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.writer.FastaWriter import FastaWriter -from SMART.Java.Python.misc.Progress import Progress - - -if __name__ == "__main__": - - # parse command line - description = "Coordinates to Sequences v1.0.2: Extract the sequences from a list of coordinates. [Category: Conversion]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-s", "--sequences", dest="sequences", action="store", type="string", help="file that contains the sequences [compulsory] [format: file in FASTA format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file (FASTA format) [format: output file in FASTA format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - # create parser - parser = TranscriptContainer(options.inputFileName, options.format, options.verbosity) - - sequenceParser = FastaParser(options.sequences, options.verbosity) - - writer = FastaWriter(options.outputFileName, options.verbosity) - progress = Progress(parser.getNbTranscripts(), "Reading %s" % (options.inputFileName), options.verbosity) - for transcript in parser.getIterator(): - sequence = transcript.extractSequence(sequenceParser) - writer.addSequence(sequence) - progress.inc() - progress.done() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/fastqToFasta.py --- a/smart_toolShed/SMART/Java/Python/fastqToFasta.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,96 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Convert a FASTQ file to a FASTA file""" - -import os -import sys -from optparse import OptionParser -from SMART.Java.Python.misc.RPlotter import RPlotter -from SMART.Java.Python.misc.Progress import Progress -from math import * - -if __name__ == "__main__": - - # parse command line - description = "FastQ to FastA v1.0.1: Convert a FastQ file into a FastA file. [Category: Personnal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in FASTQ format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in FASTA format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]") - (options, args) = parser.parse_args() - - inputFile = open(options.inputFileName) - outputFastaFile = open(options.outputFileName, "w") - - inSequenceName = False - inQualityName = False - inSequence = False - inQuality = True - sequenceName = None - lineNumber = 1 - - for line in inputFile: - - if inSequenceName: - inSequence = True - inSequenceName = False - elif inQualityName: - inQuality = True - inQualityName = False - elif inSequence: - inQualityName = True - inSequence = False - elif inQuality: - inSequenceName = True - inQuality = False - else: - sys.exit("Error! Do not in which section I am (line is %d)" % (lineNumber)) - - line = line.strip() - if inSequenceName: - if line[0] != "@": - sys.exit("Error! Sequence name '%s' does not start with '@' (line is %d)" % (line, lineNumber)) - sequenceName = line[1:] - outputFastaFile.write(">%s\n" % (sequenceName)) - elif inQualityName: - if line[0] != "+": - sys.exit("Error! Quality name '%s' does not start with '+' (line is %d)" % (line, lineNumber)) - if len(line) > 1 and sequenceName != line[1:]: - sys.exit("Names in sequence and qual are different (%s, %s) (line is %d)" % (sequenceName, line[1:], lineNumber)) - elif inSequence: - outputFastaFile.write("%s\n" % (line)) - elif inQuality: - pass - lineNumber += 1 - - inputFile.close() - outputFastaFile.close() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/findTss.py --- a/smart_toolShed/SMART/Java/Python/findTss.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,77 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Find TSS from short reads""" -import os -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.writer.Gff3Writer import Gff3Writer - -if __name__ == "__main__": - - # parse command line - description = "Find TSS v1.0.1: Find the transcription start site of a list of transcripts. [Category: Merge]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="output", action="store", default=None, type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-n", "--normalize", dest="normalize", action="store_true", default=False, help="normalize the number of reads per cluster by the number of mappings per read [format: bool] [default: false]") - parser.add_option("-d", "--distance", dest="distance", action="store", default=10, type="int", help="distance between two reads to mark the same TSS [format: int] [default: 10]") - parser.add_option("-e", "--colinear", dest="colinear", action="store_true", default=False, help="group by strand [format: bool] [default: false]") - parser.add_option("-c", "--csv", dest="csv", action="store", default=None, type="string", help="output a CSV file in the given path [format: output file in Excel format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - transcriptContainer = TranscriptContainer(options.inputFileName, options.format, options.verbosity) - transcriptListComparator = TranscriptListsComparator(None, options.verbosity) - transcriptListComparator.restrictToStart(transcriptListComparator.QUERY, 1) - transcriptListComparator.setMaxDistance(options.distance) - transcriptListComparator.aggregate(True) - transcriptListComparator.computeOdds(True) - transcriptListComparator.getColinearOnly(options.colinear) - transcriptListComparator.setNormalization(options.normalize) - transcriptListComparator.setInputTranscriptContainer(transcriptListComparator.QUERY, transcriptContainer) - transcriptListComparator.setOutputWriter(Gff3Writer(options.output, options.verbosity)) - transcriptListComparator.compareTranscriptListSelfMerge() - - if options.csv != None: - csvResults = transcriptListComparator.getOddsPerTranscript() - csvFile = open(options.csv, "w") - csvFile.write("Number,Transcript\n") - for number in sorted(list(set(csvResults.values()))): - csvFile.write("%d," % (number)) - for name in csvResults: - if csvResults[name] == number: - csvFile.write("%s " % (name)) - csvFile.write("\n") - csvFile.close() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/fold.py --- a/smart_toolShed/SMART/Java/Python/fold.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,95 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Read a mapping file (many formats supported) and select some of them -Mappings should be sorted by read names -""" - -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.toolLauncher.RnaFoldLauncher import RnaFoldLauncher -from commons.core.writer.Gff3Writer import Gff3Writer - - -class Fold(object): - """ - Fold a series of transcripts - """ - - def __init__(self, verbosity = 0): - self.verbosity = verbosity - self.rnaFoldLauncher = RnaFoldLauncher(verbosity) - self.gff3Writer = None - - - def setInputFileName(self, fileName, format): - transcriptContainer = TranscriptContainer(fileName, format, options.verbosity) - self.rnaFoldLauncher.setTranscriptList(transcriptContainer) - - - def setOutputFileName(self, fileName): - self.gff3Writer = Gff3Writer("%s.gff3" % (fileName), self.verbosity) - - - def setGenomeFileName(self, fileName): - self.rnaFoldLauncher.setGenomeFile(fileName) - - - def setExtensions(self, fivePrime, threePrime): - self.rnaFoldLauncher.setExtensions(fivePrime, threePrime) - - - def start(self): - self.gff3Writer.addTranscriptList(self.rnaFoldLauncher.getResults()) - - - -if __name__ == "__main__": - - # parse command line - description = "Fold v1.0.1: Fold a list of transcript and give the energy. [Category: Personal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-g", "--genome", dest="genomeFileName", action="store", type="string", help="genome file name [format: file in FASTA format]") - parser.add_option("-5", "--fivePrime", dest="fivePrime", action="store", type="int", help="extend towards the 5' end [format: int]") - parser.add_option("-3", "--threePrime", dest="threePrime", action="store", type="int", help="extend towards the 3' end [format: int]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - folder = Fold(options.verbosity) - folder.setInputFileName(options.inputFileName, options.format) - folder.setOutputFileName(options.outputFileName) - folder.setExtensions(options.fivePrime, options.threePrime) - folder.setGenomeFileName(options.genomeFileName) - folder.start() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getDifference.py --- a/smart_toolShed/SMART/Java/Python/getDifference.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,155 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Restrict a transcript list with some parameters (regions)"""\n-\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from commons.core.parsing.FastaParser import FastaParser\n-from SMART.Java.Python.misc.Progress import Progress\n-\n-class DifferenceGetter(object):\n-\n- def __init__(self, verbosity):\n- self.verbosity = verbosity\n- self.annotationParser = None\n- self.referenceParser = None\n- self.sequenceParser = None\n- self.transcriptCount = 1\n- self.split = False\n-\n- def createTranscript(self, chromosome, start, end):\n- transcript = Transcript()\n- transcript.setChromosome(chromosome)\n- transcript.setDirection("+")\n- transcript.setStart(start)\n- transcript.setEnd(end)\n- transcript.setName("region_%d" % self.transcriptCount)\n- transcript.setTagValue("ID", "region_%d" % self.transcriptCount)\n- self.transcriptCount += 1\n- return transcript\n-\n- def setSplit(self, split):\n- self.split = split\n-\n- def setAnnotationFile(self, fileName, format):\n- if fileName != None:\n- self.annotationParser = TranscriptContainer(fileName, format, self.verbosity)\n-\n- def setReferenceFile(self, fileName, format):\n- if fileName != None:\n- self.referenceParser = TranscriptContainer(fileName, format, self.verbosity)\n-\n- def setSequenceFile(self, fileName):\n- if fileName != None:\n- self.sequenceParser = FastaParser(fileName, self.verbosity)\n-\n- def setOutputFile(self, fileName):\n- self.writer = Gff3Writer(fileName, self.verbosity)\n-\n- def initialize(self):\n- self.presence = {}\n- for chromosome in self.sequenceParser.getRegions():\n- self.presence[chromosome] = [[1, self.sequenceParser.getSizeOfRegion(chromosome)]]\n-\n- def readTranscripts(self):\n- nbTranscripts = self.annotationParser.getNbTranscripts()\n- progress = Progress(nbTranscripts, "Parsing annotation file" , self.verbosity)\n- for transcript in self.annotationParser.getIterator():\n- chromosome = transcript.getChromosome()\n- '..b'me]):\n- start, end = element\n- if start <= transcript.getEnd() and transcript.getStart() <= end:\n- toBeDeleted.append(i)\n- if start < transcript.getStart():\n- toBeAppended.append([start, transcript.getStart() - 1])\n- if end > transcript.getEnd():\n- toBeAppended.append([transcript.getEnd() + 1, end])\n- for i in reversed(toBeDeleted):\n- del self.presence[chromosome][i]\n- self.presence[chromosome].extend(toBeAppended)\n- progress.inc()\n- progress.done()\n-\n- def writeOutput(self):\n- for chromosome in self.presence:\n- for element in self.presence[chromosome]:\n- start, end = element\n- self.writer.addTranscript(self.createTranscript(chromosome, start, end))\n- self.writer.write()\n-\n- def compareToSequence(self):\n- self.initialize()\n- self.readTranscripts()\n- self.writeOutput()\n-\n- def compareToAnnotation(self):\n- transcriptListComparator = TranscriptListsComparator(None, self.verbosity)\n- transcriptListComparator.setSplitDifference(self.split)\n- transcriptListComparator.setInputTranscriptContainer(transcriptListComparator.QUERY, self.annotationParser)\n- transcriptListComparator.setInputTranscriptContainer(transcriptListComparator.REFERENCE, self.referenceParser)\n- transcriptListComparator.setOutputWriter(self.writer)\n- transcriptListComparator.getDifferenceTranscriptList()\n-\n- def run(self):\n- if self.referenceParser != None:\n- self.compareToAnnotation()\n- else:\n- self.compareToSequence()\n-\n-\n-if __name__ == "__main__":\n- \n- # parse command line\n- description = "Get Difference v1.0.1: Get all the regions of the genome, except the one given or get all the elements from the first set which does not ovelap with the second set (at the nucleotide level). [Category: Data Comparison]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", default=None, type="string", help="reference file [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", default=None, type="string", help="format of the reference file [format: transcript file format]")\n- parser.add_option("-s", "--sequence", dest="sequenceFileName", action="store", default=None, type="string", help="sequence file [format: file in FASTA format]")\n- parser.add_option("-p", "--split", dest="split", action="store_true", default=False, help="when comparing to a set of genomic coordinates, do not join [format: boolean] [default: False")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n- getter = DifferenceGetter(options.verbosity)\n- getter.setSplit(options.split)\n- getter.setAnnotationFile(options.inputFileName1, options.format1)\n- getter.setSequenceFile(options.sequenceFileName)\n- getter.setReferenceFile(options.inputFileName2, options.format2)\n- getter.setOutputFile(options.outputFileName)\n- getter.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getDistance.py --- a/smart_toolShed/SMART/Java/Python/getDistance.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,241 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Get the distance between the transcripts of two lists"""\n-\n-import os\n-import sys\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-\n-class GetDistance(object):\n-\n- def __init__(self, verbosity = 0):\n- self.verbosity = verbosity\n- self.writer = None\n- self.spearman = False\n- self.tlc = TranscriptListsComparator(None, self.verbosity)\n- self.strands = (0, )\n- self.buckets = None\n- self.title = ""\n- self.xMin = None\n- self.xMax = None\n- self.proportion = False\n- self.outputFileName = None\n- self.keep = False\n-\n- def __del__(self):\n- pass\n-\n- def setQueryFile(self, fileName, format):\n- self.transcriptContainer1 = TranscriptContainer(fileName, format, self.verbosity)\n- \n- def setReferenceFile(self, fileName, format):\n- self.transcriptContainer2 = TranscriptContainer(fileName, format, self.verbosity)\n-\n- def setOutputFile(self, fileName):\n- self.outputFileName = fileName\n- \n- def setOutputTranscriptFile(self, fileName):\n- if fileName != None:\n- self.writer = Gff3Writer(fileName, self.verbosity)\n- \n- def restrictQueryToStart(self, number):\n- self.tlc.restrictToStart(self.tlc.QUERY, number)\n-\n- def restrictReferenceToStart(self, number):\n- self.tlc.restrictToStart(self.tlc.REFERENCE, number)\n-\n- def restrictQueryToEnd(self, number):\n- self.tlc.restrictToEnd(self.tlc.QUERY, number)\n-\n- def restrictReferenceToEnd(self, number):\n- self.tlc.restrictToEnd(self.tlc.REFERENCE, number)\n-\n- def setAbsolute(self, boolean):\n- self.tlc.setAbsolute(boolean)\n-\n- def setProportion(self, boolean):\n- self.proportion = boolean\n-\n- def setColinear(self, boolean):\n- self.tlc.getColinearOnly(boolean)\n-\n- def setAntisense(self, boolean):\n- self.tlc.getAntisenseOnly(boolean)\n-\n- def setDistances(self, minDistance, maxDistance):\n- self.tlc.setMinDistance(minDistance)\n- self.tlc.setMaxDistance(maxDistance)\n-\n- def setStrands(s'..b'"--start2", dest="start2", action="store", default=None, type="int", help="only consider the n first 5\' nucleotides for list 2 [format: int]")\n- parser.add_option("-e", "--end1", dest="end1", action="store", default=None, type="int", help="only consider the n last 3\' nucleotides for list 1 [format: int]")\n- parser.add_option("-E", "--end2", dest="end2", action="store", default=None, type="int", help="only consider the n last 3\' nucleotides for list 2 [format: int]")\n- parser.add_option("-m", "--minDistance", dest="minDistance", action="store", default=None, type="int", help="minimum distance considered between two transcripts [format: int] [default: None]")\n- parser.add_option("-M", "--maxDistance", dest="maxDistance", action="store", default=1000, type="int", help="maximum distance considered between two transcripts [format: int] [default: 1000]")\n- parser.add_option("-5", "--fivePrime", dest="fivePrime", action="store_true", default=False, help="consider the elements from list 1 which are upstream of elements of list 2 [format: bool] [default: False]")\n- parser.add_option("-3", "--threePrime", dest="threePrime", action="store_true", default=False, help="consider the elements from list 1 which are downstream of elements of list 2 [format: bool] [default: False]")\n- parser.add_option("-u", "--buckets", dest="buckets", action="store", default=None, type="int", help="plot histogram instead of line plot with given interval size [format: int] [default: None]")\n- parser.add_option("-2", "--2strands", dest="twoStrands", action="store_true", default=False, help="plot the distributions of each strand separately [format: bool] [default: False]")\n- parser.add_option("-r", "--spearman", dest="spearman", action="store_true", default=False, help="compute Spearman rho [format: bool] [default: False]")\n- parser.add_option("-x", "--xMin", dest="xMin", action="store", default=None, type="int", help="minimum value on the x-axis to plot [format: int] [default: None]")\n- parser.add_option("-X", "--xMax", dest="xMax", action="store", default=None, type="int", help="maximum value on the x-axis to plot [format: int] [default: None]")\n- parser.add_option("-t", "--title", dest="title", action="store", default=None, type="string", help="title for the graph [format: int] [default: None]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- parser.add_option("-k", "--keep", dest="keep", action="store_true", default=False, help="keep temporary files [format: bool]")\n- (options, args) = parser.parse_args()\n-\n- gd = GetDistance(options.verbosity)\n- gd.setQueryFile(options.inputFileName1, options.format1)\n- gd.setReferenceFile(options.inputFileName2, options.format2)\n- gd.setOutputFile(options.outputFileName)\n- gd.setOutputTranscriptFile(options.outputDistances)\n- gd.setColinear(options.colinear)\n- gd.setAntisense(options.antisense)\n- gd.setAbsolute(options.absolute)\n- gd.setProportion(options.proportion)\n- gd.restrictQueryToStart(options.start1)\n- gd.restrictReferenceToStart(options.start2)\n- gd.restrictQueryToEnd(options.end1)\n- gd.restrictReferenceToEnd(options.end2)\n- gd.setDistances(options.minDistance, options.maxDistance)\n- gd.setUpstream(options.fivePrime)\n- gd.setDownstream(options.threePrime)\n- gd.setStrands(options.twoStrands)\n- gd.setBuckets(options.buckets)\n- gd.setTitle(options.title)\n- gd.setXValues(options.xMin, options.xMax)\n- gd.keepTmpValues(options.keep)\n- gd.run()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getDistribution.py --- a/smart_toolShed/SMART/Java/Python/getDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,291 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Get the repartition of some elements in a chromosomes"""\n-\n-import os\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc.Progress import Progress\n-from math import *\n-\n-def divideKeyDict(dictionary, ratio):\n- return dict([(key / ratio, dictionary[key]) for key in dictionary])\n-\n-\n-def setTranscript(chromosome, direction, start, end, name, value):\n- transcript = Transcript()\n- transcript.setChromosome(chromosome)\n- transcript.setDirection(direction)\n- transcript.setStart(start)\n- transcript.setEnd(end)\n- transcript.setName(name)\n- transcript.setTagValue("nbElements", value)\n- return transcript\n-\n-\n-\n-if __name__ == "__main__":\n- \n- magnifyingFactor = 1000\n- \n- # parse command line\n- description = "Get Distribution v1.0.1: Get the distribution of the genomic coordinates on a genome. [Category: Visualization]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]")\n- parser.add_option("-r", "--reference", dest="referenceFileName", action="store", default=None, type="string", help="file containing the genome [compulsory] [format: file in FASTA format]")\n- parser.add_option("-n", "--nbBins", dest="nbBins", action="store", default=1000, type="int", help="number of bins [default: 1000] [format: int]")\n- parser.add_option("-2", "--bothStrands", dest="bothStrands", action="store_true", default=False, help="plot one curve per strand [format: bool] [default: false]")\n- parser.add_option("-w", "--raw", dest="raw", '..b' plotter.addLine(divideKeyDict(densityPlus[chromosome], ratio))\n- if options.raw:\n- plotter.addLine(divideKeyDict(binsMinus[chromosome], ratio))\n- else:\n- plotter.addLine(divideKeyDict(densityMinus[chromosome], ratio))\n- else:\n- if options.raw:\n- plotter.addLine(divideKeyDict(bins[chromosome], ratio))\n- else:\n- plotter.addLine(divideKeyDict(density[chromosome], ratio))\n- plotter.plot()\n- \n- if options.csv:\n- outputFileName = "%s" % (options.outputFileName)\n- if options.chromosome != None:\n- outputFileName += "_%s" % (options.chromosome)\n- if options.start != None and options.end != None:\n- outputFileName += ":%d-%d" % (options.start, options.end)\n- outputFileName += ".csv"\n- csvHandle = open(outputFileName, "w")\n- for slice in range(start / sliceSize, maxSlice + 1):\n- csvHandle.write(";%d-%d" % (slice * sliceSize + 1, (slice+1) * sliceSize))\n- csvHandle.write("\\n")\n- if options.bothStrands:\n- for chromosome in densityPlus:\n- if len(densityPlus[chromosome]) > 0:\n- csvHandle.write("%s [+]" % (chromosome))\n- for slice in sorted(densityPlus[chromosome].keys()):\n- csvHandle.write(";%.2f" % (densityPlus[chromosome][slice]))\n- csvHandle.write("\\n") \n- if len(densityMinus[chromosome]) > 0:\n- csvHandle.write("%s [-]" % (chromosome))\n- for slice in sorted(densityPlus[chromosome].keys()):\n- csvHandle.write(";%.2f" % (-densityMinus[chromosome][slice]))\n- csvHandle.write("\\n") \n- else:\n- for chromosome in density:\n- if len(density[chromosome]) > 0:\n- csvHandle.write(chromosome)\n- for slice in sorted(density[chromosome].keys()):\n- csvHandle.write(";%.2f" % (density[chromosome][slice]))\n- csvHandle.write("\\n")\n- csvHandle.close()\n- \n- if options.gff:\n- chromosome = "" if options.chromosome == None else options.chromosome.capitalize()\n- start = "" if options.start == None else "%d" % (options.start)\n- end = "" if options.end == None else "%d" % (options.end)\n- link1 = "" if options.start == None and options.end == None else ":"\n- link2 = "" if options.start == None and options.end == None else "-"\n- writer = Gff3Writer("%s%s%s%s%s.gff3" % (options.outputFileName, link1, start, link2, end), options.verbosity)\n- cpt = 1\n- if options.raw:\n- valuesPlus = binsPlus\n- valuesMinus = binsMinus\n- values = bins\n- else:\n- valuesPlus = densityPlus\n- valuesMinus = densityMinus\n- values = density\n- if options.bothStrands:\n- for chromosome in values:\n- for slice in valuesPlus[chromosome]:\n- writer.addTranscript(setTranscript(chromosome, 1, slice, slice + sliceSize, "region%d" % (cpt), valuesPlus[chromosome][slice]))\n- cpt += 1\n- for slice in valuesMinus[chromosome]:\n- writer.addTranscript(setTranscript(chromosome, -1, slice, slice + sliceSize, "region%d" % (cpt), - valuesMinus[chromosome][slice]))\n- cpt += 1\n- else:\n- for chromosome in values:\n- for slice in values[chromosome]:\n- writer.addTranscript(setTranscript(chromosome, 1, slice, slice + sliceSize, "region%d" % (cpt), values[chromosome][slice]))\n- cpt += 1\n- writer.write()\n-\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getElement.py --- a/smart_toolShed/SMART/Java/Python/getElement.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,106 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Get the first element (exon / intron) from a list of transcripts""" - -import os -from optparse import OptionParser -from commons.core.writer.Gff3Writer import * -from SMART.Java.Python.structure.TranscriptContainer import * -from SMART.Java.Python.misc.Progress import * - - -if __name__ == "__main__": - - # parse command line - description = "Get Element v1.0.1: Get the first element (exon / intron) from a list of transcripts. [Category: Personnal]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-y", "--mysql", dest="mysql", action="store_true", default=False, help="mySQL output [format: bool] [default: false]") - parser.add_option("-t", "--type", dest="type", action="store", type="string", help="type of the element [format: choice (exon, intron)]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") - (options, args) = parser.parse_args() - - parser = TranscriptContainer(options.inputFileName, options.format, options.verbosity) - writer = Gff3Writer(options.outputFileName, options.verbosity) - sqlWriter = MySqlTranscriptWriter(options.outputFileName, options.verbosity) - - nbLines = parser.getNbTranscripts() - print "%i lines found" % (nbLines) - - # treat transcripts - nbWritten = 0 - nbUsed = 0 - progress = Progress(nbLines, "Analyzing transcripts of " + options.inputFileName, options.verbosity) - for transcript in parser.getIterator(): - - outTranscript = Transcript() - outTranscript.setName(transcript.getName()) - outTranscript.setDirection(transcript.getDirection()) - outTranscript.setChromosome(transcript.getChromosome()) - - if options.type == "exon": - if len(transcript.getExons()) > 1: - transcript.sortExons() - outTranscript.setStart(transcript.getExons()[0].getStart()) - outTranscript.setEnd(transcript.getExons()[0].getEnd()) - writer.addTranscript(outTranscript) - if options.mysql: - sqlWriter.addTranscript(transcript) - nbWritten += 1 - nbUsed += 1 - elif options.type == "intron": - used = False - for intron in transcript.getIntrons(): - used = True - thisTranscript = Transcript() - thisTranscript.copy(outTranscript) - thisTranscript.setStart(intron.getStart()) - thisTranscript.setEnd(intron.getEnd()) - writer.addTranscript(thisTranscript) - if options.mysql: - sqlWriter.addTranscript(transcript) - nbWritten += 1 - if used: - nbUsed += 1 - else: - sys.exit("Cannot understan type %s" % (options.type)) - progress.inc() - progress.done() - - if options.mysql: - sqlWriter.write() - - print "nb sequences used: %d" % (nbUsed) - print "nb elements used: %d" % (nbWritten) |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getExons.py --- a/smart_toolShed/SMART/Java/Python/getExons.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,128 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -from optparse import OptionParser -from commons.core.parsing.ParserChooser import ParserChooser -from commons.core.writer.TranscriptWriter import TranscriptWriter -from SMART.Java.Python.structure.Transcript import Transcript -from SMART.Java.Python.misc.Progress import Progress - -zeroBaseToOneBaseConvertor = (lambda x: x - 1 if x > 0 else x) - -class GetExons(object): - - def __init__(self, verbosity): - self.verbosity = verbosity - self.selection = False - - def setInputFile(self, fileName, format): - chooser = ParserChooser(self.verbosity) - chooser.findFormat(format) - self.parser = chooser.getParser(fileName) - - def setSelection(self, selection): - if selection == None: - return - self.selection = True - self.selectionItems = [] - self.selectionIntervals = [] - for part in selection.split(","): - try: - splittedPart = map(int, part.split("..")) - except Exception: - raise Exception("Elements '" + splittedPart + "' of selection '" + selection + "' do no seem to be integers!") - if len(splittedPart) == 1: - self.selectionItems.append(splittedPart[0]) - elif len(splittedPart) == 2: - self.selectionIntervals.append((splittedPart[0], splittedPart[1])) - else: - raise Exception("Cannot parse elements '" + splittedPart + "' of selection '" + selection + "'!") - - def getSelectionExonIndices(self, nbExons): - if not self.selection: - return range(nbExons) - indices = [] - for item in self.selectionItems: - indices.append(range(nbExons)[zeroBaseToOneBaseConvertor(item)]) - for start, end in self.selectionIntervals: - start, end = map(zeroBaseToOneBaseConvertor, (start, end)) - if end > 0: - end += 1 - indices.extend(range(nbExons)[start:end]) - return indices - - def setOutputFile(self, fileName): - self.writer = TranscriptWriter(fileName, "gff3", self.verbosity) - - def run(self): - progress = Progress(self.parser.getNbTranscripts(), "Reading input file", self.verbosity) - nbExons = 0 - for cpt1, transcript in enumerate(self.parser.getIterator()): - selectedExons = self.getSelectionExonIndices(transcript.getNbExons()) - transcript.sortExons() - for cpt2, exon in enumerate(transcript.getExons()): - if cpt2 not in selectedExons: - continue - exonTranscript = Transcript() - exonTranscript.copy(exon) - if "Parent" in exonTranscript.tags: - del exonTranscript.tags["Parent"] - exonTranscript.tags["feature"] = "transcript" - if "ID" not in exonTranscript.tags or exonTranscript.tags["ID"] == "unnamed transcript": - exonTranscript.tags["ID"] = "exon_%d-%d" % (cpt1+1, cpt2+1) - if exonTranscript.getName() == "unnamed transcript": - exonTranscript.setName("exon_%d-%d" % (cpt1+1, cpt2+1)) - self.writer.addTranscript(exonTranscript) - nbExons += 1 - progress.inc() - self.writer.write() - self.writer.close() - progress.done() - if self.verbosity > 1: - print "%d transcripts read" % (self.parser.getNbTranscripts()) - print "%d exons written" % (nbExons) - -if __name__ == "__main__": - - description = "Get Exons v1.0.1: Get the exons of a set of transcripts. [Category: Data Modification]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-s", "--select", dest="select", action="store", default=None, type="string", help="select some of the exons (like '1,2,5..-3,-1') [format: string]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - ge = GetExons(options.verbosity) - ge.setInputFile(options.inputFileName, options.format) - ge.setSelection(options.select) - ge.setOutputFile(options.outputFileName) - ge.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getInfoPerCoverage.py --- a/smart_toolShed/SMART/Java/Python/getInfoPerCoverage.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,167 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Compare overlap of a transcript list and list of read, and get some info depending on the coverage"""\n-\n-import os\n-from optparse import OptionParser\n-from commons.core.parsing.SequenceListParser import *\n-from commons.core.writer.Gff3Writer import *\n-from SMART.Java.Python.mySql.MySqlConnection import *\n-from SMART.Java.Python.structure.TranscriptListsComparator import *\n-from SMART.Java.Python.misc.RPlotter import *\n-from SMART.Java.Python.misc.Progress import *\n-\n-\n-if __name__ == "__main__":\n- \n- # parse command line\n- description = "Get Info per Coverage v1.0.1: Get a list of information clustered by the density of the coverage on a genome. [Category: Personnal]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file 1 [compulsory] [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of file 1 [compulsory] [format: transcript file format]")\n- parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]")\n- parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of file 2 [compulsory] [format: transcript file format]")\n- parser.add_option("-o", "--output", dest="output", action="store", default=None, type="string", help="output file [compulsory] [format: output file in TXT format]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- parser.add_option("-l", "--log", dest="log", action="store", default=None, type="string", help="write a log file [format: bool] [default: false]")\n- (options, args) = parser.parse_args()\n-\n- logHandle = None\n- if options.log != None:\n- logHandle = open(options.log, "w")\n- '..b'script.name]\n- else:\n- averageSizesWithoutIntrons[transcript.getSize()] += coverages[transcript.name]\n- if transcript.getSize() not in sumSizesWithoutIntrons:\n- sumSizesWithoutIntrons[transcript.getSize()] = 1\n- else:\n- sumSizesWithoutIntrons[transcript.getSize()] += 1\n- if transcript.getNbExons() not in averageNbExons:\n- averageNbExons[transcript.getNbExons()] = coverages[transcript.name]\n- else:\n- averageNbExons[transcript.getNbExons()] += coverages[transcript.name]\n- if transcript.getNbExons() not in sumSizesNbExons:\n- sumSizesNbExons[transcript.getNbExons()] = 1\n- else:\n- sumSizesNbExons[transcript.getNbExons()] += 1\n- sizesWithIntrons[transcript.name] = (transcript.getSizeWithIntrons(), coverages[transcript.name])\n- sizesWithoutIntrons[transcript.name] = (transcript.getSize(), coverages[transcript.name])\n- nbExons[transcript.name] = (transcript.getNbExons(), coverages[transcript.name])\n- progress.inc()\n- progress.done()\n- \n- plotterSizeWithIntrons = RPlotter("%sWithIntrons.png" % (options.output), options.verbosity)\n- plotterSizeWithIntrons.setPoints(True)\n- plotterSizeWithIntrons.setMaximumX(10000)\n- plotterSizeWithIntrons.setMaximumY(1000) \n- plotterSizeWithIntrons.setLog("y")\n- plotterSizeWithIntrons.addLine(sizesWithIntrons)\n- plotterSizeWithIntrons.plot()\n- \n- plotterSizeWithoutIntrons = RPlotter("%sWithoutIntrons.png" % (options.output), options.verbosity)\n- plotterSizeWithoutIntrons.setPoints(True)\n- plotterSizeWithoutIntrons.setMaximumX(10000) \n- plotterSizeWithoutIntrons.setMaximumY(1000)\n- plotterSizeWithoutIntrons.setLog("y")\n- plotterSizeWithoutIntrons.addLine(sizesWithoutIntrons)\n- plotterSizeWithoutIntrons.plot()\n- \n- plotterNbExons = RPlotter("%sNbExons.png" % (options.output), options.verbosity)\n- plotterNbExons.setPoints(True)\n- plotterNbExons.addLine(nbExons)\n- plotterNbExons.plot()\n- \n- for element in averageSizesWithIntrons:\n- averageSizesWithIntrons[element] = int(float(averageSizesWithIntrons[element]) / sumSizesWithIntrons[element])\n- plotterAverageSizeWithIntrons = RPlotter("%sAverageWithIntrons.png" % (options.output), options.verbosity)\n- plotterAverageSizeWithIntrons.setMaximumX(10000)\n- plotterAverageSizeWithIntrons.setMaximumY(1000) \n- plotterAverageSizeWithIntrons.setLog("y")\n- plotterAverageSizeWithIntrons.addLine(averageSizesWithIntrons)\n- plotterAverageSizeWithIntrons.plot()\n- print "min/avg/med/max sizes with introns: %d/%.2f/%.1f/%d" % Utils.getMinAvgMedMax(averageSizesWithIntrons)\n-\n- for element in averageSizesWithoutIntrons:\n- averageSizesWithoutIntrons[element] = int(float(averageSizesWithoutIntrons[element]) / sumSizesWithoutIntrons[element])\n- plotterAverageSizeWithoutIntrons = RPlotter("%sAverageWithoutIntrons.png" % (options.output), options.verbosity)\n- plotterAverageSizeWithoutIntrons.setMaximumX(10000)\n- plotterAverageSizeWithoutIntrons.setMaximumY(1000) \n- plotterAverageSizeWithoutIntrons.setLog("y")\n- plotterAverageSizeWithoutIntrons.addLine(averageSizesWithoutIntrons)\n- plotterAverageSizeWithoutIntrons.plot()\n- print "min/avg/med/max sizes without introns: %d/%.2f/%.1f/%d" % Utils.getMinAvgMedMax(averageSizesWithoutIntrons)\n-\n- for element in averageNbExons:\n- averageNbExons[element] = int(float(averageNbExons[element]) / sumSizesNbExons[element])\n- plotterAverageNbExons = RPlotter("%sAverageNbExons.png" % (options.output), options.verbosity)\n- plotterAverageNbExons.addLine(averageNbExons)\n- plotterAverageNbExons.plot()\n- print "min/avg/med/max # exons: %d/%.2f/%.1f/%d" % Utils.getMinAvgMedMax(averageNbExons)\n-\n- if options.log:\n- logHandle.close()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getIntrons.py --- a/smart_toolShed/SMART/Java/Python/getIntrons.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,89 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -from optparse import OptionParser -from commons.core.parsing.ParserChooser import ParserChooser -from commons.core.writer.TranscriptWriter import TranscriptWriter -from SMART.Java.Python.structure.Transcript import Transcript -from SMART.Java.Python.misc.Progress import Progress - -class GetIntrons(object): - - def __init__(self, verbosity): - self.verbosity = verbosity - - def setInputFile(self, fileName, format): - chooser = ParserChooser(self.verbosity) - chooser.findFormat(format) - self.parser = chooser.getParser(fileName) - - def setOutputFile(self, fileName): - self.writer = TranscriptWriter(fileName, "gff3", self.verbosity) - - def run(self): - progress = Progress(self.parser.getNbTranscripts(), "Reading input file", self.verbosity) - nbIntrons = 0 - for cpt1, transcript in enumerate(self.parser.getIterator()): - for cpt2, intron in enumerate(transcript.getIntrons()): - intronTranscript = Transcript() - intronTranscript.copy(intron) - if "Parent" in intronTranscript.tags: - del intronTranscript.tags["Parent"] - intronTranscript.tags["feature"] = "transcript" - if "ID" not in intronTranscript.tags or intronTranscript.tags["ID"] == "unnamed transcript": - intronTranscript.tags["ID"] = "intron_%d-%d" % (cpt1+1, cpt2+1) - if intronTranscript.getName() == "unnamed transcript": - intronTranscript.setName("intron_%d-%d" % (cpt1+1, cpt2+1)) - self.writer.addTranscript(intronTranscript) - nbIntrons += 1 - progress.inc() - self.writer.write() - self.writer.close() - progress.done() - if self.verbosity > 1: - print "%d transcripts read" % (self.parser.getNbTranscripts()) - print "%d introns written" % (nbIntrons) - - -if __name__ == "__main__": - - description = "Get Introns v1.0.1: Get the introns of a set of transcripts. [Category: Data Modification]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - gi = GetIntrons(options.verbosity) - gi.setInputFile(options.inputFileName, options.format) - gi.setOutputFile(options.outputFileName) - gi.run() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getLetterDistribution.py --- a/smart_toolShed/SMART/Java/Python/getLetterDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,153 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Get the size distribution of a Fasta / BED file""" - -import os -from optparse import OptionParser -from commons.core.parsing.FastaParser import * -from SMART.Java.Python.misc.Progress import * -from SMART.Java.Python.misc.RPlotter import * -from commons.core.parsing.ParserChooser import ParserChooser - - -def writeCVSfile(outHandler): - for pos in range(len(letters)): - posTrue = pos +1 - outHandler.write( "%s;" % (posTrue)) - for letter in lettersRate: - if positionRate[letter].has_key(pos): - outHandler.write("%s=%.2f%s;" %(letter, positionRate[letter][pos], "%")) - else: - outHandler.write("%s=0%s;" % (letter, "%")) - outHandler.write("\n") - -if __name__ == "__main__": - - # parse command line - description = "Get Letter Distribution v1.0.1: Compute the distribution of nucleotides of a set of genomic coordinates. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file to be analyzed [compulsory] [format: file in sequence format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [format: sequence file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in PNG format]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - parser.add_option("-c", "--csv", dest="csv", action="store_true", default=False, help="write a .csv file [format: bool] [default: false]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") - (options, args) = parser.parse_args() - - chooser = ParserChooser() - chooser.findFormat(options.format) - parser = chooser.getParser(options.inputFileName) - nbSequences = parser.getNbSequences() - print "%i sequences read" % (nbSequences) - - # treat items - progress = Progress(nbSequences, "Analyzing sequences of " + options.inputFileName, options.verbosity) - nbLettersTotal = 0 - nbLetters = {} - lettersRate = {} - nbPositions = {} - positionCount = {} - positionRate = {} - nbPositionRate = {} - for sequence in parser.getIterator(): - letters = sequence.getSequence() - thisNbLettersTotal = sequence.getSize() - nbLettersTotal += thisNbLettersTotal - thisNbLetters = {} - - for pos in range(len(letters)): - letter = letters[pos] - if letter not in thisNbLetters: - thisNbLetters[letter] = 1 - else: - thisNbLetters[letter] += 1 - if pos+1 not in nbPositions: - nbPositions[pos+1] = 1 - else: - nbPositions[pos+1] += 1 - if letter not in positionCount: - positionCount[letter] = {} - if pos+1 not in positionCount[letter]: - positionCount[letter][pos+1] = 1 - else: - positionCount[letter][pos+1] += 1 - - for letter in thisNbLetters: - if letter not in nbLetters: - nbLetters[letter] = thisNbLetters[letter] - else: - nbLetters[letter] += thisNbLetters[letter] - if letter not in lettersRate: - lettersRate[letter] = {} - rate = int(float(thisNbLetters[letter]) / thisNbLettersTotal * 100) - if rate not in lettersRate[letter]: - lettersRate[letter][rate] = 1 - else: - lettersRate[letter][rate] += 1 - progress.inc() - progress.done() - - for letter in positionCount: - positionRate[letter] = {} - for pos in positionCount[letter]: - positionRate[letter][pos] = positionCount[letter][pos] / float(nbPositions[pos]) * 100 - for pos in nbPositions: - nbPositionRate[pos] = nbPositions[pos] / float(nbPositions[1]) * 100 - - # plot content distributions - plotter = RPlotter("%s.png" % (options.outputFileName), options.verbosity, True) - plotter.setFill(0) - plotter.setLegend(True) - for letter in lettersRate: - plotter.addLine(lettersRate[letter], letter) - plotter.plot() - - # plot distribution per position - plotter = RPlotter("%sPerNt.png" % (options.outputFileName), options.verbosity, True) - plotter.setFill(0) - plotter.setLegend(True) - plotter.setXLabel("Position on the read") - plotter.setYLabel("Percentage") - for letter in positionRate: - plotter.addLine(positionRate[letter], letter) - plotter.addLine(nbPositionRate, "#") - plotter.plot() - - if options.csv: - outHandler = open("%s.csv" % (options.outputFileName), "w") - writeCVSfile(outHandler) - outHandler.close() - - print "%d sequences" % (nbSequences) - print "%d letters" % (nbLettersTotal) - for letter in nbLetters: - print "%s: %d (%.2f%%)" % (letter, nbLetters[letter], float(nbLetters[letter]) / nbLettersTotal * 100) |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getNb.py --- a/smart_toolShed/SMART/Java/Python/getNb.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,99 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Get the repartition of some elements (# exons per transcripts, # of repetitions of a mapping or # of transcripts in a cluster)""" - -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.RPlotter import RPlotter -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc import Utils -from math import * - -if __name__ == "__main__": - - # parse command line - description = "Get Nb v1.0.1: Get the distribution of exons per transcripts, or mapping per read, or transcript per cluster. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in png format]") - parser.add_option("-q", "--query", dest="query", action="store", type="string", help="query [compulsory] (# exons, # transcripts) [format: choice (exon, transcript, cluster)]") - parser.add_option("-b", "--barplot", dest="barplot", action="store_true", default=False, help="use barplot representation [format: bool] [default: false]") - parser.add_option("-x", "--xMax", dest="xMax", action="store", default=None, type="int", help="maximum value on the x-axis to plot [format: int]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]") - (options, args) = parser.parse_args() - - if options.query != "exon" and options.query != "transcript" and options.query != "cluster": - raise Exception("Do not understand query %s" % (options.query)) - - exonDistribution = {} - transcriptDistribution = {} - clusterDistribution = {} - - transcriptContainer = TranscriptContainer(options.inputFileName, options.format, options.verbosity) - - progress = Progress(transcriptContainer.getNbTranscripts(), "Parsing %s" % (options.inputFileName), options.verbosity) - # count the number of reads - for element in transcriptContainer.getIterator(): - if options.query == "exon": - nbExons = element.getNbExons() - exonDistribution[nbExons] = exonDistribution.get(nbExons, 0) + 1 - elif options.query == "transcript": - name = element.getName() - transcriptDistribution[name] = transcriptDistribution.get(name, 0) + 1 - elif options.query == "cluster": - nbElements = 1 if "nbElements" not in element.getTagNames() else element.getTagValue("nbElements") - clusterDistribution[nbElements] = clusterDistribution.get(nbElements, 0) + 1 - progress.inc() - progress.done() - - if options.query == "exon": - distribution = exonDistribution - elif options.query == "transcript": - distribution = {} - for name in transcriptDistribution: - distribution[transcriptDistribution[name]] = distribution.get(transcriptDistribution[name], 0) + 1 - elif options.query == "cluster": - distribution = clusterDistribution - - outputFileName = options.outputFileName - plotter = RPlotter(outputFileName, options.verbosity) - plotter.setImageSize(1000, 300) - plotter.setFill(0) - plotter.setMaximumX(options.xMax) - plotter.setBarplot(options.barplot) - plotter.addLine(distribution) - plotter.plot() - - print "min/avg/med/max: %d/%.2f/%.1f/%d" % (Utils.getMinAvgMedMax(distribution)) - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getRandomRegions.py --- a/smart_toolShed/SMART/Java/Python/getRandomRegions.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,267 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""Find random regions in a genome"""\n-\n-import random, math\n-from optparse import OptionParser\n-from commons.core.parsing.FastaParser import *\n-from commons.core.writer.Gff3Writer import *\n-from commons.core.writer.MySqlTranscriptWriter import *\n-from SMART.Java.Python.misc.Progress import *\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-\n-repetitions = 100\n-\n-\n-class RandomRegionsGenerator(object):\n-\n- def __init__(self, verbosity):\n- self.verbosity = verbosity\n- self.strands = False\n- self.distribution = "uniform"\n- self.transcripts = None\n- self.sequenceParser = None\n- random.seed()\n-\n-\n- def setInput(self, fileName):\n- self.sequenceParser = FastaParser(fileName, self.verbosity)\n-\n-\n- def setGenomeSize(self, size):\n- self.genomeSize = size\n-\n-\n- def setChromosomeName(self, name):\n- self.chromosomeName = name\n-\n-\n- def setAnnotation(self, fileName, format):\n- parser = TranscriptContainer(fileName, format, self.verbosity)\n- self.transcripts = []\n- for transcript in parser.getIterator():\n- self.transcripts.append(transcript)\n- self.setNumber(len(self.transcripts))\n- self.setSize(0)\n-\n-\n- def setOutputFile(self, fileName):\n- self.outputFileName = fileName\n-\n-\n- def setSize(self, size):\n- self.minSize = size\n- self.maxSize = size\n-\n-\n- def setMinSize(self, size):\n- self.minSize = size\n-\n-\n- def setMaxSize(self, size):\n- self.maxSize = size\n-\n-\n- def setNumber(self, number):\n- self.number = number\n-\n-\n- def setStrands(self, strands):\n- self.strands = strands\n-\n-\n- def setMaxDistribution(self, maxElements):\n- if maxElements == None:\n- return\n- self.maxElements = maxElements\n- self.distribution = "gaussian"\n-\n-\n- def setDeviationDistribution(self, deviation):\n- if deviation == None:\n- return\n- self.deviation = deviation\n- self.distribution = "gaussian"\n-\n-\n- def getSizes(self):\n- if self.sequenceParser == None:\n- self.chromosomes = [self.chromosomeName]\n- self.sizes = {self.chromosomeName: self.genomeSize}\n- self.cumulatedSize = self.genomeSize\n- self.cumulatedSizes = {'..b'n(self):\n- self.getSizes()\n- self.writeRegions()\n-\n-\n-if __name__ == "__main__":\n- \n- # parse command line\n- description = "Get Random Regions v1.0.2: Get some random coordinates on a genome. May use uniform or gaussian distribution (in gaussion distribution, # of element per cluster follows a power law). [Category: Other]"\n-\n- parser = OptionParser(description = description)\n- parser.add_option("-r", "--reference", dest="reference", action="store", default=None, type="string", help="file that contains the sequences [format: file in FASTA format]")\n- parser.add_option("-S", "--referenceSize", dest="referenceSize", action="store", default=None, type="int", help="size of the chromosome (when no reference is given) [format: int]")\n- parser.add_option("-c", "--chromosome", dest="chromosome", action="store", default=None, type="string", help="name of the chromosome (when no reference is given) [format: string]")\n- parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in FASTA format]")\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", default=None, type="string", help="optional file containing regions to shuffle [format: file in transcript format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", default=None, type="string", help="format of the previous file [format: transcript file format]")\n- parser.add_option("-s", "--size", dest="size", action="store", default=None, type="int", help="size of the regions (if no region set is provided) [format: int]")\n- parser.add_option("-z", "--minSize", dest="minSize", action="store", default=None, type="int", help="minimum size of the regions (if no region set nor a fixed size are provided) [format: int]")\n- parser.add_option("-Z", "--maxSize", dest="maxSize", action="store", default=None, type="int", help="maximum size of the regions (if no region set nor a fixed size are provided) [format: int]")\n- parser.add_option("-n", "--number", dest="number", action="store", default=None, type="int", help="number of regions (if no region set is provided) [format: int]")\n- parser.add_option("-t", "--strands", dest="strands", action="store_true", default=False, help="use both strands (if no region set is provided) [format: boolean]")\n- parser.add_option("-m", "--max", dest="max", action="store", default=None, type="int", help="max. # reads in a cluster (for Gaussian dist.) [format: int]")\n- parser.add_option("-d", "--deviation", dest="deviation", action="store", default=None, type="int", help="deviation around the center of the cluster (for Gaussian dist.) [format: int]")\n- parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]")\n- (options, args) = parser.parse_args()\n-\n- rrg = RandomRegionsGenerator(options.verbosity)\n- if options.reference == None:\n- rrg.setGenomeSize(options.referenceSize)\n- rrg.setChromosomeName(options.chromosome)\n- else:\n- rrg.setInput(options.reference)\n- rrg.setOutputFile(options.outputFileName)\n- if options.inputFileName == None:\n- if options.size != None:\n- rrg.setSize(options.size)\n- else:\n- rrg.setMinSize(options.minSize)\n- rrg.setMaxSize(options.maxSize)\n- rrg.setNumber(options.number)\n- rrg.setStrands(options.strands)\n- else:\n- rrg.setAnnotation(options.inputFileName, options.format)\n- rrg.setMaxDistribution(options.max)\n- rrg.setDeviationDistribution(options.deviation)\n- rrg.run()\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getReadDistribution.py --- a/smart_toolShed/SMART/Java/Python/getReadDistribution.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,129 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Plot the data from the data files -""" -import os -from optparse import OptionParser -from commons.core.parsing.FastaParser import FastaParser -from commons.core.parsing.FastqParser import FastqParser -from SMART.Java.Python.misc.RPlotter import RPlotter -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc import Utils - - -if __name__ == "__main__": - - # parse command line - description = "Get Read Distribution v1.0.1: Plot the number of identical reads and give the most represented. [Category: Visualization]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file sequence [compulsory] [format: file in sequence format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of the file [compulsory] [format: sequence file format]") - parser.add_option("-n", "--number", dest="number", action="store", default=None, type="int", help="keep the best n [format: int]") - parser.add_option("-p", "--percent", dest="percent", action="store", default=None, type="float", help="keep the best n\% [format: float]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output files in PNG format and txt format]") - parser.add_option("-x", "--xMax", dest="xMax", action="store", default=None, type="int", help="maximum value on the x-axis to plot [format: int]") - parser.add_option("-D", "--directory", dest="working_Dir", action="store", default=os.getcwd(), type="string", help="the directory to store the results [format: directory]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - if options.working_Dir[-1] != '/': - options.outputFileName = options.working_Dir + '/' + options.outputFileName - - if options.format == "fasta": - parser = FastaParser(options.inputFileName, options.verbosity) - elif options.format == "fastq": - parser = FastqParser(options.inputFileName, options.verbosity) - else: - raise Exception("Do not understand '%s' file format." % (options.format)) - - progress = Progress(parser.getNbSequences(), "Reading %s" % (options.inputFileName), options.verbosity) - sequences = {} - for sequence in parser.getIterator(): - sequence = sequence.sequence - if sequence not in sequences: - sequences[sequence] = 1 - else: - sequences[sequence] += 1 - progress.inc() - progress.done() - - values = sequences.values() - values.sort() - if options.percent != None: - threshold = values[int(float(options.percent) / 100 * len(values))] - elif options.number != None: - threshold = values[-options.number] - else: - threshold = 0 - - # sort by value - progress = Progress(parser.getNbSequences(), "Sorting values", options.verbosity) - sortedValues = dict([(value, []) for value in sequences.values()]) - for sequence, value in sequences.iteritems(): - sortedValues[value].append(sequence) - progress.inc() - progress.done() - - outputFileName = "%s.txt" % (options.outputFileName) - handle = open(outputFileName, "w") - progress = Progress(parser.getNbSequences(), "Writing into %s" % (outputFileName), options.verbosity) - for value in reversed(sorted(sortedValues.keys())): - if value >= threshold: - for sequence in sortedValues[value]: - handle.write("%s\t%d\n" % (sequence, value)) - progress.inc() - progress.done() - handle.close() - - line = {} - progress = Progress(len(values), "Preparing plot", options.verbosity) - for value in values: - if value not in line: - line[value] = 1 - else: - line[value] += 1 - progress.inc() - progress.done() - - plot = RPlotter("%s.png" % (options.outputFileName), options.verbosity) - plot.setFill(0) - plot.setMaximumX(options.xMax) - plot.setXLabel("# occurrences") - plot.setYLabel("# reads") - plot.addLine(line) - plot.plot() - - if options.verbosity > 0: - print "%d/%.2f/%.1f/%d occurrences" % (Utils.getMinAvgMedMax(line)) - - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getSequence.py --- a/smart_toolShed/SMART/Java/Python/getSequence.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,60 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -"""Get a given sequence in a multi-Fasta file""" -import sys -from optparse import OptionParser -from commons.core.parsing.FastaParser import FastaParser -from SMART.Java.Python.misc.Progress import Progress -from commons.core.writer.FastaWriter import FastaWriter - -if __name__ == "__main__": - - # parse command line - description = "Get Sequence v1.0.1: Get a single sequence in a FASTA file. [Category: Data Selection]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName",action="store",type="string", help="multi-FASTA file [compulsory] [format: file in FASTA format]") - parser.add_option("-n", "--name",dest="name",action="store",type="string", help="name of the sequence [compulsory] [format: string]") - parser.add_option("-o", "--output",dest="outputFileName",action="store",type="string", help="output sequence file (FASTA) [compulsory] [format: file in FASTA format]") - parser.add_option("-v", "--verbosity", dest="verbosity",action="store",default=1,type="int",help="trace level [format: int]") - (options, args) = parser.parse_args() - - # read Fasta file - sequenceListParser = FastaParser(options.inputFileName, options.verbosity) - for sequence in sequenceListParser.getIterator(): - name = sequence.name.split(" ")[0] - if name == options.name: - writer = FastaWriter(options.outputFileName, options.verbosity) - writer.addSequence(sequence) - print sequence.printFasta(), - sys.exit(0) - writer.close() - print "No sequence found" |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getSizes.py --- a/smart_toolShed/SMART/Java/Python/getSizes.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,238 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os, sys\n-from optparse import OptionParser\n-from commons.core.parsing.FastaParser import FastaParser\n-from commons.core.parsing.FastqParser import FastqParser\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from commons.core.parsing.GffParser import GffParser\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc import Utils\n-\n-from commons.core.LoggerFactory import LoggerFactory\n-from commons.core.utils.RepetOptionParser import RepetOptionParser\n-\n-LOG_DEPTH = "smart"\n-\n-class GetSizes(object):\n- \n- def __init__(self, inFileName = None, inFormat=None, outFileName = None, query=None,xMax=None, xMin=None, csv=False, verbosity = 0):\n- self.inFileName = inFileName\n- self.inFormat= inFormat\n- self.outFileName = outFileName\n- self.query = query\n- self.xMax = xMax\n- self.xMin = xMin\n- self.xLab = "Size"\n- self.yLab = "# reads"\n- self.barplot = False\n- self.csv = csv\n- self._verbosity = verbosity\n- self.parser = None\n- self._log = LoggerFactory.createLogger("%s.%s" % (LOG_DEPTH, self.__class__.__name__), self._verbosity)\n- \n- def setAttributesFromCmdLine(self):\n- description = "Usage: getSizes.py [options]\\n\\nGet Sizes v1.0.2: Get the sizes of a set of genomic coordinates. [Category: Visualization]\\n"\n- epilog = ""\n- parser = RepetOptionParser(description = description, epilog = epilog)\n- parser.add_option("-i", "--input", dest="inputFileName", action="store", default=None, type="string", help="input file [compulsory] [format: file in transcript or sequence format given by -f]")\n- parser.add_option("-f", "--format", dest="format", action="store", default=None, type="string", help="format of the input [compulsory] [format: transcript or sequence file format]")\n- parser.add_option("-q", "--query", dest="query", action="store", default=None, type="string", help="type to mesure [default: size] [format: choice (size, intron size, exon size, 1st exon size)]") \n- parser.add_option("-o", "--output", dest="outputFileName", action="store", default=None, type="string", help="output file [format: output file in PNG format]")\n- parser.add_option("-x", "--xMax", dest="x'..b'nFileName, self._verbosity)\n- elif self.inFormat == "fastq":\n- self.parser = FastqParser(self.inFileName, self._verbosity)\n- else:\n- self.parser = TranscriptContainer(self.inFileName, self.inFormat, self._verbosity)\n- \n- def _logAndRaise(self, errorMsg):\n- self._log.error(errorMsg)\n- raise Exception(errorMsg)\n- \n- def run(self):\n- LoggerFactory.setLevel(self._log, self._verbosity)\n- self._checkOptions()\n- self._log.info("START getsizes")\n- self._log.debug("Input file name: %s" % self.inFileName)\n-\n- nbItems = self.parser.getNbItems()\n- self._log.info( "%i items found" % (nbItems))\n- \n- # treat items\n- progress = Progress(nbItems, "Analyzing sequences of %s" % (self.inFileName), self._verbosity)\n- sizes = {}\n- names = {}\n- minimum = 1000000000000\n- maximum = 0\n- sum = 0\n- number = 0\n- nbSubItems = 0\n- for item in self.parser.getIterator():\n- items = []\n- if self.query == "exon":\n- items = item.getExons()\n- elif self.query == "exon1":\n- if len(item.getExons()) > 1:\n- item.sortExons()\n- items = [item.getExons()[0]]\n- elif self.query == "intron":\n- items = item.getIntrons()\n- else:\n- items = [item, ]\n- \n- for thisItem in items:\n- try:\n- nbElements = int(float(thisItem.getTagValue("nbElements")))\n- if nbElements == None:\n- nbElements = 1\n- except:\n- nbElements = 1\n- size = thisItem.getSize()\n- minimum = min(minimum, size)\n- maximum = max(maximum, size)\n- name = thisItem.name.split()[0]\n- \n- if size not in sizes:\n- sizes[size] = nbElements\n- if self.csv:\n- names[size] = [name, ]\n- else:\n- sizes[size] += nbElements\n- if self.csv:\n- names[size].append(name)\n- sum += size\n- nbSubItems += nbElements\n- number += 1\n- progress.inc()\n- progress.done()\n-\n- if self.outFileName != None:\n- plotter = RPlotter(self.outFileName, self._verbosity)\n- plotter.setFill(0)\n- plotter.setMinimumX(self.xMin)\n- plotter.setMaximumX(self.xMax)\n- plotter.setXLabel(self.xLab)\n- plotter.setYLabel(self.yLab)\n- plotter.setBarplot(self.barplot)\n- plotter.addLine(sizes)\n- plotter.plot()\n- \n- if nbSubItems == 0:\n- self._logAndRaise("No item found")\n- \n- if self.csv:\n- csvHandle = open(self.csv, "w")\n- for size in range(min(sizes.keys()), max(sizes.keys())+1):\n- if size not in sizes:\n- csvHandle.write("%d,0,\\n" % (size))\n- else:\n- csvHandle.write("%d,%d,%s\\n" % (size, sizes[size], ";".join(names[size])))\n- csvHandle.close()\n- \n- self.items = number \n- self.subItems = nbSubItems\n- self.nucleotides = sum\n- self.minAvgMedMax = Utils.getMinAvgMedMax(sizes)\n- \n- print "%d items" % (number)\n- print "%d sub-items" % (nbSubItems)\n- print "%d nucleotides" % (sum)\n- print "min/avg/med/max transcripts: %d/%.2f/%.1f/%d" % Utils.getMinAvgMedMax(sizes)\n-\n- self._log.info("END getsizes")\n-\n-\n-if __name__ == "__main__":\n- iGetSizes = GetSizes()\n- iGetSizes.setAttributesFromCmdLine()\n- iGetSizes.run()\n- \n-#TODO: add two more options!!!!!!\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getWigData.py --- a/smart_toolShed/SMART/Java/Python/getWigData.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,67 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.parsing.WigParser import WigParser -from commons.core.writer.Gff3Writer import Gff3Writer -from SMART.Java.Python.misc.Progress import Progress - - -if __name__ == "__main__": - - # parse command line - description = "Get WIG Data v1.0.1: Compute the average data for some genomic coordinates using WIG files (thus covering a large proportion of the genome) and update a tag. [Category: WIG Tools]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-w", "--wig", dest="wig", action="store", type="string", help="wig file name [compulsory] [format: file in WIG format]") - parser.add_option("-t", "--tag", dest="tag", action="store", type="string", help="choose a tag name to write the wig information to output file [compulsory] [format: file in WIG format]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in GFF3 format]") - parser.add_option("-s", "--strands", dest="strands", action="store_true", default=False, help="consider both strands separately [format: boolean] [default: False]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - # create parsers and writers - transcriptParser = TranscriptContainer(options.inputFileName, options.inputFormat, options.verbosity) - wigParser = WigParser(options.wig) - writer = Gff3Writer(options.outputFileName, options.verbosity) - wigParser.setStrands(options.strands) - - progress = Progress(transcriptParser.getNbTranscripts(), "Parsing %s" % (options.inputFileName), options.verbosity) - for transcript in transcriptParser.getIterator(): - values = transcript.extractWigData(wigParser) - if options.strands: - values = values[transcript.getDirection()] - transcript.setTagValue(options.tag, str(float(sum(values)) / len(values))) - writer.addTranscript(transcript) - progress.inc() - progress.done() |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getWigDistance.py --- a/smart_toolShed/SMART/Java/Python/getWigDistance.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,105 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# -""" -Cluster the data into regions (defined by size and overlap with next region) and keep only highest peaks. -""" - -from optparse import OptionParser -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from commons.core.parsing.WigParser import WigParser -from SMART.Java.Python.misc.Progress import Progress -from SMART.Java.Python.misc.RPlotter import RPlotter - - -if __name__ == "__main__": - - # parse command line - description = "Get WIG Data v1.0.2: Compute the average data around some genomic coordinates using WIG files (thus covering a large proportion of the genome). [Category: WIG Tools]" - - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]") - parser.add_option("-f", "--inputFormat", dest="inputFormat", action="store", type="string", help="format of the input file [compulsory] [format: transcript file format]") - parser.add_option("-w", "--wig", dest="wig", action="store", type="string", help="wig file name [compulsory] [format: file in WIG format]") - parser.add_option("-d", "--distance", dest="distance", action="store", default=1000, type="int", help="distance around position [compulsory] [format: int] [default: 1000]") - parser.add_option("-s", "--strands", dest="strands", action="store_true", default=False, help="consider both strands separately [format: boolean] [default: False]") - parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [compulsory] [format: output file in PNG format]") - parser.add_option("-a", "--default", dest="defaultValue", action="store", default=0.0, type="float", help="default value (when value is NA) [default: 0.0] [format: float]") - parser.add_option("-l", "--log", dest="log", action="store_true", default=False, help="use log scale for y-axis [format: boolean] [default: False]") - parser.add_option("-k", "--keep", dest="keep", action="store_true", default=False, help="keep temporary files [format: boolean] [default: False]") - parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") - (options, args) = parser.parse_args() - - # create parsers and writers - transcriptParser = TranscriptContainer(options.inputFileName, options.inputFormat, options.verbosity) - wigParser = WigParser(options.wig) - wigParser.setStrands(options.strands) - wigParser.setDefaultValue(options.defaultValue) - - # allocate data - strands = (1, -1) if options.strands else (1, ) - values = {} - for strand in strands: - values[strand] = dict([(i, 0.0) for i in range(-options.distance, options.distance+1)]) - - # read transcripts - progress = Progress(transcriptParser.getNbTranscripts(), "Parsing %s" % (options.inputFileName), options.verbosity) - for transcript in transcriptParser.getIterator(): - transcript.removeExons() - transcript.restrictStart(2) - transcript.extendStart(options.distance) - transcript.extendEnd(options.distance-1) - theseValues = transcript.extractWigData(wigParser) - if len(strands) == 1: - theseValues = {1: theseValues} - for strand in strands: - if len(theseValues[strand]) < 2 * options.distance + 1: - theseValues[strand] = [options.defaultValue] * (2 * options.distance + 1 - len(theseValues[strand])) + theseValues[strand] - if len(theseValues[strand]) != 2 * options.distance + 1: - raise Exception("Got something wrong with the size of the WIG data concerning %s: %d found instead of %d" % (transcript, len(theseValues[strand]), 2 * options.distance + 1)) - for i in range(-options.distance, options.distance+1): - values[strand][i] += theseValues[strand][i + options.distance] - progress.inc() - progress.done() - - for strand in strands: - for i in range(-options.distance, options.distance+1): - values[strand][i] /= transcriptParser.getNbTranscripts() * strand - - # draw plot - plotter = RPlotter(options.outputFileName, options.verbosity, options.keep) - plotter.setXLabel("Distance") - plotter.setYLabel("WigValue") - for strand in strands: - plotter.addLine(values[strand]) - if options.log: - plotter.setLog("y") - plotter.plot() - |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/getWigProfile.py --- a/smart_toolShed/SMART/Java/Python/getWigProfile.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,160 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""\n-Cluster the data into regions (defined by size and overlap with next region) and keep only highest peaks.\n-"""\n-\n-import math\n-from optparse import OptionParser\n-from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer\n-from commons.core.parsing.WigParser import WigParser\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-\n-class GetWigProfile(object):\n-\n-\tdef __init__(self, verbosity):\n-\t\tself.verbosity\t= verbosity\n-\t\tself.values\t\t = {}\n-\t\tself.defaultValue = 0.0\n-\n-\tdef _iToJ(self, i, size):\n-\t\treturn min(self.nbPoints+1, int(math.floor(float(i - self.distance) / (size) * (self.nbPoints))))\n-\n-\tdef readTranscripts(self):\n-\t\tself.strandNames = (1, -1) if self.strands else (1, )\n-\t\tself.values\t\t= dict([(strand, dict([(i, 0.0) for i in range(self.nbPoints + 2 * self.distance)])) for strand in self.strandNames])\n-\t\ttranscriptParser = TranscriptContainer(self.inputFileName, self.inputFormat, self.verbosity)\n-\t\twigParser\t\t= WigParser(self.wig)\n-\t\tnbValues\t\t = dict([(strand, dict([(i, 0.0) for i in range(self.nbPoints + 2 * self.distance)])) for strand in self.strandNames])\n-\t\twigParser.setStrands(self.strands)\n-\t\twigParser.setDefaultValue(self.defaultValue)\n-\n-\t\tprogress = Progress(transcriptParser.getNbTranscripts(), "Parsing %s" % (self.inputFileName), self.verbosity)\n-\t\tfor transcript in transcriptParser.getIterator():\n-\t\t\ttranscriptSize = transcript.getSize()\n-\t\t\texpectedSize = transcriptSize + 2 * self.distance\n-\t\t\ttranscript.extendStart(self.distance)\n-\t\t\ttranscript.extendEnd(self.distance)\n-\t\t\ttheseValues = transcript.extractWigData(wigParser)\n-\n-\t\t\tif len(self.strandNames) == 1:\n-\t\t\t\ttheseValues = {1: theseValues}\n-\t\t\tfor strand in self.strandNames:\n-\t\t\t\tif len(theseValues[strand]) < expectedSize:\n-\t\t\t\t\ttheseValues[strand] = [self.defaultValue] * (expectedSize - len(theseValues[strand])) + theseValues[strand]\n-\t\t\t\tif len(theseValues[strand]) != expectedSize:\n-\t\t\t\t\traise Exception("Got something wrong with the size of the WIG data concerning %s [%s]: %d found instead of %d" % (transcript, ",".join(["%d-%d" % (exon.getStart(), exon.getEnd()) for exon in transcript.getExons()]), len(theseValues[strand]), expectedSize))\n-\t\t\t\tfivePValues = theseValues[strand][: self.distance]\n-\t\t\t\tnbValues = [0.0] * (self.nbPoints)\n-\t\t\t\ttranscriptValues = [0.0] * (self.nbPoints)\n-\t\t\t\tfor i in range(self.distance, len(theseValues[stra'..b'-\t\t\t\tstrand = 1\n-\t\t\tfor i in range(self.nbPoints + 2 * self.distance):\n-\t\t\t\tself.values[strand][i] /= transcriptParser.getNbTranscripts() * strand\n-\n-\n-\tdef smoothen(self):\n-\t\tif self.smoothenForce == None:\n-\t\t\treturn\n-\t\tfor strand in self.strandNames:\n-\t\t\taverageValues = {}\n-\t\t\tfor center in range(self.distance, self.distance + self.nbPoints):\n-\t\t\t\tsum\t\t= 0.0\n-\t\t\t\tnbValues = 0.0\n-\t\t\t\tfor i in range(center - self.smoothenForce + 1, center + self.smoothenForce):\n-\t\t\t\t\tif i > self.distance and i < self.distance + self.nbPoints:\n-\t\t\t\t\t\tnbValues += 1\n-\t\t\t\t\t\tsum\t\t+= self.values[strand][i]\n-\t\t\t\taverageValues[center] = sum / nbValues\n-\t\t\tfor position in range(self.distance, self.distance + self.nbPoints):\n-\t\t\t\tself.values[strand][position] = averageValues[position]\n-\t\t\n-\n-\tdef plot(self):\n-\t\tplotter = RPlotter(self.outputFileName, self.verbosity)\n-\t\tfor strand in self.strandNames:\n-\t\t\tplotter.addLine(self.values[strand])\n-\t\tif self.log:\n-\t\t\tplotter.setLog("y")\n-\t\tplotter.setAxisLabel("x", {0: -self.distance, self.distance: "start", self.distance+self.nbPoints-1: "end", 2*self.distance+self.nbPoints-1: self.distance})\n-\t\tplotter.plot()\n-\n-\n-\n-if __name__ == "__main__":\n-\t\n-\t# parse command line\n-\tdescription = "Get WIG Profile v1.0.1: Compute the average profile of some genomic coordinates using WIG files (thus covering a large proportion of the genome). [Category: WIG Tools]"\n-\n-\tparser = OptionParser(description = description)\n-\tparser.add_option("-i", "--input",\t\t\t dest="inputFileName",\taction="store",\t\t\t\t\t\t\t\t\t\t\ttype="string", help="input file [compulsory] [format: file in transcript format given by -f]")\n-\tparser.add_option("-f", "--inputFormat", dest="inputFormat",\t\taction="store",\t\t\t\t\t\t\t\t\t\t\ttype="string", help="format of the input file [compulsory] [format: transcript file format]")\n-\tparser.add_option("-w", "--wig",\t\t\t\t dest="wig",\t\t\t\t\t\taction="store",\t\t\t\t\t\t\t\t\t\t\ttype="string", help="wig file name [compulsory] [format: file in WIG format]")\t\n-\tparser.add_option("-p", "--nbPoints",\t\t dest="nbPoints",\t\t\t\taction="store",\t\t\t default=1000,\ttype="int",\t\t help="number of points on the x-axis [compulsory] [format: int] [default: 1000]")\t\n-\tparser.add_option("-d", "--distance",\t\t dest="distance",\t\t\t\taction="store",\t\t\t default=0,\t\t\ttype="int",\t\t help="distance around genomic coordinates [compulsory] [format: int] [default: 0]")\t\n-\tparser.add_option("-s", "--strands",\t\t dest="strands",\t\t\t\taction="store_true", default=False,\t\t\t\t\t\t\t\t help="consider both strands separately [format: boolean] [default: False]")\t\n-\tparser.add_option("-m", "--smoothen",\t\t dest="smoothen",\t\t\t\taction="store",\t\t\t default=None,\ttype="int",\t\t help="smoothen the curve [format: int] [default: None]")\t\n-\tparser.add_option("-a", "--default",\t\t dest="defaultValue",\t action="store",\t\t\t default=0.0,\t type="float",\thelp="default value (when value is NA) [default: 0.0] [format: float]")\n-\tparser.add_option("-o", "--output",\t\t\t dest="outputFileName", action="store",\t\t\t\t\t\t\t\t\t\t\ttype="string", help="output file [compulsory] [format: output file in PNG format]")\n-\tparser.add_option("-l", "--log",\t\t\t\t dest="log",\t\t\t\t\t\taction="store_true", default=False,\t\t\t\t\t\t\t\t help="use log scale for y-axis\t[format: boolean] [default: False]")\n-\tparser.add_option("-v", "--verbosity",\t dest="verbosity",\t\t\taction="store",\t\t\t default=1,\t\t\ttype="int",\t\t help="trace level [format: int]")\n-\t(options, args) = parser.parse_args()\n-\n-\twigProfile\t\t\t\t\t\t\t\t= GetWigProfile(options.verbosity)\n-\twigProfile.strands\t\t\t \t= options.strands\n-\twigProfile.inputFileName\t= options.inputFileName\n-\twigProfile.inputFormat\t\t= options.inputFormat\n-\twigProfile.wig\t\t\t\t\t\t= options.wig\n-\twigProfile.nbPoints\t\t\t\t= options.nbPoints\n-\twigProfile.distance\t\t\t\t= options.distance\n-\twigProfile.smoothenForce\t= options.smoothen\n-\twigProfile.defaultValue\t = options.defaultValue\n-\twigProfile.outputFileName = options.outputFileName\n-\twigProfile.log\t\t\t\t\t\t= options.log\n-\n-\twigProfile.readTranscripts()\n-\twigProfile.smoothen()\n-\twigProfile.plot()\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/mapperAnalyzer.py --- a/smart_toolShed/SMART/Java/Python/mapperAnalyzer.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,486 +0,0 @@\n-#! /usr/bin/env python\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-"""\n-Read a mapping file (many formats supported) and select some of them\n-Mappings should be sorted by read names\n-"""\n-import os, random, shelve\n-from optparse import OptionParser, OptionGroup\n-from commons.core.parsing.ParserChooser import ParserChooser\n-from commons.core.parsing.FastaParser import FastaParser\n-from commons.core.parsing.FastqParser import FastqParser\n-from commons.core.parsing.GffParser import GffParser\n-from commons.core.writer.BedWriter import BedWriter\n-from commons.core.writer.UcscWriter import UcscWriter\n-from commons.core.writer.GbWriter import GbWriter\n-from commons.core.writer.Gff2Writer import Gff2Writer\n-from commons.core.writer.Gff3Writer import Gff3Writer\n-from commons.core.writer.FastaWriter import FastaWriter\n-from commons.core.writer.FastqWriter import FastqWriter\n-from commons.core.writer.MySqlTranscriptWriter import MySqlTranscriptWriter\n-from SMART.Java.Python.mySql.MySqlConnection import MySqlConnection\n-from SMART.Java.Python.mySql.MySqlTable import MySqlTable\n-from SMART.Java.Python.misc.RPlotter import RPlotter\n-from SMART.Java.Python.misc.Progress import Progress\n-from SMART.Java.Python.misc.UnlimitedProgress import UnlimitedProgress\n-\n-\n-distanceExons = 20\n-exonSize = 20\n-\n-\n-class MapperAnalyzer(object):\n- """\n- Analyse the output of a parser\n- """\n-\n- def __init__(self, verbosity = 0):\n- self.verbosity = verbosity\n- self.mySqlConnection = MySqlConnection(verbosity)\n- self.tooShort = 0\n- self.tooManyMismatches = 0\n- self.tooManyGaps = 0\n- self.tooShortExons = 0\n- self.tooManyMappings = 0\n- self.nbMappings = 0\n- self.nbSequences = 0\n- self.nbAlreadyMapped = 0\n- self.nbAlreadyMappedSequences = 0\n- self.nbWrittenMappings = 0\n- self.nbWrittenSequences = 0\n- self.parser = None\n- self.logHandle = None\n- self.randomNumber = random.randint(0, 100000)\n- self.gff3Writer = None\n- self.alreadyMappedReader = None\n- self.unmatchedWriter = None\n- self.sequenceListParser = None\n- self.sequences = None\n- self.alreadyMapped = None\n- self.mappedNamesTable = None\n- s'..b'up.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [default: 1] [format: int]")\n- otheGroup.add_option("-l", "--log", dest="log", action="store_true", default=False, help="write a log file [format: bool] [default: false]")\n- parser.add_option_group(compGroup)\n- parser.add_option_group(filtGroup)\n- parser.add_option_group(tranGroup)\n- parser.add_option_group(outpGroup)\n- parser.add_option_group(otheGroup)\n- (options, args) = parser.parse_args()\n-\n- \n- analyzer = MapperAnalyzer(options.verbosity)\n- analyzer.setMappingFile(options.inputFileName, options.format)\n- analyzer.setSequenceFile(options.sequencesFileName, options.sequenceFormat)\n- analyzer.setOutputFile(options.outputFileName, options.title)\n- if options.appendFileName != None:\n- analyzer.setAlreadyMatched(options.appendFileName)\n- if options.remaining:\n- analyzer.setRemainingFile(options.outputFileName, options.sequenceFormat)\n- if options.number != None:\n- analyzer.setMaxMappings(options.number)\n- if options.size != None:\n- analyzer.setMinSize(options.size)\n- if options.identity != None:\n- analyzer.setMinId(options.identity)\n- if options.mismatch != None:\n- analyzer.setMaxMismatches(options.mismatch)\n- if options.gap != None:\n- analyzer.setMaxGaps(options.gap)\n- if options.mergeExons:\n- analyzer.mergeExons(True)\n- if options.removeExons:\n- analyzer.acceptShortExons(False)\n- if options.log:\n- analyzer.setLog("%s.log" % (options.outputFileName))\n- analyzer.analyze()\n- \n- if options.verbosity > 0:\n- print "kept %i sequences over %s (%f%%)" % (analyzer.nbWrittenSequences, analyzer.nbSequences, float(analyzer.nbWrittenSequences) / analyzer.nbSequences * 100)\n- if options.appendFileName != None:\n- print "kept %i sequences over %s (%f%%) including already mapped sequences" % (analyzer.nbWrittenSequences + analyzer.nbAlreadyMappedSequences, analyzer.nbSequences, float(analyzer.nbWrittenSequences + analyzer.nbAlreadyMappedSequences) / analyzer.nbSequences * 100)\n- print "kept %i mappings over %i (%f%%)" % (analyzer.nbWrittenMappings, analyzer.nbMappings, float(analyzer.nbWrittenMappings) / analyzer.nbMappings * 100)\n- if options.appendFileName != None:\n- print "kept %i mappings over %i (%f%%) including already mapped" % (analyzer.nbWrittenMappings + analyzer.nbAlreadyMapped, analyzer.nbMappings, float(analyzer.nbWrittenMappings + analyzer.nbAlreadyMapped) / analyzer.nbMappings * 100)\n- print "removed %i too short mappings (%f%%)" % (analyzer.tooShort, float(analyzer.tooShort) / analyzer.nbMappings * 100)\n- print "removed %i mappings with too many mismatches (%f%%)" % (analyzer.tooManyMismatches, float(analyzer.tooManyMismatches) / analyzer.nbMappings * 100)\n- print "removed %i mappings with too many gaps (%f%%)" % (analyzer.tooManyGaps, float(analyzer.tooManyGaps) / analyzer.nbMappings * 100)\n- print "removed %i mappings with too short exons (%f%%)" % (analyzer.tooShortExons, float(analyzer.tooShortExons) / analyzer.nbMappings * 100)\n- print "removed %i sequences with too many hits (%f%%)" % (analyzer.tooManyMappings, float(analyzer.tooManyMappings) / analyzer.nbSequences * 100)\n- print "%i sequences have no mapping (%f%%)" % (analyzer.nbSequences - analyzer.nbWrittenSequences, float(analyzer.nbSequences - analyzer.nbWrittenSequences) / analyzer.nbSequences * 100)\n- if options.appendFileName != None:\n- print "%i sequences have no mapping (%f%%) excluding already mapped sequences" % (analyzer.nbSequences - analyzer.nbWrittenSequences - analyzer.nbAlreadyMappedSequences, float(analyzer.nbSequences - analyzer.nbWrittenSequences - analyzer.nbAlreadyMappedSequences) / analyzer.nbSequences * 100)\n-\n-\n' |
b |
diff -r 1fc014126d55 -r ea3082881bf8 smart_toolShed/SMART/Java/Python/mappingToCoordinates.py --- a/smart_toolShed/SMART/Java/Python/mappingToCoordinates.py Fri Jan 18 04:45:50 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,91 +0,0 @@ -#! /usr/bin/env python -# -# Copyright INRA-URGI 2009-2010 -# -# This software is governed by the CeCILL license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL license and that you accept its terms. -# - - -"""Convert files with some mapping format to coordinates format""" - -import os -from optparse import OptionParser -from commons.core.parsing.PslParser import PslParser -from commons.core.parsing.AxtParser import AxtParser -from commons.core.writer.Gff3Writer import Gff3Writer -from commons.core.writer.MySqlTranscriptWriter import MySqlTranscriptWriter -from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator -from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer -from SMART.Java.Python.misc.Progress import Progress - - -class MappingToCoordinates(object): - def __init__(self,verbosity=1, inputFileName=None, format = None, output=None,galaxy = False, title="S-MART"): - self.verbosity = verbosity - self.inputFileName = inputFileName - self.format = format - self.output = output - self.galaxy = galaxy - self.title = title - - def setAttributesFromCmdLine(self): - description = "Mapping To Coordinates v1.0.1: Convert a set of mappings (given by a mapping tool) to a set of transcripts. [Category: Conversion]" - parser = OptionParser(description = description) - parser.add_option("-i", "--input", dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in mapping format given by -f]") - parser.add_option("-f", "--format", dest="format", action="store", type="string", help="format of file [compulsory] [format: mapping file format]") - parser.add_option("-o", "--output", dest="output", action="store", default=None, type="string", help="output file [compulsory]  |